HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Copy a units current order onto a different unit

09-04-2011, 07:46 PM#1
Fallen-God[LcR]
Hey,

Basically when a unit enters a COP, if certain conditions are true then I swap it's location with a unit which will always be placed in the centre of the COP.
That is all fine and coded.
However, what would be ideal is if, after the swapping has taken place, the unit which was at the center of the COP carries out any orders the unit which that entered had.

So if the entering unit was told to walk across the COP, after the swap the unit which was at the center would now move to where the entering unit was going to.

Is that possible, if so, can you please point me in the right direction? I have never worked with orders before.
I notice there is a GetUnitCurrentOrder( ) native, is that what I need to use to copy the orders across?

Finally, the units will not necessarily be the same type of unit. Movement/attack orders will work fine for all of them, but any kind of ability/spell orders should be ignored.

Cheers,
Fallen
09-04-2011, 08:23 PM#2
Anitarf
You would need to remember the type and target of the last order that was issued to each individual unit. Then, whenever a unit swap occurred, get the values stored for the entering unit and use them to reissue the order to the leaving unit. We already have a library that does the storing of previous unit orders for you.