• 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.
  • Vote for the theme of Hive's HD Modeling Contest #7! Click here to vote! - Please only vote if you plan on participating❗️

[Trigger] Making Spawn / Death Leakless

Status
Not open for further replies.
Level 14
Joined
Mar 27, 2008
Messages
1,003
  • Spawn Main Units
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Create 1 Foot Soldier for Player 4 (Purple) at (Random point in Cragdallen Military Spawn <gen>) facing Default building facing degrees
      • Unit - Create 1 Orc Runner for Player 10 (Light Blue) at (Random point in Serdafen Military Spawn <gen>) facing Default building facing degrees
      • Unit - Create 1 Flesh Demon for Player 11 (Dark Green) at (Random point in Demon Spawn Main Entrance <gen>) facing Default building facing degrees
      • Unit - Create 1 Flesh Demon for Player 11 (Dark Green) at (Random point in Demon Spawn Small Entrance <gen>) facing Default building facing degrees
There's several other triggers involved with movement, but every 10 seconds of game time each side automatically spawns these to run towards a battlegrounds point on the map. How would I make this leakless (especially upon death, because a LOT of units die and not just these)
 
Level 14
Joined
Mar 27, 2008
Messages
1,003
It's simple using custom scripts (I think you already know this). Or maybe you want an automatic leak fixing code?

PointVariable = Random point in region 1
...use of the variable
call RemoveLocation(udg_PointVariable)
PointVariable = random point in region 2
...use of the variable
call RemoveLocation(udg_PointVariable)

And so on..

I was more referring to the custom scripts, how could I go about implementing them properly. In their own trigger or what?
 
Level 16
Joined
Mar 25, 2016
Messages
1,327
As DaneTheBeast said:
  • UnitCreation
    • Events
      • Time - Every 10.00 seconds of game time
    • Conditions
    • Actions
      • Set Point = (Random point in Cragdallen Military Spawn <gen>)
      • Unit - Create 1 Foot Soldier for Player 4 (Purple) at Point facing Default building facing degrees
      • Custom script: call RemoveLocation(udg_Point)
      • -------- ... --------
Only the points are leaking in this trigger.

If you are worrying about leaks when units die, units do not leak.
A unit that dies will be automatically removed by the game once it decayed.
However if you have a lot of units in your map, it can be helpful to remove units as soon as they die, instead of waiting for them to decay. The corpses can cost a lot of performance if many of them are there at the same time.
 
Status
Not open for further replies.
Top