• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Ah... problem with hashtables... Part 2 :D (different trigger)

Status
Not open for further replies.
Level 14
Joined
Aug 8, 2010
Messages
1,022
Hi! I have tried to make my timer that shows above my hero how much time lefts till my spell is casted. I have worked on the trigger but nothing happens in game. I know - many people give me triggers and test maps, but i want to practice, so can make triggers my own. Here are my triggs :
  • DF Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set TheHashTable = (Last created hashtable)
  • VariableSetTrigDF
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Deep Freeze (trig test)
    • Actions
      • Hashtable - Save Handle Of(Triggering unit) as 0 of (Key (Triggering unit)) in TheHashTable
      • Unit Group - Add (Load 0 of (Key (Triggering unit)) in TheHashTable) to DFUnitGroup
      • Hashtable - Save Handle Of((Load 0 of (Key (Triggering unit)) in TheHashTable) offset by 110.00 towards 180.00 degrees) as 1 of (Key (Triggering unit)) in TheHashTable
      • Hashtable - Save 1.50 as 2 of (Key (Triggering unit)) in TheHashTable
      • Trigger - Run WhileCastingDF <gen> (checking conditions)
  • WhileCastingDF
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DFUnitGroup and do (Actions)
        • Loop - Actions
          • Hashtable - Save ((Load 2 of (Key (Picked unit)) from TheHashTable) - 0.10) as 3 of (Key (Picked unit)) in TheHashTable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 3 of (Key (Picked unit)) from TheHashTable) Greater than 0.00
            • Then - Actions
              • Floating Text - Create floating text that reads (Deep Freeze in + ((Load 3 of (Key (Picked unit)) from TheHashTable) + sec.)) at (Load 1 of (Key (Picked unit)) in TheHashTable) with Z offset 240.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Hashtable - Save Handle Of(Last created floating text) as 4 of (Key (Picked unit)) in TheHashTable
              • Floating Text - Change text of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to (Load 3 of (Key (Picked unit)) from TheHashTable) using font size 9.00
              • Floating Text - Change (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.): Disable permanence
              • Floating Text - Change the lifespan of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to 0.25 seconds
              • Floating Text - Change the age of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to 0.12 seconds
            • Else - Actions
:( please help! +rep for help !!!
 
Level 8
Joined
Oct 31, 2010
Messages
238
I thought that we showed you an example of that timer?:)

Or.. Maybe you didn't understand them?

Back to main point.

  • VariableSetTrigDF
  • ...
  • Unit Group - Add (Load 0 of (Key (Triggering unit)) in TheHashTable) to DFUnitGroup
  • ...
You know.. You could just
  • Unit Group - Add (Triggering unit) to DFUnitGroup
  • Hashtable - Save Handle Of((Load 0 of (Key (Triggering unit)) in TheHashTable) offset by 110.00 towards 180.00 degrees) as 1 of (Key (Triggering unit)) in TheHashTable
I don't quite get this. Is that saving a location or what?
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
  • VariableSetTrigDF
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Deep Freeze (trig test)
    • Actions
      • Hashtable - Save Handle Of(Triggering unit) as 0 of (Key (Triggering unit)) in TheHashTable // useless line
      • Unit Group - Add (Load 0 of (Key (Triggering unit)) in TheHashTable) to DFUnitGroup // use trigerin unit, don't load 0.
      • Hashtable - Save Handle Of((Load 0 of (Key (Triggering unit)) in TheHashTable) offset by 110.00 towards 180.00 degrees) as 1 of (Key (Triggering unit)) in TheHashTable // Position of unit is one point, offset is another. Causes a leak
      • Hashtable - Save 1.50 as 2 of (Key (Triggering unit)) in TheHashTable
      • Trigger - Run WhileCastingDF <gen> (checking conditions) // Don't run the trigger, turn it on.
  • WhileCastingDF // Should be initially off
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DFUnitGroup and do (Actions)
        • Loop - Actions
          • Hashtable - Save ((Load 2 of (Key (Picked unit)) from TheHashTable) - 0.10) as 3 of (Key (Picked unit)) in TheHashTable // save it as 2.
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 3 of (Key (Picked unit)) from TheHashTable) Greater than 0.00 // Load 2.
            • Then - Actions
              • Floating Text - Create floating text that reads (Deep Freeze in + ((Load 3 of (Key (Picked unit)) from TheHashTable) + sec.)) at (Load 1 of (Key (Picked unit)) in TheHashTable) with Z offset 240.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency // Create this in the cast trigger
              • Hashtable - Save Handle Of(Last created floating text) as 4 of (Key (Picked unit)) in TheHashTable // Save in cast trigger, not here
              • Floating Text - Change text of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to (Load 3 of (Key (Picked unit)) from TheHashTable) using font size 9.00 // Load 2 not 3.
              • Floating Text - Change (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.): Disable permanence // Do this in cast trigger
              • Floating Text - Change the lifespan of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to 0.25 seconds // Not needed
              • Floating Text - Change the age of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to 0.12 seconds // Not needed
            • Else - Actions
              • Destroy floating text
              • Remove location
              • Remove unit from group
              • Clear child hashtables
              • Turn trigger off if no units in group
 
