• 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] Need help with hashtabels!

Status
Not open for further replies.
Level 6
Joined
Dec 6, 2009
Messages
173
Hi! I uploaded a spell here on hive, but it did get rejected. Many complained becuse it wasn't MUI and that I had waits:/
Now I tried to make an easy trigger by my own for better knowing of Hashtabels. But I totaly failed. I don't know what I did wrong and I would like you guys that know how to make it work plz tell me^^
I alredy know that there is some tortorials and so but I don't get the whole thing, so thats why I tryied to do this.:grin:

The Trigger:
  • Trigger0
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 5.00 seconds
      • Hashtable - Save Handle Of(Last started timer) as 0 of 5 in (Last created hashtable)
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as 0 of 0 in (Last created hashtable)
      • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl
      • Hashtable - Save 0.00 as (Key (Last created special effect)) of 1 in (Last created hashtable)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for Timer) Less than or equal to 0.00
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Key (Last created special effect)) is stored as a Handle of 3 in (Last created hashtable)) Equal to True
            • Then - Actions
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Hashtable - Clear all child hashtables of child 0 in (Last created hashtable)
        • Else - Actions
So now say what I need to change^^ Thx!:thumbs_up:
 
Level 6
Joined
Dec 6, 2009
Messages
173
Well, it sure is better, but I don't see the point with it... Cause if you use it in an map you woun't have 0 sec cooldown. And well thx for fixing it^^ I don't see what makes the lagg but I see that custm script is something that is important. But well I don't know what to write in custom script x'D I don't get how people know how to write it like you did ''
  • Custom script: call SaveGroupHandle (udg_Hash, GetHandleId(GetLastCreatedUnit()), StringHash("group"), g)
''
How to know that a g should be in the end of it?:O That is what my problem is^^
 
You never know what the uploaded spell will be used for. For example, there might be a mode like DotA's "-wtf", which automatically resets abilities' cooldown; you need to have a perfect creation there, it has to be bug free, MUI, MPI, because the Spells' section is supposed to be a library of perfectly made spells, otherwise there is no reason of uploading them.

You need to have some basic Jass knowledge to realise what each script does. That specific line doesn't save the performance, it saves a local unit group, so that nearby units will be damaged only once, not periodically.

You can download "JassCraft", from the Resources -> Tools section in wc3c.net for learning some basic Jass natives (which can be implemented in the custom scripts). Finally, you can go to Edit -> Convert to Custom script to have a first impression of what conversion to Custom script means and how does it look like.
 
Level 6
Joined
Dec 6, 2009
Messages
173
Well, I tried to update my thingy here after what I saw in my trigger that you remade.
This is how it looks like now.(still not working)
  • Trigger0
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 5.00 seconds
      • Hashtable - Save 0.00 as (Key timer) of (Key (Last started timer)) in (Last created hashtable)
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Hashtable - Save Handle Of(Last created unit) as (Key Unit) of (Key (Last created unit)) in (Last created hashtable)
      • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl
      • Hashtable - Save 3.00 as (Key Ring) of (Key (Last created special effect)) in (Last created hashtable)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Remaining time for Timer) Less than 0.00
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Key Ring) is stored as a Handle of (Key (Last created special effect)) in (Last created hashtable)) Equal to True
            • Then - Actions
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Hashtable - Clear all child hashtables of child (Key (Last created unit)) in (Last created hashtable)
              • Hashtable - Clear all child hashtables of child (Key (Expiring timer)) in (Last created hashtable)
              • Hashtable - Clear all child hashtables of child (Key (Last created special effect)) in (Last created hashtable)
        • Else - Actions
Why not just make the easy way and do like this?

  • Trigger01
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing degrees
      • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl
      • Wait 5.00 seconds
      • Special Effect - Destroy (Last created special effect)
This works, takes alot shorter time do. I don't get the point;P
 
To be honest Jass tutorials around are not the best, but they are decent enough to get you started. Being lazy will definitely not help you :p

Just copy paste everything you see in the map I provided you with.

P.S. You use "remaining time in timer". This must be added in a trigger, which runs periodically, with an event of type "Time - Every 0.20 seconds of game-time" (example), you have it run once, in the Map Initialization, it has to be updated.
 
Just make a unit with this model: http://www.hiveworkshop.com/forums/.../76414d1267371058-game-preload-file-dummy.mdx
attach the special effect (preferably "origin") and add a 5.00 seconds expiration timer:
  • Tr
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Hashtable - Create a hashtable
    • Set Hash = (Last created hashtable)
    • Set Point1 = (Center of (Playable Map Area))
    • Unit - Create 1 Footman for Player 1 (Red) facing Default building degrees
    • Special Effect - Create a special effect attached to the overhead of (Last created unit) using Abilities\Spells\Other\GeneralAuraTarget\GeneralAuraTarget.mdl
    • Unit - Create 1 Dummy for Player 1 (Red) facing Default building degrees
    • Hashtable - Save Handle of (Last created special effect) as Key(sfx) of (Key(Last created unit)) in Hash
    • Unit - Add a 5.00 seconds Generic expiration timer to (Last created unit)
    • Custom script: call RemoveLocation (udg_Point1)
  • Trigger
  • Event
    • Unit - A unit dies
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Dummy
  • Actions
    • Special Effect - Destroy (Load Key(sfx) of (Key(Triggering unit)) in Hash)
    • Hashtable - Clear all child hashtables of (Key(Triggering unit)) in Hash
That's your best option. There are others as well, but this is the easiest.
 
Status
Not open for further replies.
Top