Avoid Memories leak
Moderator: Cheaters
-
- Some Honorary Title
- Posts: 1713
- Joined: June 8th, 2007, 5:08 am
- Title: Angry Bird
Avoid Memories leak
I have tried making this -tele command a few times but I failed. I think I missed something on my script. Could anyone just show me how to make a -tele (set patrol to teleport) command in JASS, please?
Last edited by initialD on January 24th, 2008, 4:57 am, edited 2 times in total.
-
- Honorary wc3edit.net Traitor
- Posts: 2507
- Joined: February 1st, 2007, 4:11 pm
- Location: NEVADA
Re: set patrol to teleport.
event: unit issues an order
condition: order equal to patrol
action: move unit instantly to target point of issued order
condition: order equal to patrol
action: move unit instantly to target point of issued order
-
- Forum Staff
- Posts: 829
- Joined: January 28th, 2007, 8:10 pm
- Title: JASS Programmer
- Location: Canada
-
- Honorary wc3edit.net Traitor
- Posts: 2507
- Joined: February 1st, 2007, 4:11 pm
- Location: NEVADA
Re: set patrol to teleport.
it still gives correct functions and if anyone really cares, they can fix it...
lol
lol
-
- Forum Staff
- Posts: 829
- Joined: January 28th, 2007, 8:10 pm
- Title: JASS Programmer
- Location: Canada
-
- Honorary wc3edit.net Traitor
- Posts: 2507
- Joined: February 1st, 2007, 4:11 pm
- Location: NEVADA
Re: set patrol to teleport.
I'm sorry you feel that way, feel free to tell us how to fix it, asap!
otherwise we got a crisis on our hands.
otherwise we got a crisis on our hands.
-
- Some Honorary Title
- Posts: 1713
- Joined: June 8th, 2007, 5:08 am
- Title: Angry Bird
Re: set patrol to teleport.
Thanks xantan. I made it.
About the leaks.I have no idea what it is. Could Aero explain a bit?
Here is the function I made, if that does matter.
About the leaks.I have no idea what it is. Could Aero explain a bit?
Here is the function I made, if that does matter.
Code: Select all
function Tp takes nothing returns nothing
local unit u=GetTriggerUnit()
local location k=GetOrderPointLoc()
if GetIssuedOrderId()==851990then
call SetUnitPosition(u,GetLocationX(k),GetLocationY(k))
endif
set u=null
set k=null
endfunction
-
- Forum Staff
- Posts: 829
- Joined: January 28th, 2007, 8:10 pm
- Title: JASS Programmer
- Location: Canada
Re: set patrol to teleport.
That still leaks a location and can be done cleaner.
Attach a condition to your trigger first of all.
And actions should look like this:
SetUnitX / SetUnitY is faster than SetUnitPosition as SetUnitPosition checks pathing, map bounds ect.
SetUnitX/Y completely ignores pathing, map bounds and other limitations.
It's imperative you have "RemoveLocation(l)" to clean that location from memory. Otherwise, this floating location doesn't get removed and leeches RAM.
Attach a condition to your trigger first of all.
Code: Select all
function SomeCond takes nothing returns boolean
return GetIssuedOrderId()==851990
endfunction
Code: Select all
function Tp takes nothing returns nothing
local unit u=GetTriggerUnit()
local location l=GetOrderPointLoc()
call SetUnitX(u,GetLocationX(l))
call SetUnitY(u,GetLocationY(l))
call RemoveLocation(l)
set u=null
set l=null
endfunction
SetUnitX/Y completely ignores pathing, map bounds and other limitations.
It's imperative you have "RemoveLocation(l)" to clean that location from memory. Otherwise, this floating location doesn't get removed and leeches RAM.
-
- Some Honorary Title
- Posts: 1713
- Joined: June 8th, 2007, 5:08 am
- Title: Angry Bird
Re: set patrol to teleport.
Thanks Aero. Moderator please don't delete this thread first. I will need some time to learn all that JASS.
thanks.

-
- Tyrannical Drama Queen
- Posts: 4442
- Joined: November 19th, 2007, 5:05 am
- Been thanked: 2 times
Re: set patrol to teleport.
If you or someone can learn from this topic, it's not going to be deleted. (and you can learn something from this topic, so...)initiald wrote:Thanks Aero. Moderator please don't delete this thread first. I will need some time to learn all that JASS.thanks.