• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Help with periodic trigger / hashtables

Status
Not open for further replies.
Level 2
Joined
Feb 24, 2010
Messages
8
Well, I made this trigger is for an aura that deals damage to nearby enemies based on how long they are under the effect of the buff, increasing the damage every second and reseting the counter if they get out of the aura range. ie at level 1 enemies would take 20 damage in the 1º second, 40 damage at the 2º second, 60 damage at the 3º second...

Anyway, the problem is that the trigger is not working. Can you guys help me finding the problem? heres the trigger:

  • Contamination
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Set Skill_Group1 = (Units in (Playable map area) matching ((Level of Contamination for (Matching unit)) Greater than 0))
      • Unit Group - Pick every unit in Skill_Group1 and do (Actions)
        • Loop - Actions
          • Set Skill_Caster = (Picked unit)
          • Set Skill_Integer = (Level of Contamination for (Picked unit))
          • Set Skill_Real = (Real(Skill_Integer))
          • Set Skill_Group2 = (Units in (Playable map area))
          • Unit Group - Pick every unit in Skill_Group2 and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked unit) has buff Contamination ) Equal to True
                • Then - Actions
                  • Hashtable - Save ((Load 1 of (Key (Picked unit)) from Hash1) + 1.00) as 1 of (Key (Picked unit)) in Hash1
                  • Hashtable - Save (10.00 + (10.00 x Skill_Real)) as 2 of (Key (Picked unit)) in Hash1
                  • Set Skill_Damage = ((Load 1 of (Key (Picked unit)) from Hash1) x (Load 2 of (Key (Picked unit)) from Hash1))
                  • Unit - Cause Skill_Caster to damage (Picked unit), dealing Skill_Damage damage of attack type Spells and damage type Magic
                • Else - Actions
                  • Hashtable - Save 0 as 1 of (Key (Picked unit)) in Hash1
                  • Hashtable - Save 0 as 2 of (Key (Picked unit)) in Hash1
      • Custom script: call DestroyGroup(udg_Skill_Group1)
      • Custom script: call DestroyGroup(udg_Skill_Group2)
 
using pick every unit inside a pick every unit group can give undesired results. say there are 10 units in Skill_Group1 and 10 units in group2. the units in group 2 will be damaged 10 times and the units in group 1 will be damaged once.

hashtables are also not good for spells / auras as the are slower than arrays. you should index the units rather than using hashtables. raising the damage would be easier with arrays also

your units may not have this Set Skill_Integer = (Level of Contamination for (Picked unit))

you should have an initialization trigger ( a trigger that fires with unit in range since its an aura)
and a periodic trigger

if u dont know how to index there is a chapter in my tutorial that can help http://www.hiveworkshop.com/forums/tutorial-submission-283/things-gui-user-should-know-233242/
 
Status
Not open for further replies.
Top