• 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.

Need Help w/ Hashtables

Status
Not open for further replies.

sentrywiz

S

sentrywiz

Hi guys

I'm trying (been trying) to make a damage over time spell with hashtables.
And I'm stuck.

1st - I cannot configure like I said, a dot spell that will damage a unit 5 times. I have the whole trigger made like:

a) When casting the ability, configures the damage and saves it in a hashtable. It also calculates the time needed, in my case its an real variable set to 5. After that the target of ability being cast is added to DamageOverTime unit group

b) A periodic trigger that runs every 1 second is supposed to damage every unit in the unit group above mentioned. This is where I have problems


problem1) The casting unit cannot damage the target. Because its in a periodic trigger, I cannot use casting unit cuz which casting unit? I tried to save the casting unit in a unit variable under casting unit, but that didn't work when I tried to "Damage Target - ? Unit damages Picked Unit dealing X damage,"

problem2) I don't know how to use key handles. I tried to save in hashtable anything with 0 and key(casting unit) since it said in wyrmlord's tutorial that each unit has an ID handle. However it doesn't work for me. Or better yet, I don't work with it :D ..


Need help!
Thanks
 

sentrywiz

S

sentrywiz

Also, if you have ease with hashtables and has time - make a simple trigger to show me how pros do it :D

Anyway, an answer or a trigger would be great
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You need a basic advance of triggering in GUI before going on to Hashtables
Basically, hashtable usage is you save the data, and load them later, appropriately for each unique unit, basically, this will make the trigger MUI
Basic Learning:
Hashtable Spellpack - You can learn many things in this spellpack, it uses hashtable and it is approved resource :D
Hashtable Tutorials- I learned hashtable from here, you should be able to understand the explanation very well, just follow step-by-step and you got it !
 
Level 20
Joined
Jul 6, 2009
Messages
1,885
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Hashtable - Save 5.00 as 0 of (Key (Target unit of ability being cast)) in Hash
      • Hashtable - Save Handle Of(Triggering unit) as 1 of (Key (Target unit of ability being cast)) in Hash
      • Hashtable - Save 15.00 as 2 of (Key (Target unit of ability being cast)) in Hash
  • Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DOTGroup and do (Actions)
        • Loop - Actions
          • Unit - Cause (Load 1 of (Key (Picked unit)) in Hash) to damage (Picked unit), dealing (Load 2 of (Key (Picked unit)) from Hash) damage of attack type Spells and damage type Normal
          • Hashtable - Save ((Load 0 of (Key (Picked unit)) from Hash) - 0.50) as 0 of (Key (Picked unit)) in Hash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Load 0 of (Key (Picked unit)) from Hash) Equal to 0.00
                  • ((Picked unit) is dead) Equal to True
            • Then - Actions
              • Unit Group - Remove (Picked unit) from DOTGroup
            • Else - Actions
These would be triggers for a simple DOT spell.
 
Last edited:
Level 33
Joined
Mar 27, 2008
Messages
8,035
  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hash = (Last created hashtable)
  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Your Ability
    • Actions
      • Hashtable - Save 5.00 as 0 of (Key (Target unit of ability being cast)) in Hash
      • Hashtable - Save Handle Of(Triggering unit) as 1 of (Key (Target unit of ability being cast)) in Hash
      • Hashtable - Save 15.00 as 2 of (Key (Target unit of ability being cast)) in Hash
  • Loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DOTGroup and do (Actions)
        • Loop - Actions
          • Unit - Cause (Load 1 of (Key (Picked unit)) in Hash) to damage (Picked unit), dealing (Load 2 of (Key (Picked unit)) from Hash) damage of attack type Spells and damage type Normal
          • Hashtable - Save ((Load 0 of (Key (Picked unit)) from Hash) - 0.50) as 0 of (Key (Picked unit)) in Hash
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Load 0 of (Key (Picked unit)) from Hash) Equal to 0.00
                  • ((Picked unit) is dead) Equal to True
            • Then - Actions
              • Unit Group - Remove (Picked unit) from DOTGroup
            • Else - Actions
These would be triggers for a simple DOT spell.

Do you forgot to:
  • Unit Group - Add (Target unit of ability being cast) to DOTGroup
 

sentrywiz

S

sentrywiz

Thanks guys.

I also noticed, you don't clear child hashtables. Is it a good thing to clear or doesn't matter?

+rep both.
 

sentrywiz

S

sentrywiz

Thanks for the explanation guys, the trigger works like a charm. However, floating text doesn't like hashtables. I can't make it so floating text takes the value from the hashtable and uses it to display the amount of damage dealt.

  • Floating Text - Create floating text that reads (Load 2 of (Key (Picked unit)) from Hashy) above (Picked unit) with Z offset 0.00, using font size 9.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Wheres the error in this?
 

sentrywiz

S

sentrywiz

I thank you for that, +rep

Well, I need to give rep before you get more rep from me, but for now thanks!
 
Status
Not open for further replies.
Top