Jump to content
Sign in to follow this  
wld427

flare script adjustments

Recommended Posts

Hey folks. I have this script from Franze that i am using for flares on all our aircraft. The issue i have is it works too damn good. I tried to shoot down our Su24 with the AV8 and i fired all my missiles and only one came close. I want to limit the capabilities of this thing. we already have the flare limit implimented. Roght now the way the script is the flares stop firing when they are expended but the missiles still get deflected. PLEASE HELP

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

;Missile spoof script by Franze

;Uses elements from BAS's spoof missile script

;and from Moph's range bearing and altitude script

_helo = _this select 0

_enemy = _helo select 2

_count = 0

;?(mando_missile_init) : exit

?(not alive (_helo select 0) ) or (not isengineon (_helo select 0)): exit

_weaponname = _helo select 1

_missile = nearestobject [_enemy,_weaponname]

_text = format["%1", _missile]

;hint format ["Heres the Text: %1",_text]

?(_weaponname == "R_M136_AT") or (_weaponname == "R_PG7V_AT") or (_weaponname == "R_PG7VR_AT"): goto "rpg"

?(_text == "NOID jam_rpg7rocketf") or (_text == "NOID icprpg7rocketf"): goto "rpg"

?(_text == "NOID dkmm_mi28_23mmtr"): exit

goto "misdir1"

#rpg

(_helo select 0) vehiclechat "R P G!"

exit

#misdir1

_poshelo = getpos (_helo select 0)

_posenemy = getpos _missile

#start

_x1 = _poshelo select 0

_y1 = _poshelo select 1

_z1 = _poshelo select 2

_x2 = _posenemy select 0

_y2 = _posenemy select 1

_z2 = _posenemy select 2

_x = (_x1 - _x2)

_y = (_y1 - _y2)

;;_range = ((_x^2)+(_y^2))^0.5

_range = _missile distance (_helo select 0)

? (_x>0) and (_y>0): _theta = atan (abs _x/ abs _y) +180

? (_x>0) and (_y<0): _theta = atan (abs _y/ abs _x) +270

? (_x<0) and (_y<0): _theta = atan (abs _x/ abs _y)

? (_x<0) and (_y>0): _theta = atan (abs _y/ abs _x) +90

;;goto "highlowchk"

_dirhelo1 = direction (_helo select 0)

_theta = (360 + (_dirhelo1 - _theta))Mod 360

?(_theta > 15 and _theta < 45): goto "eleven"

?(_theta > 45 and _theta < 75): goto "ten"

?(_theta > 75 and _theta < 105): goto "nine"

?(_theta > 105 and _theta < 135): goto "eight"

?(_theta > 135 and _theta < 165): goto "seven"

?(_theta > 165 and _theta < 195): goto "six"

?(_theta > 195 and _theta < 225): goto "five"

?(_theta > 225 and _theta < 255): goto "four"

?(_theta > 255 and _theta < 285): goto "three"

?(_theta > 285 and _theta < 315): goto "two"

?(_theta > 315 and _theta < 345): goto "one"

?(_theta > 345 and _theta < 360): goto "twelve"

?(_theta > 0 and _theta < 15): goto "twelve"

#highlowchk

?(_z2 > 50): goto "high"

?(_z2 < 50): goto "low"

#eleven

_oclock = 11

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#ten

_oclock = 10

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#nine

_oclock = 9

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#eight

_oclock = 8

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#seven

_oclock = 7

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#six

_oclock = 6

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#five

_oclock = 5

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#four

_oclock = 4

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#three

_oclock = 3

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#two

_oclock = 2

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#one

_oclock = 1

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#twelve

_oclock = 12

?(_z2 > _z1): goto "high"

?(_z2 < _z1): goto "low"

goto "rndm"

#high

(_helo select 0) vehiclechat format ["%1 Missile %2 OClock High %3 Meters",_weaponname,_oclock,_range]

(_helo select 0) vehicleradio "PRACS_Mirage3_miswarn"

goto "jammeron"

#low

