Jump to content
Sign in to follow this  
damned303

XYZ Coordinates

Recommended Posts

Is there a way of getting the XYZ coordinates for a player in the editor? What I want to do is move about the buildings/map and when I find the position that I want for the soldier/item to be placed get the XYZ coordinates so that they can be added to the script.

Share this post


Link to post
Share on other sites

You can use a hint to find the location but there is no where in the editor to get/change it.

Add this to the unit init field

hint format["Position:%1", getpos playername]

There are some other examples on the OFPEC FAQ

Share this post


Link to post
Share on other sites

What i usually do for exact object placement is,

ALT + TAB out of the game,

open the mission.sqm of the mission.

Do a search (CTRL+F) for player (or the object with the desired position) until you find

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class Item0

{

position[]={14082.471680,33.242897,10018.473633};

id=121;

side="WEST";

vehicle="SquadLeaderW";

player="PLAYER COMMANDER";

leader=1;

rank="SERGEANT";

skill=0.466667;

text="";

init="";

};

Then i copy the position out and paste it into a script.

You have to swap the y and z coordinates though, since BIS for internal reasons use different axes than the Direct3D standard.

That means that for example:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

14082.471680,33.242897,10018.473633

becomes:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_pos=[14082.471680,10018.473633,33.242897]

So now you can either use setposASL the object with

that position or for setpos you leave out the height:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_pos=[14082.471680,10018.473633]

You can of course,like Hoz described, write down the position, that the hint gives you, but i am usually too lazy to write down all the digits onto a piece of paper biggrin_o.gif

Hope that helps you achieve what you are looking for.

Charon

Share this post


Link to post
Share on other sites

How can I return an absolute (sea level) altitude of an object if the object is under or on top of a bridge? I have tried getposASL, but it considers sea level as the roof of the bridge just like regular getpos.

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  

×