Applying one unit's command(s) to other units?
Moderator: Moderators
Applying one unit's command(s) to other units?
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?
so I'm assuming i should iterate through the host's command queue...
then use...
?
Code: Select all
for i,v in Spring.GetCommandQueue(hostUnitID) do
Code: Select all
Spring.GiveOrderToUnitArray(arrayOfDroneUnitIDs,v)
end
Re: Applying one unit's command(s) to other units?
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?
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?
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 orderyanom wrote:How do I wipe a unit's order queue?