• 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] Would this Properly work?

Status
Not open for further replies.
Level 3
Joined
Jun 3, 2013
Messages
34
  • QUESTION?
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Unit - Move (Attacked unit) instantly to (Position of (Attacking unit))
      • Custom script: call RemoveLocation((GetUnitLoc(GetAttacker())))
Hello, I would like to ask if this is also another way in removing a Location besides using variables
like temp_loc or temp_point, then removing them Manually with:
  • Actions
    • Custom script: call RemoveLocation(udg_temp_point) or call RemoveLocation(udg_temp_loc)
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
that wont work, because invoking Position of (...) will always create new location, so the first line creates location, which you leak, and the second line with custom script will create location, which you immediately pass to RemoveLocation, so you remove that one

edit:

I will just note, that 2 locations, that have same x, y, and z are still 2 independant objects
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
the only thing I think of requires vjass.
JASS:
hook CreateNUnitsAtLoc

function myfunc takes location loc returns nothing
	local location p = loc
	CreateNUnitsAtLoc(p)
	call RemoveLocation(p)
	call RemoveLocation(loc)
	return
endfunction

this is not working so dont copy it. However I think my idea would leak anyway.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
afaik, the only raw points are the one, that are initialized in main(Bjs), since everything else is temporary location, including Center of (Playable map area)

And why wont your script work is, because you call CreateNUnitsAtLoc inside hook of that function, and the function will actually be called after your body of hooked function is executed, and if you call it within the hook, you basically execute the trigger, that runs your body, which executes the trigger etc etc, and that is infinte loop
 
Status
Not open for further replies.
Top