Jump to content
Sign in to follow this  
fodnow

Attach script to bomb on plane

Recommended Posts

call {[this] execvm "leerkfz.sqf"; [this, 30] execvm "nuclear\geiger.sqf"}; this addaction [localize "STR_NuclearActive", "nuclear\nuclear.sqf"];

I have this script, for a nuke mod, and right now what it does is make the vehicle/object it's attached to a bomb that can be remotely detonated. Is there any way to make it so that you can attach this to a JDAM bomb of a plane, and make it detonate upon impact? Even if the detonation on impact isn't possible, I'd be fine with still having to activate it via remote. I know very little about scripting in Arma, so I signed up on here to ask. I don't know if this is the right thread to reply to, but I can't make a new thread yet, so if it isn't I'm sorry.

Thanks!

tl;dr

What do I need to change in this script to make it attach to a JDAM bomb rather than the vehicle itself?

Share this post


Link to post
Share on other sites

Research Fired Eventhandler

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired

Run a fired eventhandler on the plane and have the fired EH script check for the type of munitions fired.

You can return magazine, ammo and even the projectile

If its a JDAM then run code

something like

_ammo = _this select 4;

_mag = _this select 5;

_bomb = _this select 6; // (Projectile returned from the fired EH

if !((ToUPPER _mag)==("YOUR_JDAM_MAGAZINE_CLASSNAME_IN_UPPERCASE"))exitwith{};

waituntil {! alive _bomb}; // it just blew up

// Run your Nuke code

[_bomb] execVM "NukeEffect.sqf";

-------------------

// position for bomb nuke effect = getpos _this select 0

_NukePos = getpos (_this select 0);

// following for air burst if you wanted that

// waituntil {(getposATL _bomb) select 3 < 70};

// deletevehicle _bomb;

When the aircraft fires , it will check if it is a jdam magazine and if not exit, if it is, it will continue to run the script, waiting for the bomb to explode then it will run whatever your nuke script is.

Edited by Terox

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  

×