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

[Trigger] Hashtable Problem

Status
Not open for further replies.
Level 37
Joined
Mar 6, 2006
Messages
9,243
JNGP doesn't support GUI hashtables fully and that issues manifests itself in this fashion.

There is a way to enablethem but that solution has escaped my mind. Google or the search function can advice you more.

You can do this.
  • Set u2 = (Target unit of ability being cast)
  • Custom script: set udg_i1 = GetHandleId(udg_u2)
  • Hashtable - Save 0 as 1 of i1 in (Last created hashtable)
u2 = unit variable
i1 = integer variable
 
Level 15
Joined
Aug 14, 2007
Messages
936
  • Unit Spawns
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set Clear_Point = (Center of (Playable map area))
      • Unit - Create 1 Spell Breaker for Player 1 (Red) at Clear_Point facing Default building facing degrees
      • Set Globalcustomvalue = (Globalcustomvalue + 1)
      • Unit - Set the custom value of (Last created unit) to Globalcustomvalue
      • Custom script: call RemoveLocation(udg_Clear_Point)
Sorry this is for example only. The Globalcustomvalue is for tracking each unit that is spawned on the map, that means you have to assign a custom value for every unit that spawn, it is a requirement.




  • Spell Caster
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Thunder Clap
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TestGroup) Equal to 0
        • Then - Actions
          • Game - Display to (All players) the text: true
          • Hashtable - Create a hashtable
          • Set hashTest = (Last created hashtable)
        • Else - Actions
      • Set Clear_Point = (Position of (Triggering unit))
      • Set TestGroup = (Units within 400.00 of Clear_Point matching (((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True))
      • Unit Group - Pick every unit in TestGroup and do (Actions)
        • Loop - Actions
          • Set clearpoint2 = (Position of (Picked unit))
          • Hashtable - Save 300.00 as (Custom value of (Picked unit)) of 1 in hashTest
          • -------- This is the knockback distance --------
          • Hashtable - Save (Angle from Clear_Point to clearpoint2) as (Custom value of (Picked unit)) of 2 in hashTest
          • -------- This is the knockback angle --------
          • Hashtable - Save Handle Of(Picked unit) as (Custom value of (Picked unit)) of 3 in hashTest
          • -------- This is the knockback unit --------
          • Custom script: call RemoveLocation(udg_clearpoint2)
      • Custom script: call RemoveLocation(udg_Clear_Point)
      • Trigger - Turn on renderer <gen>
  • renderer
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in TestGroup) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
          • Hashtable - Clear hashTest
        • Else - Actions
          • Unit Group - Pick every unit in TestGroup and do (Actions)
            • Loop - Actions
              • Set Clear_Point = (Position of (Picked unit))
              • Set clearpoint2 = (Clear_Point offset by 15.00 towards (Load (Custom value of (Picked unit)) of 2 from hashTest) degrees)
              • Unit - Move (Picked unit) instantly to clearpoint2
              • Hashtable - Save ((Load (Custom value of (Picked unit)) of 1 from hashTest) - 15.00) as (Custom value of (Picked unit)) of 1 in hashTest
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Load (Custom value of (Picked unit)) of 1 from hashTest) Equal to 0.00
                • Then - Actions
                  • Unit Group - Remove (Picked unit) from TestGroup
                • Else - Actions
              • Custom script: call RemoveLocation(udg_clearpoint2)
              • Custom script: call RemoveLocation(udg_Clear_Point)
Some stuff may not be used like Unit that is stored in this kind of hashtable, its not necessary but it depends, in this case it's for demo only
 
So wat is an example of cacheing ? and sry destiny knight im not really sure how tht would work i get how its saving the units custom value and everything like tht but im using custom value of units for some of the other stuff in my map so i cant really use this i heard there was a custom script for adding the (key(target of ability being cast)) or whatever it is if anyone can give me those and a short example of what to type in tht would be great also thanks
 
Last edited:
Status
Not open for further replies.
Top