Jump to content
Sign in to follow this  
quakergamer

Scripting problems ... please read!

Recommended Posts

Hello everyone,

I have a problem. Lets say I want to camcreate an object 300m away from the person executing the script. Well it always create the object 300M AT THE NORTH of the soldier even if the soldier is facing another direction ! How can I make it detect the direction of the soldier and create it always at the front of the soldier even if he is facing another direction than north!

Thanks!

Share this post


Link to post
Share on other sites

Have you tried something like getdir?

ie,

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">direction1 = getdir soldier1

Share this post


Link to post
Share on other sites
Have you tried something like getdir?

ie,

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">direction1 = getdir soldier1

Yea I have tried getDir command but I still cant make the objects camcreate in the good direction ..

Share this post


Link to post
Share on other sites

Like this.....

_person = this select 0

_personpos = GetPos _person

_persondir = GetDir _person

_newx = (_personpos select 0) + 300 * Sin(_persondir)

_newy = (_personpos select 1) + 300 * Cos(_persondir)

I believe that will get your position 300 meters ahead of you and this is 300m behind

_newx = (_personpos select 0) - 300 * Sin(_persondir)

_newy = (_personpos select 1) - 300 * Cos(_persondir)

Share this post


Link to post
Share on other sites

Thank you franze and BraTTy for your help! It finally works smile_o.gif.

See ya and thanks !

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  

×