HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Assisstence Needed

11-24-2007, 04:29 AM#1
Monky-Master
Trigger:
Fire
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Shoot
Collapse Actions
Custom script: set udg_FireX = GetUnitX(GetSpellAbilityUnit())
Custom script: set udg_FireY = GetUnitY(GetSpellAbilityUnit())
Unit - Create 1 Sniper Bullet for (Owner of (Casting unit)) at (Point(FireX, FireY)) facing ducks

How do I remove the location at FireX and FireY? Rather, how do you remove locations created by the use of coordinates in general? Do you use
Collapse JASS:
 call RemoveLocation(udg_Firex, udg_FireY)) 



Man...switching from regular Point variables to using coordinates is confusing.
11-24-2007, 04:36 AM#2
Tiku
I think it would be:
Collapse JASS:
call RemoveLocation(Location(udg_FireX, udg_FireY))
because "Location" converts points into a location
11-24-2007, 04:45 AM#3
Monky-Master
So Location(Location()) converts into coordinates.

I see now, thanks.
11-24-2007, 04:46 AM#4
Tide-Arc Ephemera
Do coordinates even leak...?
11-24-2007, 05:06 AM#5
zen87
you are using coordinates there... no location is created, so using remove location is not needed here
11-24-2007, 06:40 AM#6
Pyrogasm
Actually, he is leaking a location: ...(Point(FireX, FireY))...
The only way to fix leaks like that is to store the location in a variable. At that rate, you might as well not even use the custom scripts and set the location outright:
Trigger:
Actions
Set TempPoint = (Position of (Target Unit of Ability Being Cast))
----- If you needed these set for some reason, you can do it still -----
set FireX = X of (TempPoint)
set FireY = Y of (TempPoint)
----- - -----
Unit - Create 1 Sniper Bullet for (Owner of (Casting unit)) at TempPoint) facing ducks
Custom script: call RemoveLocation(udg_TempPoint)
11-24-2007, 09:02 PM#7
Jazradel
X and Y are good, but if you need to create the location anyway use the location.

Best idea would be to use:
Collapse JASS:
call CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'Sniper Bullet Id', GetUnitX(GetSpellTargetUnit()), GetUnitY(GetSpellTargetUnit()), udg_ducks)
That's free hand, so it's not 100% accurate but it's the general idea.
11-25-2007, 02:36 AM#8
zen87
Oh dear, my bad, I've totally forget about GUI uses CreateUnitLoc instead of CreateUnit...