Jump to content
Sign in to follow this  
160th(SOAR)LoNeWoLF

How does setpos work?

Recommended Posts

Could any1 explain to me how I could use setpos instead of copying and pasting setpos commands? Its just the way the script is worded just completely confuses me

Examples

- Jeep Action ["Light Off"] - is is self explanatory.

(LSD Code to put heli on the deck) -

this setpos[(getpos this select 0),(getpos this select 1),7] - LoL but wtf does this all mean?

Share this post


Link to post
Share on other sites

When you want to move unit, you need x,y,z axis.

unit setpos  [x,y,z]

getpos unit -returns x,y,z axis of object

getpos unit select 0 -grabs 1st value from position array (x)

getpos unit select 1 -grabs 2nd value from position array (y)

getpos unit select 2 -grabs 3th value from position array (z)

so

this setpos[(getpos this select 0),(getpos this select 1),7]

means : object stays in its original x,y position but in height of 7m.

And

this setpos[(getpos this select 0),(getpos this select 1),(getpos this select 2)+7]

lets unit stays in original x,y position but it moves it 7m higher then it was previously.

Share this post


Link to post
Share on other sites

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote (160th(SOAR)LoNeWoLF @ Oct. 19 2002,20:14)</td></tr><tr><td id="QUOTE">this setpos[(getpos this select 0),(getpos this select 1),7] - LoL but wtf does this all mean?<span id='postcolor'>

SetPos takes an array with 3 numbers: the x- and y-coordinates and the z-coordinate (height).

A sample setpos command with plain figures would be: this setpos [2000,3000,5] which would move the unit/object to coordinates x=2000 y=3000 and 5 metres above the ground.

GetPos returns a similar array. For example, typing in the init field:

myCoordinates = getpos this

would get the 3 coordinates of the object and save them in an array variable called myCoordinates. Now, if you want to handle a specific coordinate separately you can do it by using separating it with the select-keyword:

xCoord = getpos this select 0

yCoord = getpos this select 1

height = getpos this select 2

In your example,

this setpos[(getpos this select 0),(getpos this select 1),7]

the setpos command doesn't move the unit in the x-y plane at all but raises it 7 metres up from the sea level.

Share this post


Link to post
Share on other sites

Whoops, didn't see this thread. xD

Anyway, here's my problem.  I typed in

this setpos[(getpos this select 0),(getpos this select 1),10]

and it worked pretty well.  I was putting an AH-1 on an LSD, and it worked flawlessly.

My problem is, I forget how to great a trigger that only goes off when all of a group is destroyed, so what I'm trying to do is put it somewhere else, have the LSD move to it while the AH-1 is moving mud, then have the AH-1 come back to it and set off the trigger.

My problem is that using the setpos command, it puts the helicopter in that point in space, not on top of the LSD.

So basically, I have the LSD moving, but the AH-1 is standing still because it's just floating there in a point in space.  Here's a pic. (http://fspilot.homestead.com/files/OPFpics/hovr.JPG)

Can someone help me out?

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×