Level 15
Joined
Oct 16, 2010
Messages
941
In the first trigger why are you saving the triggering unit TO the key of the triggering unit? If you have the key of that unit that means you already have access to that unit so there's no reason to save it.

Also why not just add triggering unit to the group instead of loading it from the hashtable?

If you "run" a trigger you'r only running it through once. Just make sure WhileCastingDF is initially on and that's all you need to do; delete the "run WhileCastingDF" action entirely. (initially have it on, if you do it maker's way it won't be MUI)

I would make WhileCastingDF every .05 seconds not every .10 b/c people can probably see it stopping between intervals at .10

  • Hashtable - Save ((Load 2 of (Key (Picked unit)) from TheHashTable) - 0.10) as 3 of (Key (Picked unit)) in TheHashTable
If you load from 2 and save to 3 then you'r never changing 2. So it will be (1.5 - .1 = 1.4) every time you run it and it will never end, it's actually an infinite loop but it's timed so you'r not getting an error.

Just use "last created floating text" for the additional floating text function, it takes less time for the system to reference that then it does the hashtable.
 
Level 14
Joined
Aug 8, 2010
Messages
1,022
Kay! I do what you say, Maker, but it blinks fast just one time and then fades. Triggs :
  • VariableSetTrigDF
    • Events
      • Unit - A unit Begins channeling an ability
    • Conditions
      • (Ability being cast) Equal to Deep Freeze (trig test)
    • Actions
      • Unit Group - Add (Triggering unit) to DFUnitGroup
      • Set TempPoint = ((Position of (Triggering unit)) offset by 110.00 towards 180.00 degrees)
      • Hashtable - Save Handle Of((Load 0 of (Key (Triggering unit)) in TheHashTable) offset by 110.00 towards 180.00 degrees) as 1 of (Key (Triggering unit)) in TheHashTable
      • Hashtable - Save 1.50 as 2 of (Key (Triggering unit)) in TheHashTable
      • Floating Text - Create floating text that reads (Deep Freeze in + ((Load 2 of (Key (Triggering unit)) from TheHashTable) + sec.)) at TempPoint with Z offset 240.00, using font size 9.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Hashtable - Save Handle Of(Last created floating text) as 4 of (Key (Triggering unit)) in TheHashTable
      • Floating Text - Change (Load 4 of (Key (Triggering unit)) in TheHashTableIf the label is not found, this function returns NULL.): Disable permanence
      • Trigger - Turn on WhileCastingDF <gen>
  • WhileCastingDF
    • Events
      • Time - Every 0.10 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in DFUnitGroup and do (Actions)
        • Loop - Actions
          • Hashtable - Save ((Load 2 of (Key (Picked unit)) from TheHashTable) - 0.10) as 2 of (Key (Picked unit)) in TheHashTable
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load 2 of (Key (Picked unit)) from TheHashTable) Greater than 0.00
            • Then - Actions
              • Floating Text - Change text of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to (Load 2 of (Key (Picked unit)) from TheHashTable) using font size 9.00
              • Floating Text - Change (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.): Disable permanence
              • Floating Text - Change the lifespan of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to 0.25 seconds
              • Floating Text - Change the age of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to 0.12 seconds
            • Else - Actions
???
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
I do what you say, Maker
You forgot something.

This in cast trigger:
  • Floating Text - Change (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.): Disable permanence
Remove these.
  • Floating Text - Change the lifespan of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to 0.25 seconds
  • Floating Text - Change the age of (Load 4 of (Key (Picked unit)) in TheHashTableIf the label is not found, this function returns NULL.) to 0.12 seconds
And you still have leaks.
http://www.hiveworkshop.com/forums/triggers-scripts-269/things-leak-35124/
 
Status
Not open for further replies.
Top