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

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 73
Joined
Aug 10, 2018
Messages
7,866
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