Page 1 of 1
Setting unit Active/Passive state
Posted: 08 Sep 2014, 10:05
by gajop
How can this be done?
I tried the following, but none of it had any effect:
Code: Select all
Spring.GiveOrderToUnit(unitId, CMD.INSERT,
{ 0, CMD.ONOFF, 0, boolToNumber(s.active)},
{"alt"}
);
Spring.GiveOrderToUnit(unitId, CMD.INSERT,
{ 0, CMD.IDLEMODE, 0, boolToNumber(s.active)},
{"alt"}
);
Spring.SetUnitCOBValue(unitId, COB.ACTIVATION, boolToNumber(s.active))
Re: Setting unit Active/Passive state
Posted: 08 Sep 2014, 10:30
by Silentwings
I didn't check syntax but I would expect the third of those to have worked.
I'm not sure of the relationship inside engine between on/off and active/passive (or even if there is one). I have no idea what CMD.IDLEMODE does and wiki seems not to know either.
If you are testing with BA & constructors, we have a custom CMD.PASSIVE that is implemented with a gadget.
Re: Setting unit Active/Passive state
Posted: 08 Sep 2014, 11:45
by jK
1. CMD.IDLEMODE is iirc air landing behavior
2. why use CMD.INSERT to push a cmd to the _front_?
Re: Setting unit Active/Passive state
Posted: 08 Sep 2014, 12:08
by gajop
jK wrote:2. why use CMD.INSERT to push a cmd to the _front_?
I want the existing command queue to remain and only change the state of the unit. Putting it in the front should make sure that happens immediately.
Re: Setting unit Active/Passive state
Posted: 08 Sep 2014, 12:13
by jK
shift?
Hint: shift doesn't always append the cmd to the end of the queue, it just makes sure the queue remains. Beside that there are two different types of cmds: state ones and orders. on/off, firestate, repeat, ... are state ones those always executed directly when you give the cmd and are never really added to the queue (in lua point of view it's like processing the cmd in AllowCommand instead of Fallback).
Re: Setting unit Active/Passive state
Posted: 08 Sep 2014, 12:39
by gajop
jK wrote:shift?
Hint: shift doesn't always append the cmd to the end of the queue, it just makes sure the queue remains. Beside that there are two different types of cmds: state ones and orders. on/off, firestate, repeat, ... are state ones those always executed directly when you give the cmd and are never really added to the queue (in lua point of view it's like processing the cmd in AllowCommand instead of Fallback).
Oh, OK, that simplifies things. Will amend the code, thanks.