Jump to content
Sign in to follow this  
king homer

Proximity-fuse script

Recommended Posts

Hey, I've got a problem with this proximity-fuse script for a specified shell. When the MPAT shell is passing an airvehicle the script should create the drop effect and the shell "INQ_Mpat120_AB" at the same position, the problem: The shell won't explode, it will be created at the same position but it falls down to the ground and detonates there. But it should explode in the air to damage the airvehicle... Anyone knows how to fix that?

Quote[/b] ]_Bull = _this select 0

_Owner = _this select 1

_Gun = _this select 2

_NN = "HeliHEmpty" camcreate [0,0,0]

_NN setpos [0,0,-1000]

#loop

_gp = getpos _bull

_dir = getdir _bull

_nO = nearestObject [(_gp select 0)+(sin _dir*8),(_gp select 1)+(cos _dir*8),_gp select 2]

player globalchat format["%1",[_gp,_no,_dir,_bull]]

? (!alive _Bull): goto "Boom"

? "air" countType [_nO] == 0 or _nO distance _Bull > 15: goto "loop"

_P1 = getPos _NN

_P2 = getPos _Bull

_dis = sqrt(((abs((_P1 select 0)-(_P2 select 0)))^2)+((abs((_P1 select 1)-(_P2 select 1)))^2))

_dis = sqrt (abs(((_NN distance _Bull)^2)-(_dis^2)))-1000

?(_dis<0): _dis=0

_helper = "INQ_Mpat120_AB" camcreate[0,0,10]

_helper setpos [_P2 select 0,_p2 select 1,_dis]

_helper setdammage 1

_Bull setdammage 1

#boom

drop ["halflight", "", "Billboard",1,1, _gp, [random 1, random 1, random

1],1,0.008,0.007,0.1,[15,12,3],[[1,0.5,0,1],[1,0.5,0,1],[1,0.5,0,0.5],[1,1,0,0]],[0,1,0],0

.5,0.05,"", "", ""]

drop ["halflight", "", "Billboard",1,1, _gp, [random 1, random 1, random

1],1,0.008,0.007,0.1,[10,25,15],[[1,1,1,1],[1,1,1,1],[1,1,1,0.3],[1,1,1,0]],[0,1,0],0.5,0.

05,"", "", ""]

DeleteVehicle _NN

Regards

Homer

Share this post


Link to post
Share on other sites

instead of

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_helper = "INQ_Mpat120_AB" camcreate[0,0,10]

_helper setpos [_P2 select 0,_p2 select 1,_dis]

_helper setdammage 1

_Bull setdammage 1

Try this

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

_helper = "INQ_Mpat120_AB" camcreate[0,0,10]

_helper setpos [_P2 select 0,_p2 select 1,_dis]

_fuze1 = "FxExploGround1" camcreate getpos _helper

_fuze2 = "FxExploGround1" camcreate getpos _Bull

that will make "mid air" explosion for both _helper and _Bull shells without them falling on the ground.

Share this post


Link to post
Share on other sites

Ok thanks for your input, it's working now.

Just another question: Is the _helper still needed now? Because the "FxExploGround1" created at the _Bull position is strong enough to blow up every helicopter. And there is still some explosion on the ground, where does that come from? I'm no scripting genius, so I don't know how to get rid of that. :-/

Share this post


Link to post
Share on other sites

the _helper object should not be needed, unless you need it for some reasons.

The explosion that you see on the ground is the result of the area of effect of the explosion happening in mid air.

If this area of effect of an ammo exploding is large enough to be able to touch the ground, a second explosion can be seen, that's how the OFP engine behave.

To prevent this, reduce the indirectHitRange=... of the ammo used for _Bull , as it is what is defining in the OFP engine how large the area of effect of an explosion is.

By example , if the explosion occurs at an altitude of 15m and the indirectHitRange of you _Bull ammo is 20 , a secondary ground explosion will happen some 0.001 seconds after the normal mid air one.

Share this post


Link to post
Share on other sites

The problem: I can't increase or decrease the indirecthitrange of _Bull. That's why I wanted to create the "INQ_Mpat120_AB" at the position and let it explode instead of the normal _Bull. Indirecthitranges of both shells are different, the INQ_Mpat120_AB just should affect airvehicles and be harmless for groundvehicles.

Share this post


Link to post
Share on other sites

Use a 'detonator' object like the one Hudson & Pennywise used in their F-18 and you're done. This object is basicly a missile with 0 hit power, but with a defined fire geometry (a large enough cube, for simplicity).

Just setpos it in the ammo position and it will detonate the ammo. For maximum accuracy, use a function to do that.

Share this post


Link to post
Share on other sites
Use a 'detonator' object like the one Hudson & Pennywise used in their F-18 and you're done. This object is basicly a missile with 0 hit power, but with a defined fire geometry (a large enough cube, for simplicity).

Just setpos it in the ammo position and it will detonate the ammo. For maximum accuracy, use a function to do that.

That is a seriously tidy solution. I like it thumbs-up.gif

Share this post


Link to post
Share on other sites

Or just create TWO shells at the same point in the air. That's how most flak/AAA scripts I've seen work. I don't know if this results in the explosion doing double damage (from double the shells) though.

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  

×