HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I need help with custom script antileak

06-16-2008, 10:53 AM#1
ABM
first of all hi and thanks for reading me,
i have a problem with custom script since i sux at jass...
i use a variable point call "SpawnPoint" that i need to remove to prevent memory leak.
i know the command is:
custom script: call RemoveLocation( udg_SpawnPoint ) but the problem is that the variable i use is an array variable, and this script don't work for array.

the trigger i use is somehow like that:
Trigger:
Event: unit start casting an ability
Condition: ability equal to xxxx
Action: Set SpawnPoint[(Player number of (Owner of (Triggering unit)))] = ((Position of (Triggering unit)) offset by 100.00 towards (Random angle) degrees)
create unit at spawnpoint....
custom script: call removeLocation ( udg_SpawnPoint ??? playernumber of owner of casting unit ???

thanks in advance for your help.
06-16-2008, 11:05 AM#2
the-thingy
GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit ()))
06-16-2008, 11:09 AM#3
Fledermaus
call RemoveLocation(udg_SpawnPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit ()))])
06-16-2008, 04:49 PM#4
ABM
this work perfectly thanks for both of you ^^
and especially to Antiquities for giving me the full command since i am very noob with jass i would maybe have trouble to know what to do with only the "GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit ()))" command.

thanks for saving me lot of trouble
06-16-2008, 05:03 PM#5
the-thingy
Quote:
i would maybe have trouble to know what to do with only the "GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit ()))" command.

I assumed you knew the call RemoveLocation (udg_whichpoint[]) bit since you did have that part of the leak removal already done, my bad
06-16-2008, 08:08 PM#6
Themerion
And this is how you can do it without too much Custom Script headache:

Trigger:
Actions
Set TempPoint = SpawnPoint[(Player number of (Owner of (Triggering unit)))]
Custom script: call RemoveLocation(udg_TempPoint)
06-17-2008, 01:33 AM#7
Fledermaus
Except that SpawnPoint[] would still leak.
06-17-2008, 04:56 AM#8
chobibo
It won't, SpawnPoint is pointing to something that is destroyed, no leaks.
06-17-2008, 10:51 AM#9
Themerion
Quote:
Originally Posted by Antiquities
Except that SpawnPoint[] would still leak.

As chobibo says, you are wrong. If you aren't sure how things work, add an "I think" to your post, or preferably don't post at all.

When you use RemoveLocation, you tell Warcraft to remove the location to which the variable is pointing.

Collapse The difference:
// udg_locA and udg_locB are locations/points.

set udg_locA = GetSpellTargetLoc()
// locA refers to SpellTargetLoc()

set udg_locB = udg_locA
// locB refers to SpellTargetLoc()

set udg_locA = null
// locA refers to nothing
// locB still refers to SpellTargetLoc()

call RemoveLocation(udg_locB)
// locB refers to a removed location

set udg_locB=null
// locB refers to nothing