• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

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