https://github.com/EvolutionRTS/Evoluti ... y.lua#L142
At this line is where it looks for unit inside the points. I need to be able to define a list of units that are unable to initiate capture. At the moment I intend to make it so that air units cannot capture, which could be done by simply checking for canfly, but with a list of units, that is in the end a lot more robust and futureproof. Can someone help me add this functionality?
Help adding exclusion list to game_controlVictory.lua
Moderator: Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Help adding exclusion list to game_controlVictory.lua
https://github.com/SpringMCLegacy/Sprin ... r.lua#L234
+
Not the most elegant solution just cobbling together from what I have laying around already
+
Code: Select all
local ignored = {"foo" = true, "bar" = true}
for unitDefID, ud in pairs(UnitDefs) do -- cache ignored unitDefIDs
if ignored[ud.name] then
unitDefsToIgnore[unitDefID] = true
end
end
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Help adding exclusion list to game_controlVictory.lua
Unfortunately, I don't know how to apply this. I did try by putting the get units in cylinder loop inside the loop checking for ignored unitdefs. My thinking was that we could check for ignored unitdefs and then just not do the unitsincylinder check at all if the units were in the list. However, that made things worse, not better. And thinking about it, that logic wouldn't make sense anyway.
Can you be a bit more explicit?
edit: I just pushed the file with fixed indentation. Kdr's weird indentation was driving me crazy.
Can you be a bit more explicit?
edit: I just pushed the file with fixed indentation. Kdr's weird indentation was driving me crazy.
Re: Help adding exclusion list to game_controlVictory.lua
My function removes unwanted units from the result you get from unitsincylinder, so, in brief.
1. demUnits = GetUnitsInCylinder(blah)
2. StripUnits(demUnits)
3. do WhateverYouWantedDemUnitsFor()
See here onwards: https://github.com/SpringMCLegacy/Sprin ... r.lua#L323
1. demUnits = GetUnitsInCylinder(blah)
2. StripUnits(demUnits)
3. do WhateverYouWantedDemUnitsFor()
See here onwards: https://github.com/SpringMCLegacy/Sprin ... r.lua#L323
Re: Help adding exclusion list to game_controlVictory.lua
I'd say checking for canfly is the more robust and futureproof way, compared to listing unitdefs!Forboding Angel wrote:which could be done by simply checking for canfly, but with a list of units, that is in the end a lot more robust and futureproof
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Help adding exclusion list to game_controlVictory.lua
And what happens when you want to make a special flying unit that can capture? Now you're whitelisting units on your blacklist? Overall, listing units that cannot cap (blacklist), is more scale-able (if not slightly more irritating to deal with).zwzsg wrote:I'd say checking for canfly is the more robust and futureproof way, compared to listing unitdefs!Forboding Angel wrote:which could be done by simply checking for canfly, but with a list of units, that is in the end a lot more robust and futureproof
Re: Help adding exclusion list to game_controlVictory.lua
Why use UnitsInCylinder? Why not just use AllowCommand() to prevent the capture command, or CreateUnit() to remove the command from the unit when it is created?
Or why not just set capture = 0 in the respective unitdefs? Config file is more robust than a script.
Or why not just set capture = 0 in the respective unitdefs? Config file is more robust than a script.