Basically, I'd like to alter the precedence of certain commands, and I was wondering whether this is at all possible with Lua at present.
For example... if you have a unit that's armed, and you move your mouse over another unit, it will Attack. Even if the Unit is supposed to, say, Capture stuff, or use Reclaim to suck them up, and the "weapon" is a dummy, used for another purpose. Yeah, I know you can make CanAttack == 0, but that's not what I mean here, it's not just this specific problem.
Is there any way to re-order which commands are the default, for a given situation, or is this entirely hard-coded?
Precedence of Commands...
Moderator: Moderators
Re: Precedence of Commands...
gadget:DefaultCommand() (unsynced)
Exists for widgets too. Look into Fibre for an example.
Exists for widgets too. Look into Fibre for an example.
Re: Precedence of Commands...
Thanks very much, KDR! I've written a modified version for P.U.R.E., it'll be included in the World Builder archive.
Re: Precedence of Commands...
Drat. On further testing, this isn't going to work. Meh, what I need is to change the command conditionally. I should probably explain what I actually need to do
Basically, in P.U.R.E., EngineeringTeams (builder units) can Capture and can Reclaim. Spring always puts Builder Units on Reclaim, if they can Reclaim, if the mouse is released over a non-friendly Unit. I want to make it select Capture, instead, because alpha-testers have found this confusing.
Just for that Unit, mind ye, not for everything that can Reclaim / Capture.

Basically, in P.U.R.E., EngineeringTeams (builder units) can Capture and can Reclaim. Spring always puts Builder Units on Reclaim, if they can Reclaim, if the mouse is released over a non-friendly Unit. I want to make it select Capture, instead, because alpha-testers have found this confusing.
Just for that Unit, mind ye, not for everything that can Reclaim / Capture.
Re: Precedence of Commands...
Er, that's pretty damn easy? Look at Fibre again, you don't e.g. get the Align command for factories, you get Move Beacon instead. To make the cursor change based on the target you need a widget as it is used in KP to implement the packet Enter command.
Re: Precedence of Commands...
Yeah, that's what I need. I'll take a look. Sorry, if this seems easy or whatever, I just haven't gotten into that area yet, my custom stuff is mainly having to do with Lua --> COB interactions, not all-Lua stuff. This was a special case, basically, I hadn't run into this problem before.To make the cursor change based on the target you need a widget as it is used in KP to implement the packet Enter command.