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

Destroy a countdown timer through string comparison?

Status
Not open for further replies.
Level 3
Joined
Jun 15, 2021
Messages
30
Hello.
My map has a respawn system since it's a hero defence project. So, shaman heroes can resurrect themselves "on demand" sometimes. Because of that, I'm wondering how it'd be possible to destroy a countdown respawn timer by string comparison since when A Hero Dies it creates one with Dying Hero's name as string.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,517
Does each player control a single hero? If so, the countdown timers/windows should use an Array with the Player's Number as the index.

So if Player 1 revives their shaman hero on demand, you destroy RespawnTimer[1] and RespawnWindow[1].

If Player 2 does the same you'd destroy RespawnTimer[2] and RespawnWindow[2].

If you have multiple heroes per player that use timers then you can use a Hashtable to keep track of them.
So when you create the timer you save it in the Hashtable using the shaman as the key.
Then when a shaman revives itself you Load the timer from the hashtable using the shaman as the key and destroy it.

Something like this for saving the timer to the hashtable:
  • Custom script: set udg_YourTimer = CreateTimer()
  • Hashtable - Save Handle of YourTimer as (Key YourShaman) of ShamanPlayerNumber in TimerHashtable
 
Last edited:
Status
Not open for further replies.
Top