• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

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)
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
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