How do retrieve the current unit's unitid to look up details about it?
how can I do a check to see if a piece exists before specifying piece = "piecename" ?
lua animation script questions.
Moderator: Moderators
Re: lua animation script questions.
Thanks!
I am running into a new problem
I am running into a new problem
Code: Select all
if lus then
-- what goes here for lua animation scripts?
-- spCallAsUnit(unitID, env["LaunchSmoke"])
-- and
-- spCallAsUnit(unitID, "LaunchSmoke")
-- doesn't pick up the launch smoke function
-- instead both result in
-- Incorrect arguments to CallAsUnit()
return true
else
spCallCobScript(unitID, "LaunchSmoke",0)
return true
end
Re: lua animation script questions.
:\
Code: Select all
Spring.Echo("test ")
Spring.Echo(unitID)
Spring.Echo(UnitDefs[unitID])
why would it be nil?[f=0000166] test
[f=0000166] 27633
[f=0000166] nil
Re: lua animation script questions.
the entries in UnitDefs are indexed by unitDefIDs but you put in a unitID.
and echo can not print a table, you need to loop through it.
the GRTS_Ability_smokelauncher.lua is actually good example for that as it uses all this. if you are trying to make it work with cob and lua try like this:(never tested if the else works like this to detect between lus/cob, if not remove the cob part)
and echo can not print a table, you need to loop through it.
the GRTS_Ability_smokelauncher.lua is actually good example for that as it uses all this. if you are trying to make it work with cob and lua try like this:
Code: Select all
env = Spring.UnitScript.GetScriptEnv(u)
if (env) then Spring.UnitScript.CallAsUnit(u, env.LaunchSmoke, 0)
else--its a cob script?
Spring.CallCOBScript(u, "LaunchSmoke",0)
end