A quick newb question. I'm using Lua unit animation scripts instead of COB/BOS; how do I call unit animation scripts in other gadgets?
Also: is there a way of calling animation script things (Hide, Turn etc) in other gadgets?
Lua animation equivalent of Spring.CallCOBScript?
Moderator: Moderators
Re: Lua animation equivalent of Spring.CallCOBScript?
Have you seen this page? http://springrts.com/wiki/Mod_and_Unit_ ... uote][list][*]Animation-LuaScripting[*][/list][/quote]
You can call Lua's UnitScript commands, such as hide/show, from a plain regular gadget, with Spring.UnitScript.CallAsUnit.
For instance, to force the transport to drop a commander in my JailBreak gadget, I do:I am however pretty sure that this is not the way you're supposed to write unit animations. Again, read the wiki for info.
You can call Lua's UnitScript commands, such as hide/show, from a plain regular gadget, with Spring.UnitScript.CallAsUnit.
For instance, to force the transport to drop a commander in my JailBreak gadget, I do:
Code: Select all
Spring.UnitScript.CallAsUnit(transID,Spring.UnitScript.DropUnit,comID)
Re: Lua animation equivalent of Spring.CallCOBScript?
All seems to be working; thanks for the wiki links.
One thing I can't find on the wiki, though. Suppose I want to give a unit another button for some command (morph, or whatever), how would I do that? (I've tried copying from The Cursed's burrow gadget but I get error messages.)
One thing I can't find on the wiki, though. Suppose I want to give a unit another button for some command (morph, or whatever), how would I do that? (I've tried copying from The Cursed's burrow gadget but I get error messages.)
Re: Lua animation equivalent of Spring.CallCOBScript?
There is a GG table which is shared between all gadgets use it to make functions available to other gadgets.
e.g.
e.g.
Code: Select all
GG.unitscripts = GG.unitscripts or {}
GG.unitscripts.MyFunc = MyFunc2
Re: Lua animation equivalent of Spring.CallCOBScript?
Also there's Spring.UnitScript.GetScriptEnv(unitID) exported by the unit_script.lua gadget. This gives direct access to the globals table of the script of a unit.