Page 1 of 1

Applying one unit's command(s) to other units?

Posted: 02 Oct 2012, 16:51
by yanom
I'm currently writing an improved CarrierDrones gadget called SwarmDrones that allows for, among other things, multiple swarm types per host. I want to set it up so that orders given to the "host" unit (move here, attack this, fight, guard, etc.) are also given to all his (unselectable) drone minions. This means that, essentially, the drone's command queue should be a copy of the host's. How do I set a unit's command queue like that?

Re: Applying one unit's command(s) to other units?

Posted: 03 Oct 2012, 00:54
by Beherith

Re: Applying one unit's command(s) to other units?

Posted: 03 Oct 2012, 02:07
by yanom
so I'm assuming i should iterate through the host's command queue...

Code: Select all

for i,v in Spring.GetCommandQueue(hostUnitID) do
then use...

Code: Select all

Spring.GiveOrderToUnitArray(arrayOfDroneUnitIDs,v)
end
?

Re: Applying one unit's command(s) to other units?

Posted: 03 Oct 2012, 09:54
by Beherith
yep

Re: Applying one unit's command(s) to other units?

Posted: 04 Oct 2012, 02:47
by yanom
Ok, cool!

But in order to prevent duplicate orders from stacking up in the drones' order queue, I'll need to wipe their order queue before copying all the orders from the host into the queue. How do I wipe a unit's order queue?

Re: Applying one unit's command(s) to other units?

Posted: 04 Oct 2012, 02:56
by gajop
yanom wrote:How do I wipe a unit's order queue?
Overwriting the command queue by giving a new order (which is done by just giving the order if shift isn't used), or by sending a stop order