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

Questions about memory leaks (special effect)

Status
Not open for further replies.
Level 31
Joined
Apr 17, 2009
Messages
3,572
Hey Guys,

I know that special effects do leak. What I do in my triggers is removing a unit from game that has a special effect atached. Is that bad?

Second question:

I know how to remove location leaks with the custom script.

For example I use this:

  • Custom script: call RemoveLocation( udg_TempPoint[0] )
But what do I have to write if I'm using the function "Player number of owner of triggering unit" for the array index?

Thanks for your time
chilla_killa
 
Level 30
Joined
Nov 29, 2012
Messages
6,637
Based here which is same with your problem: http://www.hiveworkshop.com/forums/...tached-unit-destroy-when-unit-removed-206630/

You have to first store the special effect within the unit into an array or hashtable and then remove it with it "DestroyEffect" or simply Solu9's answer above. But it would always be best to store some special effects into variables when you are maybe using them many times and etc.

Second Question,
It would be best to store Triggering Unit to a variable or the command itself: "Player Number of Owner of Triggering Unit" to be in the safe side.

It might also help looking through the different memory leaks: http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=27219

EDIT: Nevermind, my answer to the second question. I misunderstood it.
 
The actual function is GetPlayerId(GetOwningPlayer(GetTriggerUnit())).

But if you work with GUI you maybe need this: GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))

The difference is +1 in the 2nd function. (What actually is Player(0) in JASS is Player[1] in GUI)

A good tip for these things to look it up by your own is just to create an action where you use your wanted function and then convert it into JASS for a short moment. (so you can copy it, and then undo the convertion)
 
Status
Not open for further replies.
Top