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

How to make tree respawn after a set time

Status
Not open for further replies.
Level 4
Joined
Jan 5, 2014
Messages
79
The title is selfexplenatory. If I kill some trees, how to make each tree respawn after a set amount of time?
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Pick all your trees, add a death event, on death event, start a timer, assign the tree to it, on expiration trash the timer and resurrect the assigned tree.

Alternatively, instead of timers, you can also use the more imprecise waits and the event response GetDyingDestructable is trigger-local.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
To assign something to a timer, you can for example take the timer's handle id with GetHandleId and use it as key in a hashtable.

To assign a timer to something (the other way around), it depends on the class of that something. Basically, you always need some memory space that you can dynamically address and split it up by a unique identification attribute of the base data.
 
Status
Not open for further replies.
Top