• 🏆 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!

[Trigger] 1 More Issue with HashTables

Status
Not open for further replies.
Level 4
Joined
Apr 26, 2008
Messages
67
What I'm trying to do:

I'm trying to save the level of Ability being cast to a HashTable and load it. Here are my triggers.

Saves The Level:
  • Hashtable - Save (Real((Level of (Ability being cast) for (Triggering unit)))) as 1 of (Key (Casting unit)) in Natures_Bloom_Hashtable
Loads The Data:
  • Unit - Set level of Nature's Bloom Dummy Bloom for (Last created unit) to (Key (Load 1 of (Key (Casting unit)) in Natures_Bloom_Hashtable))

Problem:

It doesn't work.

+rep to anyone who can help me fix this.
 
Level 4
Joined
Apr 26, 2008
Messages
67
1) Ill try it

2) Yes

Also for some reason I don't see the option to save it as an Integer. I'm probably overlooking it.

Okay I saved the data as an Integer, and it still doesn't work. it says that the level of the spell is 0.

Here are my triggers.


  • HashTables
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
      • Hashtable - Create a hashtable
      • Set Natures_Bloom_Hashtable = (Last created hashtable)
  • Natures Bloom Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nature's Bloom
    • Actions
      • Hashtable - Save (Level of (Ability being cast) for (Casting unit)) as 0 of (Key (Casting unit)) in Natures_Bloom_Hashtable
      • Unit Group - Add (Target unit of ability being cast) to Natures_Bloom_Group
      • Hashtable - Save 0.00 as 0 of (Key (Picked unit)) in Natures_Bloom_Hashtable
      • Trigger - Turn on Natures Bloom Loop <gen>
  • Natures Bloom Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Natures_Bloom_Group and do (Actions)
        • Loop - Actions
          • Set Natures_Bloom_Wait = (Load 0 of (Key (Picked unit)) from Natures_Bloom_Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Natures_Bloom_Wait Less than 4.00
            • Then - Actions
              • Hashtable - Save (Natures_Bloom_Wait + 1.00) as 0 of (Key (Picked unit)) in Natures_Bloom_Hashtable
            • Else - Actions
              • Set Natures_Bloom_Level_Dummy = (Load 0 of (Key (Casting unit)) from Natures_Bloom_Hashtable)
              • Game - Display to (All players) the text: (Level Of Bloom = + (String(Natures_Bloom_Level_Dummy)))
              • Unit - Create 1 Nature's Bloom Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Facing of (Picked unit)) degrees
              • Unit - Add a 0.64 second Generic expiration timer to (Last created unit)
              • Unit - Set level of Nature's Bloom Dummy Bloom for (Last created unit) to Natures_Bloom_Level_Dummy
              • Unit - Order (Last created unit) to Human Priest - Heal (Picked unit)
              • Unit Group - Remove (Picked unit) from Natures_Bloom_Group
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Natures_Bloom_Hashtable
              • Hashtable - Clear all child hashtables of child (Key (Casting unit)) in Natures_Bloom_Hashtable
              • If ((Natures_Bloom_Group is empty) Equal to True) then do (Trigger - Turn off (This trigger)) else do (Do nothing)
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,240


  • Natures Bloom Start
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Nature's Bloom
    • Actions
      • Hashtable - Save (Level of (Ability being cast) for (Casting unit)) as 0 of (Key (Target unit of ability being cast)) in Natures_Bloom_Hashtable
      • Unit Group - Add (Target unit of ability being cast) to Natures_Bloom_Group
      • Hashtable - Save 0.00 as 1 of (Key (Target unit of ability being cast)) in Natures_Bloom_Hashtable
      • Trigger - Turn on Natures Bloom Loop <gen>
  • Natures Bloom Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in Natures_Bloom_Group and do (Actions)
        • Loop - Actions
          • Set Natures_Bloom_Wait = (Load 1 of (Key (Picked unit)) from Natures_Bloom_Hashtable)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Natures_Bloom_Wait Less than 4.00
            • Then - Actions
              • Hashtable - Save (Natures_Bloom_Wait + 1.00) as 1 of (Key (Picked unit)) in Natures_Bloom_Hashtable
            • Else - Actions
              • Set Natures_Bloom_Level_Dummy = (Load 0 of (Key (Picked unit)) from Natures_Bloom_Hashtable)
              • Game - Display to (All players) the text: (Level Of Bloom = + (String(Natures_Bloom_Level_Dummy)))
              • Unit - Create 1 Nature's Bloom Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing (Facing of (Picked unit)) degrees
              • Unit - Add a 0.64 second Generic expiration timer to (Last created unit)
              • Unit - Set level of Nature's Bloom Dummy Bloom for (Last created unit) to Natures_Bloom_Level_Dummy
              • Unit - Order (Last created unit) to Human Priest - Heal (Picked unit)
              • Unit Group - Remove (Picked unit) from Natures_Bloom_Group
              • Hashtable - Clear all child hashtables of child (Key (Picked unit)) in Natures_Bloom_Hashtable
              • If ((Natures_Bloom_Group is empty) Equal to True) then do (Trigger - Turn off (This trigger)) else do (Do nothing)


Also this leaks position:
  • Unit - Create 1 Nature's Bloom Dummy for (Owner of (Picked unit)) at (Position of (Picked unit)) facing...
 
Level 4
Joined
Apr 26, 2008
Messages
67
I know about the leak I was just making the trigger work first before I cleaned it up :p

And thanks again maker for the help, you know your stuff as always :D
 
Status
Not open for further replies.
Top