Jump to content
Sign in to follow this  
adrian72uk

disarm a bomb

Recommended Posts

is there a way were I can get a script to a object like a suitcase and when you click on it it says do you want to cut the blue wire or the red wire and have it random pick a colour of the wire and if it pick the wrong one it blows up

Share this post


Link to post
Share on other sites

You could use scripting to add actions to the suitcase, and then have a script randomly pick what happens with the bomb(explodes or defuses). That's how I would do it anyways, not sure how others here might handle it.

Share this post


Link to post
Share on other sites

could you do it in a template as I not very good at scripting just got use to using and putting briefing/task into missions

Share this post


Link to post
Share on other sites

Yup, set the color when you place the item randomly. Attach addActions to it. Enjoy.

Share this post


Link to post
Share on other sites
Yup, set the color when you place the item randomly. Attach addActions to it. Enjoy.

sorry you loss me

how I set the colour how I make it blow up and how do I make it pick the blue wire or the red wire with just attach add action ,like I said not very good with scripts and stuff

Share this post


Link to post
Share on other sites

Here you go:

bomb object init line:

null = this execVM "actions.sqf";

actions.sqf

red = *insert object name here* addAction ["<t color='#ED2744'>Cut Red Wire</t>","bomb.sqf", nil, 6, false, True, "", "(_target distance _this) < 2"];
blue = *insert object name here* addAction ["<t color='#003366'>Cut Blue Wire</t>","bomb.sqf", nil, 6, false, True, "", "(_target distance _this) < 2"];

bomb.sqf

_bomb = _this select 0;
_cutter = _this select 1;
_id = _this select 2;

*insert object name here* removeAction red;
*insert object name here* removeAction blue;

_chance = random floor (10);

if(_chance >= 5) then
{
*insert object name here* setDamage 1;
_bomb = "R_60mm_HE" createVehicle (position *insert object name here*);
}else
{
hint "bomb disarmed";
};

Thats been working for me. If you want to change the size of the explosive, just edit the classname of the explosive.

Share this post


Link to post
Share on other sites

Here's how I might do it. Place a suitcase named suitCase on the map somewhere.

init.sqf:

YellowText	= {"<t color='#fcf304'>" + _this + "</t>"};
BlueText	= {"<t color='#1e90ff'>" + _this + "</t>"};
RedText	= {"<t color='#ff0000'>" + _this + "</t>"};

_blueWire = suitCase addaction ["Cut Blue Wire" call BlueText,"disarm.sqf", ["BLUE"]];
_yellowWire = suitCase addaction ["Cut Yellow Wire" call YellowText,"disarm.sqf", ["YELLOW"]];
_redWire = suitCase addaction ["Cut Red Wire" call RedText,"disarm.sqf", ["RED"]];

if (isServer) then {
_wires = ["RED", "YELLOW", "BLUE"];
suitCase setVariable ["wireColor", _wires call BIS_fnc_selectRandom, true];
};

disarm.sqf:

_suitcase = [_this, 0] call BIS_fnc_param;
_wireGuess = [_this select 3, 0] call BIS_fnc_param;
_wireActual = _suitcase getVariable "wireColor";

if (_wireGuess == _wireActual) then {
sleep 0.4;
hint "Disarmed!";
} else {
sleep 0.6;
_oops = createVehicle ["M_Mo_82mm_AT", getPos _suitcase, [], 0, ""];
};

deleteVehicle _suitcase;

Share this post


Link to post
Share on other sites

thanks I try both ways and it not working can you put it in a small missions then I can upbo and see what I done wrong please

---------- Post added at 21:18 ---------- Previous post was at 21:00 ----------

what I done I got a suitcase and call it suitcase put this in the init line of the suitcase

