• 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] does have a leak or doesn't have?

Status
Not open for further replies.
Level 2
Joined
Oct 11, 2015
Messages
20
So i have this trigger working on i don't know if its leaking or not i'm not sure.. can anyone tell me? if its lacking of something?
I've read already about Memory Leaks but i'm still not sure of it pls help

[TRIGGER=Shadowraze 200]Shadowraze 200
Events
Unit - A unit Starts the effect of an ability
Condition
(Ability being cast) Equal to Shadowraze 200
Actions
Set Raze_Point = (Position of (Triggering unit))
Set Raze_Point2 = (Raze_Point offset by 200.00 towards (Facing of (Triggering unit)) degrees)
Set Raze_Dmg = 225.00
Set Raze_AOE = 250.00
Unit - Create 1 Projectile Dummy (Shadowraze) for (Triggering player) at Raze_Point2 facing Raze_Point
Set Raze_Unit = (Last created unit)
Unit Group - Pick every unit in (Units within Raze_AOE of (Position of Raze_Unit) matching (((Matching unit) belong to an enemy of (Triggering player)) Equal to True)) and do (Actions)
Loop Actions
Set Raze_Enemy = (Picked unit)
Unit - Cause Raze_Unit to damage (Picked unit), dealing Raze_Dmg damage of attack type Spells and damage type Magic
Unit - Add a 2.00 second Generic expiration timer to Raze_Unit
Set Raze_Dmg = 0.00
Set Raze_AOE = 0.00
Custom script: call RemoveLocation(udg_Raze_Point)
Custom script: call RemoveLocation(udg_Raze_Point2)[/TRIGGER]
 
Level 2
Joined
Oct 11, 2015
Messages
20
You don't leak points, that's good.
But you leak a unit group. It needs to be destroyed properly.

Tutorial

^In chapter "How to prevent memory leaks?" it is explained how to properly prevent this leak.

Thanks mate, ill be reading/learning that tutor right away so i can fix the leak about the unit groups :grin:
 
Level 13
Joined
Jul 15, 2007
Messages
763
So i have this trigger working on i don't know if its leaking or not i'm not sure.. can anyone tell me? if its lacking of something?
I've read already about Memory Leaks but i'm still not sure of it pls help

[TRIGGER=Shadowraze 200]Shadowraze 200
Events
Unit - A unit Starts the effect of an ability
Condition
(Ability being cast) Equal to Shadowraze 200
Actions
Set Raze_Point = (Position of (Triggering unit))
Set Raze_Point2 = (Raze_Point offset by 200.00 towards (Facing of (Triggering unit)) degrees)
Set Raze_Dmg = 225.00
Set Raze_AOE = 250.00
Unit - Create 1 Projectile Dummy (Shadowraze) for (Triggering player) at Raze_Point2 facing Raze_Point
Set Raze_Unit = (Last created unit)
Unit Group - Pick every unit in (Units within Raze_AOE of (Position of Raze_Unit) matching (((Matching unit) belong to an enemy of (Triggering player)) Equal to True)) and do (Actions)
Loop Actions
Set Raze_Enemy = (Picked unit)
Unit - Cause Raze_Unit to damage (Picked unit), dealing Raze_Dmg damage of attack type Spells and damage type Magic
Unit - Add a 2.00 second Generic expiration timer to Raze_Unit
Set Raze_Dmg = 0.00
Set Raze_AOE = 0.00
Custom script: call RemoveLocation(udg_Raze_Point)
Custom script: call RemoveLocation(udg_Raze_Point2)[/TRIGGER]

Disregard what Iceman said

You have't used your point variables...

"Position of Raze Unit" should be Raze_Point2

at the moment you leak 1 location

But set this in a Temp_Group variable so you don't leak a group also
 
Level 2
Joined
Oct 11, 2015
Messages
20
Disregard what Iceman said

You have't used your point variables...

"Position of Raze Unit" should be Raze_Point2

at the moment you leak 1 location

But set this in a Temp_Group variable so you don't leak a group also

yeah i forgot... thanks. Is this okay now?
[TRIGGER=Shadowraze 200]Shadowraze 200
Events
Unit - A unit Starts the effect of an ability
Condition
(Ability being cast) Equal to Shadowraze 200
Actions
Set Raze_Point = (Position of (Triggering unit))
Set Raze_Point2 = (Raze_Point offset by 200.00 towards (Facing of (Triggering unit)) degrees)
Set Raze_Dmg = 225.00
Set Raze_AOE = 250.00
Unit - Create 1 Projectile Dummy (Shadowraze) for (Triggering player) at Raze_Point2 facing Raze_Point
Set Raze_Unit = (Last created unit)
Set Raze_UnitPoint = (Position of Raze_Unit)
Set Raze_Area = (Units within Raze_AOE of Raze_UnitPoint matching (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))
Unit Group - Pick every unit in Raze_Area and do (Actions)
Loop Actions
Set Raze_Enemy = (Picked unit)
Unit - Cause Raze_Unit to damage (Picked unit), dealing Raze_Dmg damage of attack type Spells and damage type Magic
Unit - Add a 2.00 second Generic expiration timer to Raze_Unit
Set Raze_Dmg = 0.00
Set Raze_AOE = 0.00
Custom script: call DestroyGroup(udg_Raze_Area)
Custom script: call RemoveLocation(udg_Raze_UnitPoint)
Custom script: call RemoveLocation(udg_Raze_Point)
Custom script: call RemoveLocation(udg_Raze_Point2)[/TRIGGER]
 
