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

Question about leaks.

Status
Not open for further replies.
Level 12
Joined
Dec 2, 2016
Messages
733
In the game I'm working on the human players which can be 10 players. Each can train about 80 units or so, and they all have a detonate ability. When they use that ability it kills the unit, does the game automatically remove the leak if it's not done via trigger. Or will I have to add these units to a unit group and delete it via a trigger?

If that's the case, is the best way of doing this using an array of 10 indexes. And adding the dead units to the specific index unit group and then removing the unit group everytime the detonate spell is casted?

^ I can word that better if it doesn't make sense.
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
In general as units are also objects in the game, they should be removed once they are no longer needed.
Fortunately the game automatically removes units after they decayed.
So in this case you don't need to do anything.

This has nothing to with untis groups. Creating a unit group and removing it will not affect the units inside the group. You would have to use the "Unit - Remove unit" action for every unit in the unit group. But as said above, untis are automatically removed by the game after they decayed.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
When they use that ability it kills the unit, does the game automatically remove the leak if it's not done via trigger. Or will I have to add these units to a unit group and delete it via a trigger?
The game will automatically free most of the resources used by units that are removed, but not all. There is no way to remove a unit in a leak free way. That said the leak is so trivial even creating and removing 20,000 units will not do much.

Some people even argue the leak does not exist, with Warcraft III eventually freeing up the memory used by those units.
 
Status
Not open for further replies.
Top