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

[Trigger] help, does this leaks?

Status
Not open for further replies.
Level 5
Joined
Mar 16, 2013
Messages
108
Hello hive! i have a question, does this leak? im using damage engine and i have unit variables (DamageEventAmount) and (DamageEventTarget).
If i want to show the damage with some floating text, (Position of DamageEventTarget) part, leaks? ive searched in forum for this answer but coundnt find any info

  • Dmg Show
    • Events
      • Game - DamageEvent becomes Equal to 1.00
    • Conditions
    • Actions
      • Floating Text - Create floating text that reads ((String((Integer(DamageEventAmount)))) + !) at (Position of DamageEventTarget) with Z offset 0.00, using font size 8.50, color (80.00%, 15.00%, 20.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to (Random real number between 50.00 and 75.00) towards (Random real number between 75.00 and 105.00) degrees
      • Floating Text - Change (Last created floating text): Disable permanence
Thanks for taking your time to answer. xoxo
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
If you see these words: Position of

And they aren't being Set in a variable like so:
  • Set Variable TempPoint = (Position of (Triggering unit))
Then you're creating a Point that will leak (exist forever) if you don't get rid of it yourself.

Same goes for Center of when dealing with Regions.

All of the GUI actions/conditions will create a new Point object when referencing somewhere in the game world. To avoid this, you need to create and store the Point yourself using a variable, then reference said Point in your action/condition, and remove it once done with it.

That being said, your map should be fine even with some memory leaks. I'm sure a good chunk of the popular custom games out there are filled with them.
 
Last edited:
Level 5
Joined
Mar 16, 2013
Messages
108
If you see these words: Position of

And they aren't being Set in a variable like so:
  • Set Variable TempPoint = (Position of (Triggering unit))
Then you're creating a Point that will leak (exist forever) if you don't get rid of it yourself.

Same goes for Center of when dealing with Regions.

All of the GUI actions/conditions will create a new Point object when referencing somewhere in the game world. To avoid this, you need to create and store the Point yourself, then reference said Point in your action/condition, and remove it once done with it.

That being said, your map should be fine even with some memory leaks. I'm sure a good chunk of the popular custom games out there are filled with them.
thanks again man. Very useful
 
Level 5
Joined
Mar 16, 2013
Messages
108
In your case you could probably use the action to display a floating text above a unit, no? That way you wouldn't need to worry about points at all :)
omg! what action is that one? if not i just need to set a variable point?
 
Level 30
Joined
Aug 29, 2012
Messages
1,383
It's right under c
omg! what action is that one? if not i just need to set a variable point?
It's just under create floating text at point:

1673654110504.png
 
Level 14
Joined
Jan 10, 2023
Messages
248
...
All of the GUI actions/conditions will create a new Point object when referencing somewhere in the game world. To avoid this, you need to create and store the Point yourself, then reference said Point in your action/condition, and remove it once done with it.
...

If I am passing many points through a loop, can I overwrite the same variable each time through the loop as a means of storing the point and then just delete the one variable at the end and still avoid leaking?
 
Status
Not open for further replies.
Top