Level 2
Joined
Oct 11, 2015
Messages
20
Almost, delete Raze_UnitPoint and use Raze_Point2 because they are the same. And what's Raze_Enemy for? You didn't used it.. And your spell can hit structures (buildings), I don't know if that's intentional, just saying in case you missed it.
[TRIGGER=Shadowraze 200]Shadowraze 200
Events
Unit - A unit Starts the effect of an ability
Condition
(Ability being cast) Equal to Shadowraze 200
Actions
Set Raze_Point2 = ((Position of (Triggering Unit)) offset by 200.00 towards (Facing of (Triggering unit)) degrees)
Set Raze_Dmg = 225.00
Set Raze_AOE = 250.00
Unit - Create 1 Projectile Dummy (Shadowraze) for (Triggering player) at Raze_Point2 facing Raze_Point
Set Raze_Unit = (Last created unit)
Set Raze_UnitPoint = (Position of Raze_Unit)
Set Raze_Area = (Units within Raze_AOE of Raze_UnitPoint matching (((Matching unit) belongs to an enemy of (Triggering player)) Equal to True))
Unit Group - Pick every unit in Raze_Area and do (Actions)
Loop Actions
Set Raze_Enemy = (Picked unit)
Unit - Cause Raze_Unit to damage Raze_Enemy, dealing Raze_Dmg damage of attack type Spells and damage type Magic
Unit - Add a 2.00 second Generic expiration timer to Raze_Unit
Set Raze_Dmg = 0.00
Set Raze_AOE = 0.00
Custom script: call DestroyGroup(udg_Raze_Area)
Custom script: call RemoveLocation(udg_Raze_UnitPoint)
Custom script: call RemoveLocation(udg_Raze_Point2)[/TRIGGER]

Is this above fine now? Thanks for reminding me that those 2 are the same lol. Didnt know that.. Ive deleted it and thanks also for the reminder for the Raze_Enemy.. Ow and for my spell that can structures... well i didnt know that but i dont have structures in my map.. just shops..
 
Last edited:
You deleted the wrong point location, boyls. Flux meant for you to delete Raze_UnitPoint since its the same as Raze_Point2. You need to have Raze_Point because you leak here:
  • Set Raze_Point2 = ((Position of (Triggering Unit)) offset by 200.00 towards (Facing of (Triggering unit)) degrees)


You don't need to do this. I'd also recommend moving Raze_Dmg + AOE to a Map Init trigger so that this doesn't always have to be set everytime the spell is cast.
  • Set Raze_Dmg = 0.00
  • Set Raze_AOE = 0.00


I'd also recommend adding a magic immune filter + unit is alive when you select the unit group!
 
Level 2
Joined
Oct 11, 2015
Messages
20
You deleted the wrong point location, boyls. Flux meant for you to delete Raze_UnitPoint since its the same as Raze_Point2. You need to have Raze_Point because you leak here:
  • Set Raze_Point2 = ((Position of (Triggering Unit)) offset by 200.00 towards (Facing of (Triggering unit)) degrees)


You don't need to do this. I'd also recommend moving Raze_Dmg + AOE to a Map Init trigger so that this doesn't always have to be set everytime the spell is cast.
  • Set Raze_Dmg = 0.00
  • Set Raze_AOE = 0.00


I'd also recommend adding a magic immune filter + unit is alive when you select the unit group!

Thanks bro and also for the recommendation :grin: ow and how can they be the same.. they r not.. i think? bc
Raze_UnitPoint is the position of the last created unit (Raze_Unit)
While Raze_Point2 is the Position of Triggering Unit offset by 200 towards...
 
Last edited:
Level 23
Joined
Feb 6, 2014
Messages
2,466
Thanks bro and also for the recommendation :grin: ow and how can they be the same.. they r not.. i think? bc
Raze_UnitPoint is the position of the last created unit (Raze_Unit)
While Raze_Point2 is the Position of Triggering Unit offset by 200 towards...

  • Unit - Create 1 Projectile Dummy (Shadowraze) for (Triggering player) at Raze_Point2 facing Raze_Point
  • Set Raze_Unit = (Last created unit)
^ You created a unit at Raze_Point2, but then

  • Set Raze_UnitPoint = (Position of Raze_Unit)
^ which is the same as Raze_Point2 because Raze_Unit is created at Raze_Point2, therefore Raze_UnitPoint = Raze_Point2
 
Level 2
Joined
Oct 11, 2015
Messages
20
  • Unit - Create 1 Projectile Dummy (Shadowraze) for (Triggering player) at Raze_Point2 facing Raze_Point
  • Set Raze_Unit = (Last created unit)
^ You created a unit at Raze_Point2, but then

  • Set Raze_UnitPoint = (Position of Raze_Unit)
^ which is the same as Raze_Point2 because Raze_Unit is created at Raze_Point2, therefore Raze_UnitPoint = Raze_Point2

wao. now i realize... thanks Flux!
 
Status
Not open for further replies.
Top