Jump to content

How to make a nuke box?


Recommended Posts

Can anyone help me on how to assign object as a nuke, so that it explodes on destruction? I want to make something similar to retrieve a nuke mission on AWE. What I am even more curious about is: can I set that up on the fly with achilles?

Link to comment
Share on other sites

RHS has some built in functions for this, which are leveraged in the nuke mission.  You've already got Gauntlet on your computer in your mpmissions folder, so all you need to do is get a program which can unpack the pbo (if you get Eliteness, or Mikeros' pack of utilities, or PBO Manager, any of these will allow this) and then find the specific submission for the nuke - I think it's called findNuke.sqf.  The code for how to do it is in there.  You can tweak various values to determine how far the effect will extend, but I don't advise setting it much above 1000, as it destroys every building in the effect radius and those destroyed buildings impact on server performance.

Link to comment
Share on other sites

Thanks, I took a peek inside and I will experiment with it once I get the time. Can you explain to me what that part means?


missionTrigger2 setTriggerStatements ["time > countdown || !(alive nuke)", "
	{	[[(getPos nuke),500,500],_x,true,false,false] call BIS_fnc_MP;
	}	foreach [
	[[missionPos,500,500],'rhs_fnc_ss21_nuke_fx_damage',false] call BIS_fnc_MP;
	['fail','The bomb detonated!'] execVM 'scripts\core\missionNext.sqf';
", ""];


If i understand correctly, this is the actual detonation, and "nuke" is the variable attached to the object. What do the "_x" and "500"s mean?

The last two are yield and radius, what about the first two?


EDIT: I feel like realisation struck me. I will check tomorrow, though I'd still appreciate clarification.

Link to comment
Share on other sites

In this context, _x refers to each of the functions referenced in the forEach command.  So what is happening is the server is using the BIS_fnc_MP function to call each of the rhs_fnc_ss21_nuke_fx_smoke, rhs_fnc_ss21_nuke_fx_light, rhs_fnc_ss21_nuke_fx_shockwave, and rhs_fnc_ss21_nuke_fx_postprocessing functions on each player's computer.  500 refers to the radius - probably the X-value and the Y-value, so technically you could make an oval if one was bigger than the other.


What's happening here is that the script runs four functions across every player's computer: the smoke effect, the light effect, the shockwave effect, and a post-processing effect. They are run separate from a fifth function, rhs_fnc_ss21_nuke_fx_damage, which applies damage to players in the blast area, because it is run only on the server while the first four are run on each client computer.


Looking at this code I can see it could be much better optimized as BIS_fnc_MP is a very old command that's been supplanted by newer scripting commands.  If I was doing it now, I'd probably do it like this:


{	[(getPos nuke),500,500] remoteExec [_x, 0, false]; } foreach ['rhs_fnc_ss21_nuke_fx_smoke', 'rhs_fnc_ss21_nuke_fx_light', 'rhs_fnc_ss21_nuke_fx_shockwave', 'rhs_fnc_ss21_nuke_fx_postprocessing'];
[(getPos nuke),500,500] spawn rhs_fnc_ss21_nuke_fx_damage;

Also sloppy of me to use missionPos in that statement - should be getPos nuke in both instances.

Link to comment
Share on other sites

Thanks for the help. I got it work. Also, you CAN make it work on an empty mission with no files attached, using only achilles :D Which is absolutely amazing to me and just what I needed. Also, you can't make an oval, because the first value is the yield and second is radius. So typing 500, 10 will give you a really big explosion that only damages things within 10meters (it seems).

Link to comment
Share on other sites

Right. After I typed that I seemed to recall something about yield and Radius. 


Yes, as long as you have the ability to execute code and a position to reference, that's all you need. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Forum Statistics

    Total Topics
    Total Posts
  • Create New...