Page 1 of 1
custom interaction command
Posted: 20 Nov 2011, 12:42
by Erik
What i need is basically a unit A having a custom command xyz that is issued when clicking a unit B meeting certain conditions [i.e. same team] and in those cases overrides the default behavior [guard/attack or. w/e.] for example to merge two units.
Anyone knows where to start? Is there any documentation on custom commands?
Re: custom interaction command
Posted: 20 Nov 2011, 13:02
by jK
Re: custom interaction command
Posted: 20 Nov 2011, 14:37
by Erik
Can't really find anything usefull there, a tutorial or sample script for commands would be cool.
Re: custom interaction command
Posted: 20 Nov 2011, 15:02
by Jools
Have a look in the callins:
http://springrts.com/wiki/LuaCallinReturn
If the thing you want to trigger is on mouseclick, then maybe extend that command and check whether the selected unit is on your team etc... and then do the action.
You could also extend the AllowCommand command. If you return true from one of these commands then the default one won't be executed.
Re: custom interaction command
Posted: 20 Nov 2011, 15:15
by FLOZi
Re: custom interaction command
Posted: 20 Nov 2011, 15:49
by Anarchid
Actually "DefaultCommand() --> nothing (???)" sounds exactly like what OP wants, and it has an example right there, linking to the thread next door.
Re: custom interaction command
Posted: 20 Nov 2011, 23:04
by knorke
kernel panic has some easy examples on custom commands:
bug_bombard.lua
burrow.lua
examples that adds toggle button to units:
http://springrts.com/wiki/SetMoveTypeDataExample
I would start with a custom command that is just a button (say click button=explode unit) and once that works, do commands with parameters.