null = this execVM "actions.sqf";
then I made 2 SQF files with these in it
red = *suitcase* addAction ["<t color=#ED2744'>Cut Red Wire</t>","bomb.sqf", nil, 6, false, True, "", "(_target distance _this) < 2];

blue = *suitcase* addAction ["<t color=#003366'>Cut Blue Wire</t>","bomb.sqf", nil, 6, false, True, "", "(_target distance _this) < 2];

and the other one with this in it
_bomb = _this select 0;

_cutter = _this select 1;

_id = _this select 2;

*suitcase* removeAction red;

*suitcase* removeAction blue;

_chance = random floor (10);

if(_chance >= 5) then

{

*insert object name here* setDamage 1;

_bomb = "R_60mm_HE" createVehicle (position *suitcase*);

}else

{

hint "bomb disarmed";

};

and name them what you said but still no joy

Share this post


Link to post
Share on other sites

That's not working because you have *suitcase* instead of the name of the suitcase. You'd need to replace the *insert * stuff with the names of the suitcase

Try my version. :)

Share this post


Link to post
Share on other sites

Yeah, I'd go with kylania's(hes a scripting master or something) and he has helped me multiple times on my own projects. His also only involves placing the object and naming it correctly, and then adding the scripts, whereas mine requires more work done to make it run properly.

Share this post


Link to post
Share on other sites

What is the error you are getting? And are you sure it is the init.sqf? When I copied it over, the init only had 12 lines, not 13.

Share this post


Link to post
Share on other sites
Here's how I might do it. Place a suitcase named suitCase on the map somewhere.

init.sqf:

YellowText	= {"<t color='#fcf304'>" + _this + "</t>"};
BlueText	= {"<t color='#1e90ff'>" + _this + "</t>"};
RedText	= {"<t color='#ff0000'>" + _this + "</t>"};

_blueWire = suitCase addaction ["Cut Blue Wire" call BlueText,"disarm.sqf", ["BLUE"]];
_yellowWire = suitCase addaction ["Cut Yellow Wire" call YellowText,"disarm.sqf", ["YELLOW"]];
_redWire = suitCase addaction ["Cut Red Wire" call RedText,"disarm.sqf", ["RED"]];

if (isServer) then {
_wires = ["RED", "YELLOW", "BLUE"];
suitCase setVariable ["wireColor", _wires call BIS_fnc_selectRandom, true];
};

this is my Init with out yours

// JIP Check (This code should be placed first line of init.sqf file)

if (!isServer && isNull player) then {isJIP=true;} else {isJIP=false;};

// Wait until player is initialized

if (!isDedicated) then {waitUntil {!isNull player && isPlayer player};};

// INS_revive initialize

[] execVM "INS_revive\revive_init.sqf";

// Restrict 3rd person view for infantry

//_null = [] execVM "Launchthirdperson.sqf";

null = execVM"briefing.sqf";

/*

* Inital Mission Parameters!

*/

null = execVM "Functions.sqf";

if(isServer || isDedicated) then{

//Clear wrecks from the base.

_handle = [] execVM "Scripts\clearVehicleWrecks.sqf";

};

//Vehicle anti spawn-spam protection.

_handle = [] execVM "Scripts\spawnDelay.sqf";

//Clear bodies from the map

_null = [] execVM "Scripts\clearBodies.sqf";

//Pilot Check

_null = [] execVM "Scripts\pilotCheck.sqf";

//Starts the TPWCAS

null = [2] execvm "tpwcas\tpwcas_script_init.sqf";

_x setSkill ["aimingspeed", 0.5];

_x setSkill ["spotdistance", 0.9];

//_x setSkill ["aimingaccuracy", 0.00000000000000000000000000231654321654686532136];

_x setSkill ["aimingaccuracy", 0.00002];

//_x setSkill ["aimingshake", 0.00000000000000000000000000000000332165413216541321541321];

_x setSkill ["aimingshake", 0.0000005];

_x setSkill ["spottime", 0.8];

_x setSkill ["commanding", 0.9];

_x setSkill ["general", 0.9];

} forEach allUnits;

so with your is will look like this right

// JIP Check (This code should be placed first line of init.sqf file)

if (!isServer && isNull player) then {isJIP=true;} else {isJIP=false;};

// Wait until player is initialized

if (!isDedicated) then {waitUntil {!isNull player && isPlayer player};};

// INS_revive initialize

[] execVM "INS_revive\revive_init.sqf";

// Restrict 3rd person view for infantry

//_null = [] execVM "Launchthirdperson.sqf";

null = execVM"briefing.sqf";

/*

* Inital Mission Parameters!

*/

null = execVM "Functions.sqf";

if(isServer || isDedicated) then{

//Clear wrecks from the base.

_handle = [] execVM "Scripts\clearVehicleWrecks.sqf";

};

//Vehicle anti spawn-spam protection.

_handle = [] execVM "Scripts\spawnDelay.sqf";

//Clear bodies from the map

_null = [] execVM "Scripts\clearBodies.sqf";

//Pilot Check

_null = [] execVM "Scripts\pilotCheck.sqf";

//Starts the TPWCAS

null = [2] execvm "tpwcas\tpwcas_script_init.sqf";

_x setSkill ["aimingspeed", 0.5];

_x setSkill ["spotdistance", 0.9];

//_x setSkill ["aimingaccuracy", 0.00000000000000000000000000231654321654686532136];

_x setSkill ["aimingaccuracy", 0.00002];

//_x setSkill ["aimingshake", 0.00000000000000000000000000000000332165413216541321541321];

_x setSkill ["aimingshake", 0.0000005];

_x setSkill ["spottime", 0.8];

_x setSkill ["commanding", 0.9];

_x setSkill ["general", 0.9];

} forEach allUnits;

YellowText = {"<t color='#fcf304'>" + _this + "</t>"};

BlueText = {"<t color='#1e90ff'>" + _this + "</t>"};

RedText = {"<t color='#ff0000'>" + _this + "</t>"};

_blueWire = suitCase addaction ["Cut Blue Wire" call BlueText,"disarm.sqf", ["BLUE"]];

_yellowWire = suitCase addaction ["Cut Yellow Wire" call YellowText,"disarm.sqf", ["YELLOW"]];

_redWire = suitCase addaction ["Cut Red Wire" call RedText,"disarm.sqf", ["RED"]];

if (isServer) then {

_wires = ["RED", "YELLOW", "BLUE"];

suitCase setVariable ["wireColor", _wires call BIS_fnc_selectRandom, true];

};

does this look right

---------- Post added at 08:18 ---------- Previous post was at 07:51 ----------

ok did this and when I walk upto the suitcase there is nothing showing up

Share this post


Link to post
Share on other sites
I get an error on line 13 of my init sqf i copied the txt from kylanias post ???

Yeh I put the disarm sqf code in with the init :rolleyes: works perfectly now, thanks

Share this post


Link to post
Share on other sites
Yeh I put the disarm sqf code in with the init :rolleyes: works perfectly now, thanks

You put the code from disarm.sqf inside init.sqf so you only have 1 file? :confused:

---------- Post added at 10:15 AM ---------- Previous post was at 09:49 AM ----------

Here's a short demo of my method.

Share this post


Link to post
Share on other sites
what the biggest explosive you can have

so anybody know which is the biggest explosive I can attached to this bit

[M_Mo_82mm_AT"
need it bigger as when I put it in a house and we pick the wrong wire it does very little damage to us if we are over it

Share this post


Link to post
Share on other sites

Anyone know how to add a distance restriction on the menu action from kylania notes? FOr example, using the script as is above allows me to bring up the menu from a far distance, I would like to make it so you need to be within a meter or so. Thanks!

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  

×