- Joined
- Jan 23, 2020
- Messages
- 86
I have a building that I need to upgrade every time a specific unit is killed. I got it to work, but it's not 100%.
Here is the trigger:
Here is an example of it not working for player RED:
As you can see the Farm Level exceeds the Farm_unit level, causing it to essentially get "stuck"
Here is the trigger:
Code:
Events
Unit - A unit Dies
Conditions
(Level of Encounter Classification for (Triggering unit)) Equal to 1
Actions
Set VariableSet PN = (Player number of (Owner of (Killing unit)))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Farm_Level[PN] Less than Farm_Total
Then - Actions
-------- --------
Set VariableSet Farm_Level[PN] = (Farm_Level[PN] + 1)
-------- --------
Unit - Order Farm_Unit[PN] to train/upgrade to a Farm_Types[Farm_Level[PN]]
Game - Display to (All players) the text: ((Name of (Player(PN))) + ( + ( + ((Name of Farm_Unit[PN]) + ( | Farm Level: + (String(Farm_Level[PN])))))))
Else - Actions
Here is an example of it not working for player RED:
As you can see the Farm Level exceeds the Farm_unit level, causing it to essentially get "stuck"