Move camera to unit

OVRKLL

New Member
Reaction score
3
Hey all,

What's the easiest way to move the camera to a unit without locking it?
 

cleeezzz

The Undead Ranger.
Reaction score
268
Code:
Actions
   Camera - Pan camera to (position of triggering unit) over 1 second

position of triggering unit leaks.
 

OVRKLL

New Member
Reaction score
3
Code:
Actions
   Camera - Pan camera to (position of triggering unit) over 1 second

position of triggering unit leaks.

What do you mean "leaks"? That it stays in the memory and stacks when the trigger is repeated?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
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)
 

OVRKLL

New Member
Reaction score
3
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)

Unless Blizzard made some seriously irrational programming, that's not solving anything. The automatically stored value "Position of triggering unit" should still be stored, as far as I can guess?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
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.
 

OVRKLL

New Member
Reaction score
3
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.
 

cleeezzz

The Undead Ranger.
Reaction score
268
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
 

Iwan_Krissov

New Member
Reaction score
18
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.

Youre right, its not at all logic, but it is like that. Destroying the duplicate will cause your trigger not to leak...
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
It's fully logical. They are both the exact same value, one is inside the variable and one is the preset GUI function, still the exact same value. Whatever happens to the variable value happens to the preset value. If you refer to the variable value you could refer to the preset one an get the same result, so why would removing the point not be the exact same way?

The thing you do when you set the value into a variable is that you never really use that value in your code, only the variable. When you later on remove the value stored in that variable you remove that value.
 

OVRKLL

New Member
Reaction score
3
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

So World Editor makes Warcraft delete automatically created variables if a user-defined one is made as a duplicate? Sounds both logical and desperate...
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top