OVRKLL
New Member
- Reaction score
- 3
Hey all,
What's the easiest way to move the camera to a unit without locking it?
What's the easiest way to move the camera to a unit without locking it?
Actions
Camera - Pan camera to (position of triggering unit) over 1 second
Code:Actions Camera - Pan camera to (position of triggering unit) over 1 second
position of triggering unit leaks.
That would be it, eventually leading to lags. Easily fixed by setting the position into a variable and destroying it at the end of the trigger.
Actions
Set TempLoc = Position of triggering unit
Pan camera to TempLoc over 1 second
call RemoveLocation (udg_TempLoc)
You store the value "Position of triggering unit" into a variable, and position of a unit is a point (location). So call RemoveLocation (udg_TempLoc) quite logically removes that location, meaning you removed the position of triggering unit. The variable is still there since it's a global variable (udg = user defined global) which is created inside the variable editor.
So this simple action saved you a position. One point leak wouldn't do much harm, but imagine if you'd trigger this one a few 100 times? That would make a difference.
I don't get it. The original problem the automatically created refference ("Last created unit") was never deleted. How does this help delete it when all we do is copy it to another variable and destroy the duplicate again later? That shouldn't make any difference if you ask me.
i suggest reading a leak tutorial.
position of (triggering unit) leaks because
1. you make wc3 store the position of the trig unit into some memory and..
2. it doesn't know how to delete it after its used
so, easily fix it by making a point variable, lets say Temp_Point
Set Temp_Point = Position of (triggering unit) , this stores it to a variable instead of memory
when your done with the point,
custom script: call RemoveLocation(Temp_Point)
if you dont remove it, it keeps storing the point over and over and it builds up causing lag