- Joined
- Mar 2, 2010
- Messages
- 3,069
i have a project where i want 1 unit to transform once it have no orders. how can i accomplish that?
if GetUnitCurrentOrder(unit) == 0 then
that did absolutely nothing.
and you say that it doesn't work was wanted, so maybe we can see a mistake if you show us the trigger.i pick all units of a certain type and then check their orders
null
the unit has no order.This is not true. The unit will keep the "move" (or "smart", depending on what you used) order until it reaches it's destination. The only exception to this is movement as part of the auto-engagement mechanics, which will still be considered as no order, as technically, that unit is acting out of free will.So here's probably your problem (and i'm not sure if this is true or not). But let's Think of it this way:
A unit is issued a 'move' order to a target point. That 'Move' order has been received by the game - ordering him to MOVE to that point was the order. Actually getting to that point is NOT part the order. Since you are checking for an ORDER every two seconds, if the unit hasn't received a new order by the time it gets to the target point, it transforms regardless of where it is.
What you could do is set a temp point at the position of the order and check to see if he has gotten there or not before transforming.
As for leaks, check here:
http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/memory-leaks-263410/
that is still a single unit script and i have lots of basal golems that is created from the blood forge. i need a solution that works independent of how many units the player controls.