- 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?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
if GetUnitCurrentOrder(unit) == 0 thenthat 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.
(Current order of (Triggering unit)) Equal (Order(<Empty String>))
Untitled Trigger 001

Events


Time - Every 2.00 seconds of game time

Conditions

Actions


Unit Group - Pick every unit in (Units of type Basal Golem created from blood forge) and do (Actions)



Loop - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






Or - Any (Conditions) are true







Conditions








(Current order of (Picked unit)) Equal to (Order(smart))








(Current order of (Picked unit)) Equal to (Order(attack))








(Current order of (Picked unit)) Equal to (Order(move))








(Current order of (Picked unit)) Equal to (Order(cloudoffog))








(Current order of (Picked unit)) Equal to (Order(charm))





Then - Actions






Do nothing





Else - Actions






Unit - Order (Picked unit) to Night Elf Druid Of The Claw - Bear Form






Unit - Order (Picked unit) to Night Elf Druid Of The Claw - Night Elf Form
construction on site 1

Events


Unit - A unit Starts the effect of an ability

Conditions

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




And - All (Conditions) are true





Conditions






(Foundation1 <gen> contains (Casting unit)) Equal to True






(Ability being cast) Equal to transform into arbor lodge new






(Number of units in (Units in Foundation1 <gen> matching ((Unit-type of (Matching unit)) Equal to Basal Golem created from blood forge))) Equal to 4



Then - Actions




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Item - Move (Item carried by (Picked unit) in slot 1) to ((Position of (Picked unit)) offset by (-200.00, 0.00)))




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Unit - Remove (Picked unit) from the game)




Unit - Create 1 Arbor Lodge for (Owner of (Casting unit)) at (Center of Foundation1 <gen>) facing Default building facing degrees




Unit Group - Add (Last created unit) to site1




Player - Add 250 to (Owner of (Last created unit)) Current lumber



Else - Actions




Do nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




And - All (Conditions) are true





Conditions






(Foundation1 <gen> contains (Casting unit)) Equal to True






(Ability being cast) Equal to transform into barrracks new






(Number of units in (Units in Foundation1 <gen> matching ((Unit-type of (Matching unit)) Equal to Basal Golem created from blood forge))) Equal to 4



Then - Actions




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Item - Move (Item carried by (Picked unit) in slot 1) to ((Position of (Picked unit)) offset by (-200.00, 0.00)))




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Unit - Remove (Picked unit) from the game)




Unit - Create 1 Barracks custom for (Owner of (Casting unit)) at (Center of Foundation1 <gen>) facing Default building facing degrees




Unit Group - Add (Last created unit) to site1




Player - Add 250 to (Owner of (Last created unit)) Current lumber



Else - Actions




Do nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




And - All (Conditions) are true





Conditions






(Foundation1 <gen> contains (Casting unit)) Equal to True






(Ability being cast) Equal to transform into crypt new






(Number of units in (Units in Foundation1 <gen> matching ((Unit-type of (Matching unit)) Equal to Basal Golem created from blood forge))) Equal to 4



Then - Actions




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Item - Move (Item carried by (Picked unit) in slot 1) to ((Position of (Picked unit)) offset by (-200.00, 0.00)))




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Unit - Remove (Picked unit) from the game)




Unit - Create 1 Crypt custom for (Owner of (Casting unit)) at (Center of Foundation1 <gen>) facing Default building facing degrees




Unit Group - Add (Last created unit) to site1




Player - Add 250 to (Owner of (Last created unit)) Current lumber



Else - Actions




Do nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




And - All (Conditions) are true





Conditions






(Foundation1 <gen> contains (Casting unit)) Equal to True






(Ability being cast) Equal to transform into rune stone new






(Number of units in (Units in Foundation1 <gen> matching ((Unit-type of (Matching unit)) Equal to Basal Golem created from blood forge))) Equal to 4



Then - Actions




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Item - Move (Item carried by (Picked unit) in slot 1) to ((Position of (Picked unit)) offset by (-200.00, 0.00)))




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Unit - Remove (Picked unit) from the game)




Unit - Create 1 Rune stone for (Owner of (Casting unit)) at (Center of Foundation1 <gen>) facing Default building facing degrees




Unit Group - Add (Last created unit) to site1




Player - Add 250 to (Owner of (Last created unit)) Current lumber



Else - Actions




Do nothing


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




And - All (Conditions) are true





Conditions






(Foundation1 <gen> contains (Casting unit)) Equal to True






(Ability being cast) Equal to transform into temple new






(Number of units in (Units in Foundation1 <gen> matching ((Unit-type of (Matching unit)) Equal to Basal Golem created from blood forge))) Equal to 4



Then - Actions




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Item - Move (Item carried by (Picked unit) in slot 1) to ((Position of (Picked unit)) offset by (-200.00, 0.00)))




Unit Group - Pick every unit in (Units in Foundation1 <gen>) and do (Unit - Remove (Picked unit) from the game)




Unit - Create 1 Temple custom for (Owner of (Casting unit)) at (Center of Foundation1 <gen>) facing Default building facing degrees




Unit Group - Add (Last created unit) to site1




Player - Add 250 to (Owner of (Last created unit)) Current lumber



Else - Actions




Do nothing
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:
https://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.