(_helo select 0) vehiclechat format ["%1 Missile %2 OClock Low %3 Meters",_weaponname,_oclock,_range]

(_helo select 0) vehicleradio "PRACS_Mirage3_miswarn"

goto "jammeron"

#jammeron

_rand = 10

_chance1 = 4

_chance2 = 3

#rndm

?(flarecount <= 0): _rand = 20; _chance1 = 3; _chance2 = 2

#spoof

[(_helo select 0)] exec "\PRACS_Mirage3\scripts\flarelaunch.sqs"

?((_helo select 0) animationphase "flarecount" >= 1): exit

?(random 100 < _rand): goto "quit"

@ (_missile distance (_helo select 0)) <100

#loop

_missile setdir (direction _missile - _chance1 - random _chance2)

_count =_count +1

? _count <7:goto "loop"

#quit

exit

Edited by W0lle

Share this post


Link to post
Share on other sites

I've found the same thing with most of the flare addons, plane are almost impossible to shoot down, uless your using ACE mod and are within 600m of the target.

One of two things needs to happen, one the random chance for the missile to deflect needs to be lowered.

Second is all the aircraft addons I’ve converted, that carry AA missiles will now have a proximity warhead so they can in most cases overcome or at least cause some damage to the aircraft being attacked .

You can do this by finding out at what distance the flare scripts kicks in and making the warhead active just outside this range, but also increase the ‘secondary’ blast amount/range so that some damage is done.

This isn’t ideal, but having a F15 with 6 AA missiles chase down a Su-24 and use all it missiles without one hit is a bit over the top smile_o.gif thank god for the guns!

Southy

Share this post


Link to post
Share on other sites

precisely why if we cannot find a way to make the aircraft "hittable" im going to rip the countermeasures system off....

Share this post


Link to post
Share on other sites

It seems that there are many things you can change in that script...

First you can leave the lines with "NOID jam...", "NOID icp..." and "NOID dkmm..." out, since I guess that neither JAM, neither ICP RPG-pack and neither the DKMM Mi28 are available for ArmA.

(Not so important: What needs a bit of understanding of trigonometrics: All those lines with "atan" could be replace with one line of "atan2")

But to come to the main thing:

This:

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

?(flarecount <= 0): _rand = 20; _chance1 = 3; _chance2 = 2

Should be replaced with the following:

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

?((_helo select 0) animationPhase "flarecount" <= 0): _rand = 20; _chance1 = 3; _chance2 = 2

Then I'd swap the following lines:

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

[(_helo select 0)] exec "\PRACS_Mirage3\scripts\flarelaunch.sqs"

?((_helo select 0) animationphase "flarecount" >= 1): exit

Those two lines are responsible for seeing the visual flare-effect, although there aren't any more flares available; I guess that the animation 'flarecount' is changed in the flarelaunch.sqs, right?

so you have:

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

?((_helo select 0) animationphase "flarecount" >= 1): exit

[(_helo select 0)] exec "\PRACS_Mirage3\scripts\flarelaunch.sqs"

Thus, if the flares are expended, the visual effect isn't started anymore.

As I see it, there's a 20% chance that the flares spoof the incoming missiles (random 100 < _rand, where _rand is 20); this should be OK, especially if the incoming missiles use a proximity fuze-script.

Just to add one thing: I think that the script could be overall shortened to maybe ten lines or less. (sorry for being a smartass, I really should post a refined script, thus really helping you, instead)

Edited by W0lle

Share this post


Link to post
Share on other sites

no buddy you are spot on.

It jsut seems that with the spoof set to 10% it takes all your missiles to down one enemy aircraft.

either way... i will try your fixes and report back

Share this post


Link to post
Share on other sites

It is still very difficult to get a missile hit on an aircraft....

@soul assasain.... could you please post a modified script.... and let me know the best way to adjust it?

Share this post


Link to post
Share on other sites
Quote[/b] ]@soul assasain....

tounge2.gif

It is still very difficult to get a missile hit on an aircraft....

