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

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