I'm creating a td where you can merge a tower when you have at least two of the same kind.
I have this trigger:
The trigger is working almost perfect, but: when i have more than 1 tower in my selection it doesnt work properly.
For example:
If i have 7 towers in my selection, the trigger replaces 4 of them instead of 3.
I tried to add a for each selected unit but its not working.
I have this trigger:
Trigger:
- UpgradeWhiteT1
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- Actions
- Set VariableSet TempGroup = (Units owned by (Triggering player) matching ((Unit-type of (Matching unit)) Equal to [Tier 1] White Tower).)
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Number of units in TempGroup) Greater than or equal to 2
- Then - Actions
- Unit Group - Remove (Triggering unit) from TempGroup.
- Unit - Remove (Random unit from TempGroup) from the game
- Unit - Replace (Triggering unit) with a [Tier 1] White Tower using The old unit's relative life and mana
- Else - Actions
- If - Conditions
- Custom script: call DestroyGroup(udg_TempGroup)
- Events
The trigger is working almost perfect, but: when i have more than 1 tower in my selection it doesnt work properly.
For example:
If i have 7 towers in my selection, the trigger replaces 4 of them instead of 3.
I tried to add a for each selected unit but its not working.