Home   Help Search Login Register  

Author Topic: Redirecting missiles  (Read 643 times)

0 Members and 1 Guest are viewing this topic.

Iva

  • Guest
Redirecting missiles
« on: 23 Nov 2003, 10:29:51 »
Hi ya all
I am making some scripts for redirecting missiles
I was trying to make script wich will redirect missile away from my plane to Flare
so it could be more realistic that missile hit flare and explode not to hit air as in
tornado or rad fa-18.
I tryed this but it wont work

#FlareReDirect
_PosFlare = getPos _Flare
_missile setdir _PosFlare
~0.0001
?(alive _missile):goto "FlareReDirect"

so i need syntax wich will take Flares coordinates and convert them to missiles target so it could hit flare

Grendel

  • Guest
Re:Redirecting missiles
« Reply #1 on: 24 Nov 2003, 05:56:28 »
Looking at just the loop:

Quote
#FlareReDirect
_PosFlare = getPos _Flare
_missile setdir _PosFlare
~0.0001
?(alive _missile):goto "FlareReDirect"

One problem is that the getpos command returns an array: [xcoord,ycoord,zcoord].

SetDir needs a single number from 0-359.

if you use a dirtoobj function (look it up in the editor depot's function section and insert required line in the init.sqs)  and change the loop as such:

#FlareReDirect
_DirFlare = [_missile,_Flare] call DirToObj
_missile setdir _DirFlare
~0.0001
?(alive _missile):goto "FlareReDirect"

You might have some luck with this...I'd have to test it myself to see if it would work to know for sure.  You might need to use SetVelocity instead of SetDir...this is much more complicated to get things moving in the right direction, however.

-Grendel
« Last Edit: 24 Nov 2003, 05:59:01 by Grendel »