Jump to content
Sign in to follow this  
crawl55

getdir to an object or target

Recommended Posts

how do i get the direction to a specific object, target, or marker? is this possible. Basically I want to run a script that tells the AI to face the direction of the object or marker...not so much a target because I want it to be a building.

Share this post


Link to post
Share on other sites

One version:

_ai = _this select 0;
_posAi = getpos _ai;
_posTrg = getpos (_this select 1);
_ai setdir (((_posTrg select 0) - (_posAi select 0)) atan2 ((_posTrg select 1) - (_posAi select 1)));

nul = [nameOfAI,nameOfTargetUnit] execvm "scriptabove.sqf"

Share this post


Link to post
Share on other sites

Thanks, that works great. I do have another question. Is it possible to have AI lase a building? That is my end goal and my know how seems to be running out!!!

Share this post


Link to post
Share on other sites

In case anyone else wanted to know how to lase a building with AI, you can create a vehicle out of the lasertargetE and use a trigger or a script and it will work the same as AI lasing the building!!!

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  

×