Hello, I am currently making my first map which is a tower defense. The concept of one of my available races is to play a hero and build towers to improve him.
Among the available towers, there is a tower that gives the Chain Lightning spell to my hero and then it is possible to upgrade this tower to increase the level of the spell.
So there are 3 towers; Book of Knowledge which can be upgraded to Chain of Lightning - Level 1 which can be upgraded to Chain of Lightning - Level 2.
Here is how the tower works (I have no issue with this trigger at the moment, I just thought it might be useful to share):
Where I get into trouble is when I try to do the sales trigger.
This is what my trigger looks like:
So this trigger allows me that when I sell my tower (whether level 1 or 2), if I already had an identical tower or a tower of a lower level, the spell will either be removed from the hero or downgraded to level 1. It's when I try to sell more than one level 1 tower at the same time that the skill doesn't get removed from the hero.
I don't know if I'm clear enough in what I'm trying to do, tell me if you don't understand.
If you have a better way to do it or a solution, I'm all ears.
Thanks in advance for those who will take the time to help me.
Among the available towers, there is a tower that gives the Chain Lightning spell to my hero and then it is possible to upgrade this tower to increase the level of the spell.
So there are 3 towers; Book of Knowledge which can be upgraded to Chain of Lightning - Level 1 which can be upgraded to Chain of Lightning - Level 2.
Here is how the tower works (I have no issue with this trigger at the moment, I just thought it might be useful to share):
-
Upgrades
-
Events
- Unit - A unit Finishes an upgrade
- Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Triggering unit)) Equal to Thunder Clap - Level 1
-
Then - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Battle Golem) and do (Actions)
-
Loop - Actions
- Unit - Add Thunder Clap to (Picked unit)
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Battle Golem) and do (Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Triggering unit)) Equal to Thunder Clap - Level 2
-
Then - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Battle Golem) and do (Actions)
-
Loop - Actions
- Unit - Set level of Thunder Clap for (Picked unit) to 2
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Battle Golem) and do (Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Triggering unit)) Equal to Chain Lightning - Level 1
-
Then - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Battle Golem) and do (Actions)
-
Loop - Actions
- Unit - Add Chain Lightning to (Picked unit)
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Battle Golem) and do (Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Triggering unit)) Equal to Chain Lightning - Level 2
-
Then - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Battle Golem) and do (Actions)
-
Loop - Actions
- Unit - Set level of Chain Lightning for (Picked unit) to 2
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Triggering unit)) of type Battle Golem) and do (Actions)
-
Else - Actions
- Do nothing
-
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)
-
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)
-
Events
Where I get into trouble is when I try to do the sales trigger.
This is what my trigger looks like:
-
Selling towers
-
Events
- Unit - A unit Begins casting an ability
-
Conditions
- (Ability being cast) Equal to Sell
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Unit-type of (Casting unit)) Equal to Chain Lightning - Level 1
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Number of living Chain Lightning - Level 1 units owned by (Owner of (Casting unit))) Less than or equal to 1) and ((Number of living Chain Lightning - Level 2 units owned by (Owner of (Casting unit))) Less than or equal to 0)
-
Then - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Casting unit)) of type Battle Golem) and do (Actions)
-
Loop - Actions
- Unit - Remove Chain Lightning from (Picked unit)
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Casting unit)) of type Battle Golem) and do (Actions)
-
Else - Actions
- Do nothing
-
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
- (Unit-type of (Casting unit)) Equal to Chain Lightning - Level 2
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Number of units in (Units owned by (Owner of (Casting unit)) of type Chain Lightning - Level 1)) Less than or equal to 0) and ((Number of units in (Units owned by (Owner of (Casting unit)) of type Chain Lightning - Level 2)) Less than or equal to 0)
-
Then - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Casting unit)) of type Battle Golem) and do (Actions)
-
Loop - Actions
- Unit - Remove Chain Lightning from (Picked unit)
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Casting unit)) of type Battle Golem) and do (Actions)
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of units in (Units owned by (Owner of (Casting unit)) of type Chain Lightning - Level 1)) Greater than or equal to 1
-
Then - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Casting unit)) of type Battle Golem) and do (Actions)
-
Loop - Actions
- Unit - Set level of Chain Lightning for (Picked unit) to 1
-
Loop - Actions
-
Unit Group - Pick every unit in (Units owned by (Owner of (Casting unit)) of type Battle Golem) and do (Actions)
-
Else - Actions
- Do nothing
-
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
- Do nothing
-
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)
-
Events
So this trigger allows me that when I sell my tower (whether level 1 or 2), if I already had an identical tower or a tower of a lower level, the spell will either be removed from the hero or downgraded to level 1. It's when I try to sell more than one level 1 tower at the same time that the skill doesn't get removed from the hero.
I don't know if I'm clear enough in what I'm trying to do, tell me if you don't understand.
If you have a better way to do it or a solution, I'm all ears.
Thanks in advance for those who will take the time to help me.