Jump to content
Sign in to follow this  
_qor

How to use BIS_fnc_dirTo?

Recommended Posts

Yo folks!

While trying to make a unit to watch to another unit by doWatch, it was disturbing that the watching unit always turned the wrong direction around AND that it was way to slow and laggy.

So the command BIS_fnc_dirTo came up. But I cant get it to work. The wiki says unit1 setDir [unit1, unit2] call BIS_fnc_dirTo, but it doesnt work this way. I also tried with [unit1, unit2] call BIS_fnc_dirTo but this doesnt work as well.

So how should I set it up to make this work?

Share this post


Link to post
Share on other sites

You have the Functions module on the map right?

Also read the wiki notes about setDir. To face someone towards something use setFormDir or else they just glance.

unit2 setFormDir ([unit2, unit1] call BIS_fnc_dirTo); 

(unit1 was the player in that example, unit2 an AI)

Share this post


Link to post
Share on other sites

It will return negative numbers....so....

_dir = [unit1,unit1] call BIS_fnc_dirTo;
if (_dir < 0) then {_dir = _dir + 360};
unit1 setDir _dir;

Share this post


Link to post
Share on other sites

I neither had the Function module on the map nor I knew about setFormDir.

But great, it works that way. Apparently I need to work more with those wikis. But there is really too much information in it!

>thanks!

BUT...

is there away to make the unit really WATCH another unit over a longer period of time? This way, the unit just looks at the position where another unit has been the time the code has been called, but thats it!

Same with getPos Player...

Edited by _qoR

Share this post


Link to post
Share on other sites
I neither had the Function module on the map

That crossed my mind but was sure you would have done that :)

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  

×