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

I need help with these timers with hashable

Status
Not open for further replies.
Level 6
Joined
Jul 26, 2010
Messages
167
This works like this: if I type "create" it spawn a unit group of footman in a spot, after 5 secons they die. The problem is that the spawned units are added to the same unit group, and as result all the units die at the same time. Even worst, if I create them too fast they die but the next created units wont :/. How I remove the leaks and create different timers with different groups?. I would really apreciate the help.

  • hash ini
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hash board - Create a hashtable
      • Set hashable = (Last created hashtable)
  • typed go
    • Events
      • Player - Jugador 1 (rojo) types a chat message containing create as Una correspondencia exacta
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 5, do (Actions)
        • Do: Actions
          • Unit - Create 1 Soldado raso for Jugador 1 (rojo) at (Random point in Región 000 <gen>) facing Vista edificio predeterminada degrees
          • Unit group - Add (Last created unit) to victims
      • Custom script: set udg_Timer = CreateTimer()
      • Custom script: set udg_Id = GetHandleId(udg_Timer)
      • Time - Start Timer as a Un tiro timer that will expire in 5.00 seconds
      • Trigger - Add to timer expired <gen> the event (Tiempo - Timer expires)
      • Hash board - Save Handle Ofvictims as 0 of Id in hashable
  • timer expired
    • Events
    • Conditions
    • Actions
      • Set Timer = (Expiring timer)
      • Unit group - Pick every unit in victims and do (Actions)
        • Do: Acciones
          • Unit - Remove (Picked unit) from the game
      • Set victims = (Load 0 of Id in hashable)
      • Custom script: set udg_Id = GetHandleId(udg_Timer)
      • Custom script: call DestroyTimer(udg_Timer)
      • Hash board - Clear all child hashtables of child Id in hashable
My wc3 is in spanish, I tried to translate what i could from the code.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
A much simpler solution would be to give the units an expiration timer upon creation, that way you wont need normal timers, groups and hashtables at all.

There is an action "Unit - Add expiration timer", it will simply kill the unit after a specified duration. And it is fully multi instanceable.
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
If you dont like customscripts you can try this:
http://warcraft.ingame.de/forum/showthread.php?t=211449
Its in german, but google translate is your friend:
http://translate.google.de/translate?hl=de&sl=de&tl=en&u=http%3A%2F%2Fwarcraft.ingame.de%2Fforum%2Fshowthread.php%3Ft%3D211449

Its a small script to access Jass timers in GUI. Allows you to create timers, attach data to it, run actions when the timer expires and its fast, full mui and you only have to copy few premade customscriptlines (data is passed via gui variables).
I have no idea if there is a similar script somewhere here on the hive...

Your triggers:

// no need for initialization trigger, you dont need your own hashtable anymore

  • typed go
    • Events
      • Player - Player 1 (red) types a chat message containing create as Una correspondencia exacta
    • Conditions
    • Actions
      • Custom script: set udg_victims = CreateGroup()
      • Set AAT_Counter = 1
      • Set AAT_Timeout = 5.0
      • Set AAT_Trigger = timer expired <gen>
      • Custom script: call AAT_prepareTimer()
      • Set AAT_store_group = (victims)
      • Custom script: call AAT_pushGroup()
      • For each (Integer A) from 1 to 5, do (Actions)
        • Do: Actions
          • Unit - Create 1 Soldado raso for Jugador 1 (rojo) at (Random point in Región 000 <gen>) facing Vista edificio predeterminada degrees
          • Unit group - Add (Last created unit) to victims
      • Custom script: call AAT_startTimer()
  • timer expired
    • Events
    • Conditions
    • Actions
      • Custom script: call AAT_popGroup()
      • Unit group - Pick every unit in AAT_store_real and do (Actions)
        • Do: Acciones
          • Unit - Remove (Picked unit) from the game
      • Custom script: call AAT_deleteTimer()
Ask if you have questions
 
Level 14
Joined
Jun 27, 2008
Messages
1,325
meeeep

Contains an example spell which teleports the user to the position where he used the spell after 8.5, 17 and 25.5 seconds (3 teleports, 8.5 seconds away from each other).
 

Attachments

  • AAT_1.4.w3x
    19.4 KB · Views: 46
Status
Not open for further replies.
Top