Are those missiles using a proximity fuze script? If not, the missiles need to hit the plane/geometry, which is improbable, especially for fast moving aircraft.

I tried to condense and simplify your script as much as possible without testing it; you should also post the "flarelaunch.sqs", so we can be sure, you're changing the "flarecount" animation.

As I see it, for the first flare the chance to spoof the missile is 20%; for any other flare it's only 10%.

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

;Missile spoof script by Franze

;Uses elements from BAS's spoof missile script

;and from Moph's range bearing and altitude script

_helo = _this select 0

_enemy = _helo select 2

?(not alive (_helo select 0) ) or (not isengineon (_helo select 0)): exit

_weaponname = _helo select 1

?(_weaponname == "R_M136_AT") or (_weaponname == "R_PG7V_AT") or (_weaponname == "R_PG7VR_AT"): (_helo select 0) vehiclechat "R P G!"; exit

?((_helo select 0) animationphase "flarecount" >= 1): exit

_missile = nearestobject [_enemy,_weaponname]

_poshelo = getpos (_helo select 0)

_posenemy = getpos _missile

_x1 = _poshelo select 0

_y1 = _poshelo select 1

_z1 = _poshelo select 2

_x2 = _posenemy select 0

_y2 = _posenemy select 1

_z2 = _posenemy select 2

_x = _x1 - _x2

_y = _y1 - _y2

_range = _missile distance (_helo select 0)

? (_x>=0) and (_y>=0): _theta = atan (abs _x/ abs _y) +180

? (_x>=0) and (_y<=0): _theta = atan (abs _y/ abs _x) +270

? (_x<=0) and (_y<=0): _theta = atan (abs _x/ abs _y)

? (_x<=0) and (_y>=0): _theta = atan (abs _y/ abs _x) +90

_dirhelo1 = direction (_helo select 0)

_theta = (360 + (_dirhelo1 - _theta))Mod 360

?(_theta > 15 and _theta <= 45): _oclock = 11

?(_theta > 45 and _theta <= 75): _oclock = 10

?(_theta > 75 and _theta <= 105): _oclock = 9

?(_theta > 105 and _theta <= 135): _oclock = 8

?(_theta > 135 and _theta <= 165): _oclock = 7

?(_theta > 165 and _theta <= 195): _oclock = 6

?(_theta > 195 and _theta <= 225): _oclock = 5

?(_theta > 225 and _theta <= 255): _oclock = 4

?(_theta > 255 and _theta <= 285): _oclock = 3

?(_theta > 285 and _theta <= 315): _oclock = 2

?(_theta > 315 and _theta <= 345): _oclock = 1

_oclock = 12

_height = "Low"

?_z2 > _z1: _height = "High"

(_helo select 0) vehiclechat format ["%1 Missile %2 OClock %3 %4 Meters",_weaponname,_oclock,_height,_range]

(_helo select 0) vehicleradio "PRACS_Mirage3_miswarn"

_rand = 10

_chance1 = 28

_chance2 = 56

?(_helo select 0) animationphase "flarecount" <= 0: _rand = 20; _chance1 = 21; _chance2 = 42

_helo exec "\PRACS_Mirage3\scripts\flarelaunch.sqs"

?(random 100 < _rand): exit

@ (_missile distance (_helo select 0)) <100 || !alive _missile

?!alive _missile: exit

_missile setdir (direction _missile + _chance1 - random _chance2)

Edited by W0lle

Share this post


Link to post
Share on other sites

sorry guys i was reading 2 threads at the same time....

Share this post


Link to post
Share on other sites

how about checking targets near missile and then randomly selecting by distance or brightness or so then replacing,setVector and setVelocity the missile with the same class but because its replaced it shouldnt have a lock anymore and go astray... ?

(the more flares, the more likely it will go astray... the only stuff left for the plane/helo would be a incomingMissile EventHandler and the pure opticalFX for flares, the spoofscript interacts/interferes directly with the missile)

I can post some scripts concepts next week in the new forums, if you like...

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  

×