Jump to content
Sign in to follow this  
manzilla

Find out position

Recommended Posts

Sorry for this post but for the life of me I can't find this example mission that was posted here. It had a script or something that told you your exact position in game so you can easily place objects. I used it in A1 and saw it the other day for A2 but I can't find it any more.

Can anyone help? I've tried different searches but it eludes me still. Thanks in advance.

Share this post


Link to post
Share on other sites

Well to hint a unit's exact position you would use something like:

hint format ["X: %1, Y: %2, Z: %3",(getPos UNIT) select 0, (getPos UNIT) select 1, (getPos UNIT) select 2,];

If that is what you mean?

Share this post


Link to post
Share on other sites

I'm pretty sure that's it. I appreciate the help.

Just to be clear:

Basically I'm looking for something that I can go in game, go to a room on the 2nd floor of a building and somehow get a hint that tells me exactly where I am so I can go back to the Editor and add an object to that exact spot.

Trial and error is killing me today ;)

Thanks again.

EDIT:

Hmmm. I added this to the player's init and it said an error "missing [". Isn't that where this goes?

Share this post


Link to post
Share on other sites

Hi there,

You could call Andy's code with a radio!

That way wherever you are you could call channel Alpha and get on screen the info/coordinates of exactly where you are.

Just a thought. :D

Best, Splicer.

Share this post


Link to post
Share on other sites

Well that should work in a units Init field, I tested this code in a radio trigger:

hint format ["X: %1,  Y: %2,  Z: %3",(getPos player) select 0, (getPos player) select 1, (getPos player) select 2];

EDIT: just saw there was an extra ',' in the code I first typed, the above works fine.

Share this post


Link to post
Share on other sites

You guys are the best. It works great, thank you!

What the exact way I use this info in an objects init line. The way I'm accustom to isn't working. God it's just not my day for using the Editor.

It should be like this, right?

this setPos [x, y, z]; this setDir n(Whatever desired direction);

EDIT:

Alright I got that to work as well but I noticed the hint command I'm using doesn't take into account height it seems. I was on top of a building but it was giving me the z coordinate as 0.00143433 but I was clearly higher. Is there one that gives the height relative to the actual ground and not the floor you are standing on. I think somehow it's getting fooled into giving me the height relative to the floor I'm on and not the actual height. I honestly have no clue as to what's going on though.

Edited by Manzilla

Share this post


Link to post
Share on other sites

hint format ["X: %1,  Y: %2,  Z: %3",(getPos player) select 0, (getPos player) select 1, (getPosATL player) select 2];

All I changed was the last part which controls the Z to getPosATL which means it gets the position of the unit relative to the terrain.

Share this post


Link to post
Share on other sites

Andy's last code should work. I've used the hint command and did get altitude coordinates. :D

Let us know how it goes.

Best, Splicer.

Share this post


Link to post
Share on other sites

Thanks guys! Yes, I forgot about that one. I'll give it a try.

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  

×