Jump to content
Sign in to follow this  
Noble Gas

Need help with a Bomb

Recommended Posts

First off, Hello, I'm new here, new to scripting, and in general, new to ArmA and PC gaming as a whole. Nevertheless, I LOVE A3, and have dived into the scripting stuff!

With your help, I've put together simple missions, added respawns, revives, ammo boxes, and even enemy patrols, all in a language I didn't know a thing about a month ago! COMPUTERS!

I have been referencing this community for help putting my stuff together, and you have been a great resource, but alas, finally, something I cannot find: A big ole Terrorist bomb.

If someone could tell me how to go about making a Bomb that has a timer (longer than 40 seconds), is activated by player proximity, and can only be disarmed by an explosive specialist, I would be very appreciative.

All I keep seeing are IED's and stuff. I hope this is appropriate, and I understand that you can't just handhold people through this stuff, but I just need someone with experience and know how to give me some direction.

Teach a man to fish, and all that jazz.

Thanks

Share this post


Link to post
Share on other sites

I'm not sure, because i cant test it here on this computer, but try this way.

init:

_activedbomb = this addAction ["actived bomb", "bomb.sqf"]

bomb.sqf

_trap = _this select 0;
_guy = _this select 1;
_activedbomb = _this select 2;
disarm = 0;

cutText ["You have actived a bomb. They will blow up in 40 secounds","PlAIN DOWN",1];
_trap removeAction _activedbomb; //the activionmenu is deleted right now

for [{_i=0}, {_i<40}, {_i=_i+1}] do
{
if (disarm == 1) exitwith {disarm = 0;};
if (player == exposiveman) then  //give the ID "expolsiveman" to the choosen one, who can disarm bombs
{ _disarmbomb = _trap addaction ["disarm bomb", "disarm.sqf"];
};
sleep 1;
};
_bomb = createVehicle "r_80mm_he" (getPos _trap);
deleteVehicle _trap;

disarm.sqf

_trap = _this select 0;
_guy = _this select 1;
_disarmbomb = _this select 2;
_trap removeAction _disarmbomb;
disarm = 1;
cutText ["You have disarm this bomb.","PlAIN DOWN",1];

the value disarm is 0 at the beginnig. That's why the counter is running. When the specalist calling the disarmscript, the value 0 switch to 1. dont mke this "_disarm". It's a global one, because there are two scripts, they need this variable.

exitwith {disarm = 0} ... that's needed, because a terrosrist can place a new one. Without this, the value is 1 and the next bomb script will break.

Sorry for my bad english...

I hope it works on this way

B_soldier_exp_F = the classname of explosive specalist. I know there is a way to check out, is the caller (_this select 1) a member of this class.

maybe this wayInstead of if (player == exposiveman) then

try:

if (_guy isKindOf "B_soldier_exp_F") then..

Edited by Drunken Officer

Share this post


Link to post
Share on other sites

Thanks so much. When I get home, I'll try it out.

I'll let y'all know how it works.

edit: do I put a marker or game logic or something where I want the bomb?

Edited by Noble Gas

Share this post


Link to post
Share on other sites

???

You have to place a object. Maybe a emty car (hidden bomb like a terror act). And there is a init-line. (a black box, where you can type in)

In this init-line you type in:

_activedbomb = this addAction ["actived bomb", "bomb.sqf"]

Your question was, how to make a bomb with time counter and a option to disarm it. Or should it possible, that the terrorist can place a bomb on his position?

If you wanna have a marker on your bomb spot, there are 2 way. Create one with script or:

set a marker in your editor and call them "ma_bomb". (without ""). But it's easy to find it, because the bomb is in the marker centre. But you can create the marker postion random about the bomb. like this: http://www.youtube.com/watch?v=AjVLGSjVaVw

in you missionfolder create a file init.sqf

"ma_bomb" setMarkerAlpha 0; // marker is invisible

add this in your bomb.sqf

"ma_bomb" setMarkerPos (getPos _trap); //move the marker to your bomb spot
"ma_bomb" setMarkerAlpha 1; // make the marke visible

in your disarm.sqf

"ma_bomb" setMarkerPos [0,0,0]; //move it away
"ma_bomb" setMarkerAlpha 0; // make the marke invisible

Share this post


Link to post
Share on other sites

Ok, so I appreciate the help, so much, but I am running into some problems.

This is what I have for my bomb.sqf

_trap = _this select 0;
_guy = _this select 1;
_activedbomb = _this select 2;
disarm = 0;

cutText ["You have activated a bomb. You have 40 seconds to disarm it.","PlAIN DOWN",1];
_trap removeAction _activedbomb; //the activionmenu is deleted right now

for [{_i=0}, {_i<40}, {_i=_i+1}] do
{
if (disarm == 1) exitwith {disarm = 0;};
if (_guy isKindOf "B_soldier_exp_F") then  //give the ID "expolsiveman" to the choosen one, who can disarm bombs
{ _disarmbomb = _trap addaction ["disarm bomb", "disarm.sqf"];
};
sleep 1;
};
_bomb = createVehicle "M_Mo_82mm_AT_LG" (getPos _trap);
deleteVehicle _trap;

The main issue here, is that after 40 seconds, if no one tries to disarm the bomb, there is still no explosion. Perhaps it is the last line "deleteVehicle_trap"? maybe _bomb instead?

The next issue is that when the bomb is activated, the "disarm" prompt starts to fill up the menu, until about 40 "disarm" options exist in the scroll menu. perhaps this has to do with the placement of the "I<40" line?

