Jump to content
Sign in to follow this  
bigshotking

Get direction of target from enemy position

Recommended Posts

I'm currently stuck on this little script of mine and was wondering if this is a quick fix.

I'm trying to get the direction of a static weapons target from the static weapon, if the target is not within the static weapons turn radius then the gunner will eject.

So my question is how do I get the targets direction from the static weapon?

Thanks in advance,

-Bigshot

Share this post


Link to post
Share on other sites

I cant seem to find any documentation on the BIS_fnc_DirTo. It's not in the wiki

Share this post


Link to post
Share on other sites

...make a trigger / radio alpha:

on activation:

nul = [] call bis_fnc_help. -> Many useful fnc, also BIS_fnc_dirTo. ;)

Share this post


Link to post
Share on other sites

Here's some code for it.... hope it helps you.

_x1 = getPos _staticweapon select 0;
_y1 = getPos _staticweapon select 1;

_x2 = getPos _target select 0;
_y2 = getPos _target select 1;

_dx = _x2 - _x1;
_dy = _y2 - _y1;

_direction = (_dx atan2 _dy) mod 360;

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  

×