Jump to content
Sign in to follow this  
Roundboy

Position calculations

Recommended Posts

I have a chopper flying towards my player position.. so far.. my check for the loop is:

#movechopper

_heli doMove myPos

? (_heli distance player < 75) : goto "movechopper"

This works pretty well so far.. but.. i run into probs when i am in a low area, and my chopper was flying high.. it hovers too long looking for me...

is a better way getting the x and z positions of each unit and comparing them:

#movechopper

_heli doMove mypos

?((_heliX == _playerx) && (_heliZ == _playerZ)) : goto "movechopper"

or check for a value within 2 units from x ,z ??

How is everyone getting one unit close to another reliably?

Share this post


Link to post
Share on other sites

well, as I understand it, your problem is that the "distance" command calculates z, instead of only x and y.

you could try comparing your player's x&y with the coordinates of the chopper, but it would be a bitch telling it when to check for positive and when for negative numbers, depending on your azimuth...

here's what I'ld do:

place a game logic on the map, name it, and then make it follow the position of the helicopter.

</span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">logic setpos [getpos heli1 select 0, getpos heli1 select 1, getpos player select 2]<span id='postcolor'>

that should give the game logic the same x and y as the helicopter, and the z from your player. now all you need to do is use the distance command again, but with the game logic, instead of the chopper biggrin.gif

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  

×