Klein~
TH.net Regular
- Reaction score
- 0
Hello
I am working in the following trigger and I am having one problem when I assign values to indexed variables using "For each".
The goal of this was to identify what skills the unit has and store values to save them. Exemple:
If the skill is used on Dryad unit (Night Elf) which has Spell Immunity skill, the "For each" part should store:
ISpellsCounter[1] from Dryad = 1
ISpellsCounter[2] from Dryad = 0
ISpellsCounter[3] from Dryad = 0
ISpellsCounter[4] from Dryad = 0
ISpellsCounter[5] from Dryad = 0
ISpellsCounter[6] from Dryad = 0
ISpellsCounter[7] from Dryad = 0
But it is actually just storing zeros.
I made some tests and the first "game chat" command displays the right values (1, 0, 0, 0, 0, 0, 0), but the second "game chat" command displays 0 instead of 1 in the first slot.
If someone could help me identify this error, I would be grateful.
I am working in the following trigger and I am having one problem when I assign values to indexed variables using "For each".
Trigger:
- Events
- Unit - A unit Starts the effect of an ability
- Conditions
- (Ability being cast) Equal to Resistance Crusher
- Actions
- -------- Spells --------
- Set ImunitySpells[1] = Spell Immunity
- Set ImunitySpells[2] = Spell Immunity (Archimonde)
- Set ImunitySpells[3] = Spell Immunity (Dragon)
- Set ImunitySpells[4] = Spell Immunity (Neutral Hostile)
- Set ImunitySpells[5] = Resistant Skin
- Set ImunitySpells[6] = Resistant Skin (Neutral Hostile 1)
- Set ImunitySpells[7] = Resistant Skin (Neutral Hostile 2)
- -------- Buffs --------
- Unit - Remove Divine Shield buff from (Target unit of ability being cast)
- Unit - Remove Anti-magic Shell buff from (Target unit of ability being cast)
- Unit - Remove Anti-magic Shell (Extra) buff from (Target unit of ability being cast)
- Unit - Remove Avatar buff from (Target unit of ability being cast)
- -------- Triggers --------
- For each (Integer Counter) from 1 to 7, do (Actions)
- Loop - Actions
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- If - Conditions
- (Level of ImunitySpells[Counter] for (Target unit of ability being cast)) Equal to 1
- Then - Actions
- Hashtable - Save 1 as ISpellCounter[Counter] of (Key (Target unit of ability being cast)) in GlobalHashtable
- Unit - Remove ImunitySpells[Counter] from (Target unit of ability being cast)
- Else - Actions
- Hashtable - Save 0 as ISpellCounter[Counter] of (Key (Target unit of ability being cast)) in GlobalHashtable
- If - Conditions
- Game - Display to (All players) for 20.00 seconds the text: (String((Load ISpellCounter[Counter] of (Key (Target unit of ability being cast)) from GlobalHashtable)))
- If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Loop - Actions
- Hashtable - Save 0.00 as (Key mctime) of (Key (Target unit of ability being cast)) in GlobalHashtable
- Game - Display to (All players) for 20.00 seconds the text: (String((Load ISpellCounter[1] of (Key (Target unit of ability being cast)) from GlobalHashtable)))
- Unit Group - Add (Target unit of ability being cast) to MagicCurseGroup
The goal of this was to identify what skills the unit has and store values to save them. Exemple:
If the skill is used on Dryad unit (Night Elf) which has Spell Immunity skill, the "For each" part should store:
ISpellsCounter[1] from Dryad = 1
ISpellsCounter[2] from Dryad = 0
ISpellsCounter[3] from Dryad = 0
ISpellsCounter[4] from Dryad = 0
ISpellsCounter[5] from Dryad = 0
ISpellsCounter[6] from Dryad = 0
ISpellsCounter[7] from Dryad = 0
But it is actually just storing zeros.
I made some tests and the first "game chat" command displays the right values (1, 0, 0, 0, 0, 0, 0), but the second "game chat" command displays 0 instead of 1 in the first slot.
If someone could help me identify this error, I would be grateful.