Trouble with Lua inside YMSAI (one of Conflict Terra's AI's)
Posted: 04 Jul 2011, 00:11
so I have this code inside the gadget:UnitFinished function:
it's supposed to GiveOrderToUnit to send it to a random location if and only if the unit's name is not kdroneengineer or ktridroneroller . However, this check isn't working - all units get the order to go to a random location, even if they are the kdroneengineer unit. Infact, I get this output ingame whenever the AI makes a kdroneengineer unit:
Can anyone help me with this? I'm not really an experienced Lua coder, and besides, knorke wrote most of this code, not me.
Code: Select all
if ((unitName (unitID) ~= "kdroneengineer") or (unitName (unitID) ~= "ktridroneroller")) then
Spring.Echo( unitName(unitID) )
Spring.Echo( "The above line better not say 'kdroneengineer'" )
local x = math.random(Game.mapSizeX)
local z = math.random(Game.mapSizeZ)
Spring.GiveOrderToUnit(unitID, CMD.FIGHT , {x, Spring.GetGroundHeight (x,z), z }, {})
end
Code: Select all
kdroneengineer
the above line better not say 'kdroneengineer'