Lastly, I'd like the bomb to be triggered by the arrival of Blufor units. Right now, it requires someone to walk up to it and select"the arm prompt. (which I like, because I think I can just change the prompt to something else, like, "turn on computer"or something, but I still need a proximity activated bomb.) perhaps that could be done by placing a trigger in the editor?

On the bright side, the part of the script that makes it so only Explosive specialist can disarm the bomb works! So that's a start. Any suggestions?

Share this post


Link to post
Share on other sites

Sorry dude, i forgot one scope break. here are the script codes. I tested it and it works for me:

bomb.sqf

private ["_trap","_guy","_timer"];

_trap = _this select 0;
_guy = _this select 1;
_activedbomb = _this select 2;
_timer = 30; //if you use parameters, the script can handle your setting. Just change this line
cutText ["You have actived a bomb. They will blow up in 10 secounds","PLAIN DOWN",1];
_trap removeAction _activedbomb; //the activionmenu is deleted right now
if [b](_guy isKindOf "B_soldier_exp_F")[/b] then {_disarmbomb = _trap addaction ["disarm bomb", "scripte\disarm.sqf"];}; // only exp specialist have the disarm menu and can use it

while {_timer != 0} do
{
if (!isNil"IED_remove") exitWith {};
sleep 1;
player sideChat format ["%1",_timer]; // Line with counter
_timer = _timer - 1;
};
if (!isNil"IED_remove") exitWith {};
_granate = createVehicle ["r_80mm_he",[getPos _trap select 0, getPos _trap select 1],[], 0, 'FLY']; //it's arma.. the "old" line i posted first, i use in a2 and used by a trigger. idk, why the granade needs this arry?!
deleteVehicle _trap;

disarm.sqf

private ["_trap","_guy"];
_trap = _this select 0;
_guy = _this select 1;
_disarmbomb = _this select 2;
_trap removeAction _disarmbomb;
IED_remove = 1;
cutText ["You have disarm this bomb.","PLAIN DOWN",1];
sleep 2;
IED_remove = nil;

Sorry for the wrong disarm entry in my first post. It was late at night. Anyway. Try this 2 script. For me it works. Let me know if something wrong or if you have any questions.

Edited by Drunken Officer

Share this post


Link to post
Share on other sites

OK, everything seems to be working fine. Thank you so much for your help! If it's okay with you, I'd like to add your name to the credits in my mission file. :)

If you've got a moment, one last question:

How do I start the bomb from a trigger?

Share this post


Link to post
Share on other sites

When Blufor is near.

basically, I want to put down a trigger in a room that activates the bomb.sqf when a blufor unit enters and then the blufor have to disarm it.

Edited by Noble Gas

Share this post


Link to post
Share on other sites

Okay, you need a small item. Whatever and place it there. Name it "hiddenbomb". (small black box in your editor)

Place your trigger to your hidden bomb, maybe 10 / 10, activation by blufor, once time.

Condition: this

onAct: handle = [] execVM "scripte\bomb.sqf";

bomb.sqf

_trap = hiddenbomb;
_timer = 10;
_guy = player;
cutText ["Click! \n Fuck, something is wrong!","PLAIN",1];
if (_guy isKindOf "B_soldier_exp_F") then {_disarmbomb = _trap addaction ["disarm bomb", "scripte\disarm.sqf"];};
while {_timer != 0 } do
{
if (!isNil"IED_remove") exitWith {};
sleep 1;
player sideChat format ["%1",_timer];
_timer = _timer - 1;
};
if (!isNil"IED_remove") exitWith {};
_granate = createVehicle ["r_80mm_he",[getPos _trap select 0, getPos _trap select 1],[], 0, 'FLY'];
deleteVehicle _trap;

disarm.sqf is the same one

I placed my bodytraps without any trigger. I've a script, that checks, if a bluefor near or not. So i dont need trigger for the hiddenbombs. It show you a message, that a bomb is spotet and if you are the close > ka boom

Edit

Forgot to say. With my script, you can not disarm the bomb, before it's spoted. The distance between spotting and expolding is changeable. You can set a lot of hiddenbombs, without to named it. That why i think, it's not the best way to use triggers, when you place more than 3 or 5 hidden bombs

Edited by Drunken Officer

Share this post


Link to post
Share on other sites

Very excited to see how this works. I appreciate your time and effort. It feels like you're doing all the work, but I'm also learning along the way, so while I feel embarrassed to be asking all these questions, I'm also very happy to be in the scripts, changing this and that, figuring stuff out. I'm going to look into some additional resources and see if I can figure the rest on my own, so I don't have to keep bugging you for hints. Thanks again! :)

Share this post


Link to post
Share on other sites

EXCELLENT!!!

Everthing works as planned now. Here is the final bomb.sqf I'm running:

_trap = hiddenbomb;
_timer = 10;
_guy = player;
cutText ["Bomb has been armed ","PLAIN",1];
if (_guy isKindOf "B_soldier_exp_F") then {_disarmbomb = _trap addaction ["disarm bomb", "disarm.sqf"];};
while {_timer != 0 } do
{
if (!isNil"IED_remove") exitWith {};
sleep 1;
player sideChat format ["%1",_timer];
_timer = _timer - 1;
};
if (!isNil"IED_remove") exitWith {};
_granate = createVehicle ["r_80mm_he",[getPos _trap select 0, getPos _trap select 1],[], 0, 'FLY'];
deleteVehicle _trap; 

That's for the proximity activated bomb, which works great with an object in the game, named "hiddenbomb", and a trigger that runs

act on: null=[] execvm "bomb.sqf"

Thanks a million, and your name is going in the "Thanks" of the mission for sure!

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  

×