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?
custom interaction command
Moderator: Moderators
Re: custom interaction command
everything is on
http://answers.springlobby.info/questions/
http://answers.springlobby.info/questions/
Re: custom interaction command
Can't really find anything usefull there, a tutorial or sample script for commands would be cool.
Re: custom interaction command
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.
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
I only know of a question on custom command cursors, not one detailing how to set up a custom command (including use of UnitMoveGoal for this, probably) etcjK wrote:everything is on
http://answers.springlobby.info/questions/
Example gadget with custom command that uses SetUnitMoveGoal, target is an area
Another example - this one has a command where the target is a unit
Wiki page on lua commands
Re: custom interaction command
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
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.
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.