- Joined
- Jan 16, 2017
- Messages
- 110
Hello i was trying to make a trigger to limit peasants per tree just to 1 (For balance purposes).
But i am stuck at one point and unable to figure out what should i do next.
The idea is that when peasant is ordered to gather lumber and checks if the tree has enough health, then the tree will have reduced health and if it doesn't have enough health then the peasant is stopped.
When the peasant finishes cutting the tree or is moved to a different one or just moved somewhere else then the tree restores it's health.
But it doesn't work properly (First time it works but if you click the tree multiple times then it resets and the Peasant joins gathering the lumber with the other peasant).
I would really appreciate if someone could solve this,
here's my trigger
But i am stuck at one point and unable to figure out what should i do next.
The idea is that when peasant is ordered to gather lumber and checks if the tree has enough health, then the tree will have reduced health and if it doesn't have enough health then the peasant is stopped.
When the peasant finishes cutting the tree or is moved to a different one or just moved somewhere else then the tree restores it's health.
But it doesn't work properly (First time it works but if you click the tree multiple times then it resets and the Peasant joins gathering the lumber with the other peasant).
I would really appreciate if someone could solve this,
here's my trigger
-
Init
-
Events
- Map initialization
- Conditions
-
Actions
-
Unit Group - Pick every unit in (Units of type Peasant) and do (Actions)
-
Loop - Actions
- Unit - Set the custom value of (Picked unit) to PeasantCount
- Set PeasantCount = (PeasantCount + 1)
-
Loop - Actions
-
Unit Group - Pick every unit in (Units of type Peasant) and do (Actions)
-
Events
-
Limit
-
Events
- Unit - A unit Is issued an order targeting an object
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Issued order) Equal to (Order(smart))
- (Issued order) Equal to (Order(harvest))
- (Issued order) Equal to (Order(resumeharvesting))
-
Conditions
- (Unit-type of (Triggering unit)) Equal to Peasant
-
Or - Any (Conditions) are true
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Issued order) Equal to (Order(smart))
- (Issued order) Equal to (Order(harvest))
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Current life of (Target destructible of issued order)) Greater than or equal to 100.00
-
Then - Actions
- Set Tree[(Custom value of (Triggering unit))] = (Target destructible of issued order)
- Destructible - Set life of (Target destructible of issued order) to 50.00
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Current life of (Target destructible of issued order)) Greater than or equal to 0.01
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Current life of Tree[(Custom value of (Triggering unit))]) Greater than or equal to 0.01
-
Then - Actions
- Destructible - Set life of Tree[(Custom value of (Triggering unit))] to 140.00
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Current life of (Target destructible of issued order)) Greater than or equal to 0.01
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Triggering unit) is selected by (Owner of (Triggering unit))) Equal to True
-
Then - Actions
- Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The old unit's relative life and mana
- Selection - Add (Last replaced unit) to selection for (Owner of (Last replaced unit))
-
Else - Actions
- Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The old unit's relative life and mana
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Current life of Tree[(Custom value of (Triggering unit))]) Greater than or equal to 0.01
-
Then - Actions
- Destructible - Set life of Tree[(Custom value of (Triggering unit))] to 140.00
- Else - Actions
-
If - Conditions
- Custom script: set udg_Tree[GetUnitUserData(GetTriggerUnit())] = null
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Issued order) Equal to (Order(resumeharvesting))
- (Current life of (Target destructible of issued order)) Less than or equal to 75.00
-
Then - Actions
- Custom script: set udg_Tree[GetUnitUserData(GetTriggerUnit())] = null
- Destructible - Set life of (Target destructible of issued order) to 140.00
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events