INI Trigger
In the initial trigger I want to increase stacks of might for a unit, giving it 4 strength for 15 seconds. The max stacks for each level of might is 5.
Might Level 1: Max stacks 5
Might Level 2: Max stacks 10
And so on
In the loop trigger it reduces the stacks of the unit after 15 seconds have passed and subtracts it's strength by 4.
The current issue is that all units getting attacked share the same stacks. I had two units on the map, and the total count of bonus strength for the units were 20 in total.
Unit 1: Base strength 55 + 8 (This unit used 2 stacks of might)
Unit 2 Base Strength 55 + 12 (This unit used 3 stacks of might)
So the units shared the stacks making stack count 5/5 for both units.
Instead of having individual count.
I added the unit group check, because without it one unit were running on multiple stacks at the same time meaning it gained 4 strength for every stack, unlimited times.
This is my first hashtable trigger I made. I have used dynamic unit indexing for the loop triggers in the past, but someone told me to run things like this with hashtables so here I am trying.
I think i'm pretty close to making this work and if someone can help me make this work, I can make stack abilities with hashtables in the future and other hashtable things with loops.
LOOP Trigger
-
Might
-
Events
-
Game - PDD_damageEventTrigger becomes Equal to 1.00
-
-
Conditions
-
(Level of Might for PDD_target) Greater than 0
-
(PDD_target belongs to an enemy of (Owner of PDD_source).) Equal to True
-
(Random integer number between 1 and 100) Less than or equal to 33
-
-
Actions
-
Hashtable - Save Handle Of(Triggering unit) as 3 of (Key (Triggering unit).) in MightHash.
-
Set VariableSet MightStacksMax = ((Level of Might for (Load 3 of (Key (Triggering unit).) in MightHash.)) x 5)
-
Hashtable - Save MightStacksMax as 2 of (Key (Triggering unit).) in MightHash.
-
Game - Display to (All players) the text: ((String(MightStacks)) + ( / + (String(MightStacksMax))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
((Load 3 of (Key (Triggering unit).) in MightHash.) is in MightUG.) Equal to False
-
-
Then - Actions
-
Unit Group - Add (Load 3 of (Key (Triggering unit).) in MightHash.) to MightUG
-
Game - Display to (All players) the text: Unit Added To Group
-
Hashtable - Save 15.00 as 1 of (Key (Triggering unit).) in MightHash.
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MightStacks Less than MightStacksMax
-
-
Then - Actions
-
Set VariableSet MightStacks = (MightStacks + 1)
-
Hashtable - Save MightStacks as 0 of (Key (Triggering unit).) in MightHash.
-
Hero - Modify Strength of (Load 3 of (Key (Triggering unit).) in MightHash.): Add 4.
-
-
Else - Actions
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MightStacks Equal to 1
-
-
Then - Actions
-
Trigger - Turn on Might Check <gen>
-
-
Else - Actions
-
-
-
In the initial trigger I want to increase stacks of might for a unit, giving it 4 strength for 15 seconds. The max stacks for each level of might is 5.
Might Level 1: Max stacks 5
Might Level 2: Max stacks 10
And so on
In the loop trigger it reduces the stacks of the unit after 15 seconds have passed and subtracts it's strength by 4.
The current issue is that all units getting attacked share the same stacks. I had two units on the map, and the total count of bonus strength for the units were 20 in total.
Unit 1: Base strength 55 + 8 (This unit used 2 stacks of might)
Unit 2 Base Strength 55 + 12 (This unit used 3 stacks of might)
So the units shared the stacks making stack count 5/5 for both units.
Instead of having individual count.
I added the unit group check, because without it one unit were running on multiple stacks at the same time meaning it gained 4 strength for every stack, unlimited times.
This is my first hashtable trigger I made. I have used dynamic unit indexing for the loop triggers in the past, but someone told me to run things like this with hashtables so here I am trying.
I think i'm pretty close to making this work and if someone can help me make this work, I can make stack abilities with hashtables in the future and other hashtable things with loops.
LOOP Trigger
-
Might Check
-
Events
-
Time - Every 1.00 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in MightUG and do (Actions)
-
Loop - Actions
-
Set VariableSet MightTime = (Load 1 of (Key (Picked unit).) from MightHash.)
-
Set VariableSet MightTarget = (Load 3 of (Key (Picked unit).) in MightHash.)
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MightTime Greater than 0.00
-
-
Then - Actions
-
Hashtable - Save (MightTime - 1.00) as 1 of (Key (Picked unit).) in MightHash.
-
Game - Display to (All players) the text: (String(MightTime))
-
-
Else - Actions
-
Hero - Modify Strength of (Picked unit): Subtract 4.
-
Set VariableSet MightStacks = (MightStacks - 1)
-
Hashtable - Save MightStacks as 0 of (Key (Picked unit).) in MightHash.
-
Game - Display to (All players) the text: End of Timer --- Re...
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MightStacks Equal to 0
-
-
Then - Actions
-
Game - Display to (All players) the text: ---END OF LOOP---
-
Hashtable - Clear all child hashtables of child (Key (Picked unit).) in MightHash.
-
Unit Group - Remove (Picked unit) from MightUG.
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
-
-