- Joined
- May 20, 2008
- Messages
- 138
This trigger is not finished but this shows the most basic essential mechanics that I'm not getting to work
What the trigger is supposed to do is creating a MUI stacking damage mechanic called Devastate. Each time a unit casts devastate on a target 250+x*40 damage is dealt to it, x being the amount of times Devastate has been cast on the target by the owner of the casting unit before, up to a maximum of 5 times, the current cast being included in "how many times ...", that is to say the Devastate effect is applied each time Devastate is cast on the target, up to a maximum of 5 "stacks" of the effect, using the number of stacks to multiply 40 with as bonus damage dealt to the target.
The idea is that each player can potentially have a hero using this ability, up to a maximum of 10 players, each hero can cast devastate on any enemy target, and if two players cast devastate on the SAME target, the effect stacks separately for each player, ie if player 1 has cast it 3 times on the target he gets 3*40 damage bonus, and if player 2 has cast it 5 times on the same target he gets 5*40 damage bonus.
I figured hashtables were the best way to do this (provided I have even grasped how hashtables really work), but I don't get it to work properly, it seems like only the final "else" is being executed any time the trigger is run, even when casting multiple times on the same target. I use a damage detection system separately, and it displays a weird stack of numbers that doesn't correspond to how it should look according to this trigger either.
What the trigger is supposed to do is creating a MUI stacking damage mechanic called Devastate. Each time a unit casts devastate on a target 250+x*40 damage is dealt to it, x being the amount of times Devastate has been cast on the target by the owner of the casting unit before, up to a maximum of 5 times, the current cast being included in "how many times ...", that is to say the Devastate effect is applied each time Devastate is cast on the target, up to a maximum of 5 "stacks" of the effect, using the number of stacks to multiply 40 with as bonus damage dealt to the target.
The idea is that each player can potentially have a hero using this ability, up to a maximum of 10 players, each hero can cast devastate on any enemy target, and if two players cast devastate on the SAME target, the effect stacks separately for each player, ie if player 1 has cast it 3 times on the target he gets 3*40 damage bonus, and if player 2 has cast it 5 times on the same target he gets 5*40 damage bonus.
I figured hashtables were the best way to do this (provided I have even grasped how hashtables really work), but I don't get it to work properly, it seems like only the final "else" is being executed any time the trigger is run, even when casting multiple times on the same target. I use a damage detection system separately, and it displays a weird stack of numbers that doesn't correspond to how it should look according to this trigger either.
-
Warrior Devastate
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to (Warrior) Devastate
-
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Load (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) from HWARRIOR_devastatestacks_table) Greater than 0
-
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Load (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) from HWARRIOR_devastatestacks_table) Less than 5
-
-
Then - Actions
-
Set GEN_INTEGER = (Load (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) from HWARRIOR_devastatestacks_table)
-
Set GEN_INTEGER = (GEN_INTEGER + 1)
-
Game - Display to (All players) the text: (String(GEN_INTEGER))
-
Hashtable - Save GEN_INTEGER as (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) in HWARRIOR_devastatestacks_table
-
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (250.00 + ((Real(GEN_INTEGER)) x 40.00)) damage of attack type Spells and damage type Unknown
-
Game - Display to (All players) the text: increase
-
-
Else - Actions
-
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (250.00 + (5.00 x 40.00)) damage of attack type Spells and damage type Unknown
-
Game - Display to (All players) the text: else maxstacks
-
-
-
-
Else - Actions
-
Hashtable - Save 1 as (Player number of (Owner of (Triggering unit))) of (Key (Target unit of ability being cast)) in HWARRIOR_devastatestacks_table
-
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing (250.00 + (1.00 x 40.00)) damage of attack type Spells and damage type Unknown
-
Game - Display to (All players) the text: else
-
-
-
-