- Joined
- Dec 26, 2021
- Messages
- 47
Hello, is there any way to detect if ancient is rooted / uprooted (not movementspeed related)?
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.
Root Orders

Events


Unit - A unit Is issued an order with no target


Unit - A unit Is issued an order targeting a point


Unit - A unit Is issued an order targeting an object

Conditions


((Triggering unit) is An Ancient) Equal to True

Actions


Set VariableSet Root_Unit = (Triggering unit)


Set VariableSet Root_Order = (Issued order)


-------- --------


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



If - Conditions




Root_Order Equal to (Order(unroot))



Then - Actions




-------- UPROOTED: --------




Game - Display to (All players) for 1.00 seconds the text: Uprooted



Else - Actions




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





If - Conditions






Root_Order Equal to (Order(root))





Then - Actions






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







If - Conditions








(Root_Unit is in Root_Group.) Equal to False







Then - Actions








Unit Group - Add Root_Unit to Root_Group








Trigger - Turn on Root Loop <gen>







Else - Actions





Else - Actions






-------- It issued a different order so it's no longer trying to Root. --------






Unit Group - Remove Root_Unit from Root_Group.
Root Loop

Events


Time - Every 0.10 seconds of game time

Conditions

Actions


Unit Group - Pick every unit in Root_Group and do (Actions)



Loop - Actions




Set VariableSet Root_Unit = (Picked unit)




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





If - Conditions






(Current order of Root_Unit) Not equal to (Order(root))





Then - Actions






Unit Group - Remove Root_Unit from Root_Group.






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







If - Conditions








(Root_Unit is alive) Equal to True







Then - Actions








-------- ROOTED: --------








Game - Display to (All players) for 1.00 seconds the text: Rooted







Else - Actions





Else - Actions


-------- --------


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



If - Conditions




(Number of units in Root_Group) Equal to 0



Then - Actions




Trigger - Turn off (This trigger)



Else - Actions
easy than you and also thanks uncle for the work!BlzGetUnitBooleanField(unit, UNIT_BF_IS_A_BUILDING) returns true when ancient is rooted.
The Root Orders trigger will remove the Unit from the Unit Group if it issues an order other than root/unroot:I've tried to do this once before and I'm surprised the building check worked because apparently I ended up checking the armor type instead of whether it was a building.
I think there may be a flaw in Uncle's trigger because if I order a unit to root, it will continue to have that order until it roots. If I then tell that unit to move or cancel before it has actually rooted, it will be considered as rooted per the condition, so you'll have to check Iceman's condition once the meet the condition of not having the root order.
So
if order not equal to root AND unit is a structure then...
If the structure but doesn't work try checking the armor type, for some reason I thought that both counted as a structure, rooted or unrooted. I'll look at my system when I got home, it was GUI and very similar to Uncle's trigger
-------- It issued a different order so it's no longer trying to Root. --------
Unit Group - Remove Root_Unit from Root_Group.
Root Order

Events


Unit - A unit Is issued an order with no target

Conditions


((Triggering unit) is An Ancient) Equal to True

Actions


Set VariableSet Root_Unit = (Triggering unit)


-------- --------


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



If - Conditions




(Issued order) Equal to (Order(unroot))



Then - Actions




-------- UPROOTED: --------




Game - Display to (All players) for 1.00 seconds the text: Uprooted




-------- --------




Set VariableSet Root_Counter = (Root_Counter + 1)




-------- --------




Unit Group - Add Root_Unit to Root_Group




-------- --------




Trigger - Turn on Root Loop <gen>



Else - Actions
Root Loop

Events


Time - Every 0.01 seconds of game time

Conditions

Actions


Unit Group - Pick every unit in Root_Group and do (Actions)



Loop - Actions




Set VariableSet Root_Unit = (Picked unit)




-------- --------




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





If - Conditions






(Unit: Root_Unit's Boolean Field: Is a Building ('ubdg')) Equal to True





Then - Actions






Set VariableSet Root_Counter = (Root_Counter - 1)






-------- --------






Unit Group - Remove Root_Unit from Root_Group.






-------- --------






-------- This Condition may not be necessary: --------






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







If - Conditions








(Root_Unit is alive) Equal to True







Then - Actions








-------- ROOTED: --------








Game - Display to (All players) for 1.00 seconds the text: Rooted







Else - Actions






-------- --------






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







If - Conditions








Root_Counter Equal to 0







Then - Actions








Trigger - Turn off (This trigger)







Else - Actions





Else - Actions
You're mistaken, it works fine. A Unit can only ever be in Root_Group if it has the 'root' order. This will always be the case when it's trying to Root somewhere. The moment you change it's Orders to something else it is removed from Root_Group via the Root Orders trigger. A Unit that isn't inside of Root_Group cannot display the 'Rooted' message, that's simply not possible.That should work now, but I'm not sure if you understood my point, unless I'm completely mistaken, but I don't think I was.
If the unit was in root group and didn't have the root order it would be removed, and then so long as it was alive it would display the 'Rooted' message.
But it's water under the bridge because that building check would cover it.
Your updated trigger does work 100%, the original one doesn't.You're mistaken, it works 100% fine. A Unit can only ever be in Root_Group IF it has the Root order which will always be the case when it's trying to Root somewhere. The moment you change it's Orders it is removed from Root_Group via the Root Orders trigger. A Unit that isn't inside of Root_Group CANNOT display the 'Rooted' message, that's simply not possible since it need to be in the group to do so. Root Orders always happens before Root Loop which is the important thing to understand.
A Unit enters Root_Group when it is issued the order to Root, not when it Unroots. We're tracking whether or not it's still trying to Root.Your updated trigger does work 100%, the original one doesn't.
A unit enters root group when it unroots. When the order ceases to be root, which may well be because they were given a move or attack order, they were removed from the group.
But if the order was given to attack, or move or something else, they would have been removed and yet not rooted.
Here's what was done:
All root ordered units added to root group.
Every second pick root group unit.
If picked unit no longer has root order, for example if it was cancelled as well as if it was actually rooted, then it would check if it was alive and then if it was alive it would give the message "Rooted".
It's still up there in your post if you want to look.
If (All Conditions are True) then do (Then Actions) else do (Else Actions)If - Conditions
Root_Order Equal to (Order(unroot))
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Root_Order Equal to (Order(root))
Else - Actions
-------- It issued a different order so it's no longer trying to Root. --------
Unit Group - Remove Root_Unit from Root_Group.
No worries, I just had to defend my trigger's honorI removed everything but the part I wasn't noticing. Sorry about that and sorry I've made an ass of myself.
Anyway, good work, for what it's worth coming for me after all that...
