Jump to content
Sign in to follow this  
richiespeed13

How do i trigger an explosion in the editor?

Recommended Posts

Hey fellas,

I'm working on a mission where me and my squad is ambushed. What i want to happen, is as my squad moves past a car it explodes, a bit like an IED.

I know this is going to require scripting/commandlines of some sort, but could anyone tell me how to do this?

Any help gratefuly apreciated,

Rich.

Share this post


Link to post
Share on other sites

The best way is to create a grenade/rocket/bomb (depending on the strength you want) on top of the vehicle:

"Bo_GBU12_LGB" createVehicle getPos bombcar;

The above will spawn an LGB on vehicle called bombcar

Share this post


Link to post
Share on other sites
"Bo_GBU12_LGB" createVehicle getPos bombcar;

How do you get it to work like that? This is the only way I get the above to work:

bomb = "Bo_GBU12_LGB" createVehicle getPos bombcar;

Also to get an explosion to happen over a marker you use:

bomb = "Bo_GBU12_LGB" createVehicle getmarkerPos "makername";

Share this post


Link to post
Share on other sites
The best way is to create a grenade/rocket/bomb (depending on the strength you want) on top of the vehicle:

"Bo_GBU12_LGB" createVehicle getPos bombcar;

The above will spawn an LGB on vehicle called bombcar

I see, thanks!

But now could you tell me what field of what unit to put that in, and how to make the explosion happen via a triggered event?

Thanks!

---------- Post added at 09:47 PM ---------- Previous post was at 09:46 PM ----------

How do you get it to work like that? This is the only way I get the above to work:

bomb = "Bo_GBU12_LGB" createVehicle getPos bombcar;

Also to get an explosion to happen over a marker you use:

bomb = "Bo_GBU12_LGB" createVehicle getmarkerPos "makername";

Thanks, mate, i posted my question above ^^

Share this post


Link to post
Share on other sites

But now could you tell me what field of what unit to put that in, and how to make the explosion happen via a triggered event?

That depends on the event, you can set a trigger to go off anyway you can imagine really, but it takes a bit of searching to find the code for the more complicated stuff.

Example;

Say you want a bomb to go off when a soldier walks over a certain area, simulating an anti-personnel mine. You start off placing a trigger where you want it to be activated. You then set how big you want the area of activation you want, for this it would be quite small, between 2 and 5 maybe. Then you set who you want to set it off. For this it would be anyone, so you set activation to 'Anybody'. Then in the 'On Activation' box you add the line:

bomb = "Bo_GBU12_LGB" createVehicle getmarkerPos "explosion";

You also need to add a marker where you want to set off the bomb and name the marker something suitable, make sure it is the same as in the code you put in the trigger.

I would suggest playing around with triggers as it doesn't take long to figure out the basics. For instance you could group the trigger to a single unit, so only that unit will set it off. Or you can change the activation to 'Radio Alpha' so you set it off using the radio. Click 'Repeatedly' to set it off over and over again.

As stated before you can use the same trigger to set it of on top of a unit using:

bomb = "Bo_GBU12_LGB" createVehicle getPos bombcar

Just remember to make sure the name of the unit you want to blow up and the name in trigger (in bold) are the same. For me this is why most of the stuff I try doesn't work as spelled the name differently for each item.

"Bo_GBU12_LGB" is a little big for a this purpose but right now I can't get anything smaller to work, I don't whether it's the weapon name or the 'bomb' bit at the front. In Arma I used this technique to get bullet implacts where ever you want them, but i never got round to making any proper movies to use it in.

Hope that helps and I look forward to what you do with it.

Share this post


Link to post
Share on other sites

Thanks mate that did the trick! Here is my final result:

<object width="560" height="340"><param name="movie" value="http://www.youtube.com/watch?v=F5L5UaBFtbM&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/watch?v=F5L5UaBFtbM&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>

Share this post


Link to post
Share on other sites

For instance you could group the trigger to a single unit, so only that unit will set it off.

How do you do this??? are you just syncronising the trikker whit a sertin unit. ???

Share this post


Link to post
Share on other sites
That depends on the event, you can set a trigger to go off anyway you can imagine really, but it takes a bit of searching to find the code for the more complicated stuff.

Example;

Say you want a bomb to go off when a soldier walks over a certain area, simulating an anti-personnel mine. You start off placing a trigger where you want it to be activated. You then set how big you want the area of activation you want, for this it would be quite small, between 2 and 5 maybe. Then you set who you want to set it off. For this it would be anyone, so you set activation to 'Anybody'. Then in the 'On Activation' box you add the line:

bomb = "Bo_GBU12_LGB" createVehicle getmarkerPos "explosion";

You also need to add a marker where you want to set off the bomb and name the marker something suitable, make sure it is the same as in the code you put in the trigger.

I would suggest playing around with triggers as it doesn't take long to figure out the basics. For instance you could group the trigger to a single unit, so only that unit will set it off. Or you can change the activation to 'Radio Alpha' so you set it off using the radio. Click 'Repeatedly' to set it off over and over again.

As stated before you can use the same trigger to set it of on top of a unit using:

Just remember to make sure the name of the unit you want to blow up and the name in trigger (in bold) are the same. For me this is why most of the stuff I try doesn't work as spelled the name differently for each item.

"Bo_GBU12_LGB" is a little big for a this purpose but right now I can't get anything smaller to work, I don't whether it's the weapon name or the 'bomb' bit at the front. In Arma I used this technique to get bullet implacts where ever you want them, but i never got round to making any proper movies to use it in.

Hope that helps and I look forward to what you do with it.

Thanks for that mini tutorial, i'm very new to this editor but i actually got something working thanks to you :p

A question though: where do i find the name of the bomb i wanna use, where did you get the bomb name "Bo_GBU12_LGB" from?

Share this post


Link to post
Share on other sites

It is the ammo class names - they haven't been uploaded onto the biki yet, but here are the ones from ArmA1 (who knows, some of them might work):

http://community.bistudio.com/wiki/ArmA:_Weapons

One thing you have to be very careful about when using this is the global/local relationship. You might inadvertantly end up spawning a GBU for each player if you're not careful, which for full servers is not a nice thing really.

Share this post


Link to post
Share on other sites
It is the ammo class names - they haven't been uploaded onto the biki yet, but here are the ones from ArmA1 (who knows, some of them might work):

http://community.bistudio.com/wiki/ArmA:_Weapons

Thats the place, hopfully they will update it with an Arma 2 one soon. So far I only have got one or two to work, big ones though. A lot them from Arma 1 just create an explosion with no sound, I haven't checked if they even do damage, it may just be smoke.

To link a trigger to a single unit you use the group mode (not sure what to call it actually) in the editor by pressing F2. Then in the same way as grouping units together you group the trigger to a single unit (you can only link one trigger to one unit). If you open up the trigger again you will notice the 'Activation' drop down box has changed and now contains 'Vehicle', 'Group Leader', Whole Group' and 'Any Group Member'. These are all pretty self-explanatory except that 'Vehicle' means the specific unit you grouped it to, regardless of whether they are in a vehicle or not.

A small trick I use to ensure that the trigger is set up properly and activated when it should be, is I use this line

player sidechat "Trigger Activated"

This will make it so that when the trigger is activated you character says "Trigger Activated" so you know the trigger has definatly been activated.

E.g.

bomb = "Bo_GBU12_LGB" createVehicle getmarkerPos "explosion"; player sidechat "Trigger Activated"

So is your character says "Trigger Activated" but nothing happens then you know it's the code you used that is the issue and not the trigger parameters.

This:

Armed Assault Editing Guide - Deluxe Edition

(most should still apply to Arma 2)

combined with this:

Arma 2 Command Reference

should help a lot with other aspects of editing.

For a grenade sized explosion, this should work:

grenade = "grenade" createVehicle getmarkerPos "Markername";

Edited by Murphe

Share this post


Link to post
Share on other sites

Does anyone know how i could spawn the bomb at a certain altitude above the target? So it could look like an airstrike? Eg radio command, drop bomb, triggers the bomb to be spawned 300m up, message confirms, few seconds later, impact

Share this post


Link to post
Share on other sites
Does anyone know how i could spawn the bomb at a certain altitude above the target? So it could look like an airstrike? Eg radio command, drop bomb, triggers the bomb to be spawned 300m up, message confirms, few seconds later, impact

To do this you use this:

bomb = "Bo_GBU12_LGB"  createVehicle [(getmarkerPos "bombsite1" select 0),( getmarkerPos "bombsite1" select 1), 300];

However my editing know-how on this subject ends there for the time being. This will cause a LGB to be spawned 300m in the air facing North. The LGB will then being to fall Northward at a very slow speed (you may need to spawn them much higher than this to allow them to get up to speed) and so land North of where the marker that they spawned over is. I don't know how to change the direction or the initial velocity but I know these commands exisit.

Edited by Murphe

Share this post


Link to post
Share on other sites

I've been starting to experience with the mission builder in the last 12 minutes and i'm trying to build a small training mission for my 57 year old dad :)

My question is probably a very basic one, but how can one do the same kind of effect with a building. Each of them have an ID.

So, let's say i want to make the building with ID 511 blow-up, can I link that bomb with the building instead of a car ?

Please, excuse the noob ;) Once I get the syntax, I should be able to figure stuff on my own.

Share this post


Link to post
Share on other sites
I've been starting to experience with the mission builder in the last 12 minutes and i'm trying to build a small training mission for my 57 year old dad :)

My question is probably a very basic one, but how can one do the same kind of effect with a building. Each of them have an ID.

So, let's say i want to make the building with ID 511 blow-up, can I link that bomb with the building instead of a car ?

Please, excuse the noob ;) Once I get the syntax, I should be able to figure stuff on my own.

You can still use the above script from Murphe just set the height of the bomb much lower, I set the following code to 3 meters above ground.

bomb = "Bo_GBU12_LGB"  createVehicle [(getmarkerPos "bombsite1" select 0),( getmarkerPos "bombsite1" select 1), 3];

recap place the code in the trigger and set up your conditions, name a marker bombsite1 and place over the building you wish destroyed.

Don't be confused with the createVehicle part.

Edited by F2k Sel

Share this post


Link to post
Share on other sites

just group the trigger to the building by dragging a line from the trigger to the centre of the building while the group item is highlighted. Then open your trigger and it should say in the activation box Static Object.

Now set the other options to "Not Present" and where it says Type choose an End.

Object ID never seems to work for me and may have been removed as an option but I could be wrong.

Share this post


Link to post
Share on other sites
just group the trigger to the building by dragging a line from the trigger to the centre of the building while the group item is highlighted. Then open your trigger and it should say in the activation box Static Object.

Now set the other options to "Not Present" and where it says Type choose an End.

Object ID never seems to work for me and may have been removed as an option but I could be wrong.

Ha, thank you very much for your help. Now it's looking even better ! I'm still stuck on object selection however. When I blow up the cow in the middle of the road the building on the side does not blow up.

I could spawn a bomb in the building, but that makes it look weird since there would be 2 explosion. I would rather set the building damage to 1. Is that possible ?

Edited by The_Angry_Canadian

Share this post


Link to post
Share on other sites

uh.. i usually do it in this manner:

name the vehicle "car1"

set the trigger and enter in the init:

"car1 setdamage 1"

this works wonders with fueltrucks :)

ps: love your vids btw

edit... 100posts YAY :)

Edited by Mc Speedfreak
edit... 100posts YAY :)

Share this post


Link to post
Share on other sites
uh.. i usually do it in this manner:

name the vehicle "car1"

set the trigger and enter in the init:

"car1 setdamage 0" (or 1 can never really remember until i try it)

this works wonders with fueltrucks :)

Ha, yes, In case of trucks or cars, I have no problem by naming the thing. But in the case allready existing buildings ( or bridge, or lighthouses, etc ), I cant set their damage.

Edited by The_Angry_Canadian
typo

Share this post


Link to post
Share on other sites

ok, place a game logic over the building you want gone and name it targ1

add the following command to your trigger.

buildings = nearestObjects [targ1,["building"], 50];{_x setDamage 1} foreach buildings;

Where it says 50 that's the damage radius, it will destroy most buildings within that range. Adjust it to get the range you require.

Edited by F2k Sel

Share this post


Link to post
Share on other sites
ok, place a game logic over the building you want gone and name it targ1

add the following command to your trigger.

buildings = nearestObjects [targ1 ["building"], 50];{_x setDamage 1} foreach buildings;

Where it says 50 that's the damage radius, it will destroy most buildings within that range. Adjust it to get the range you require.

While I try to figure why the above codes complains about a missing "]", let me say thank you for your help ;)

Share this post


Link to post
Share on other sites

Sorry place a , after targ1. I've corrected the code and it should work now.

Have fun Cya.

Edited by F2k Sel

Share this post


Link to post
Share on other sites
Sorry place a , after targ1. I've corrected the code and it should work now.

Have fun Cya.

Thank you very much. The effect is VERY nice now !

I replace the GBU, which has 5000 hits by a "M_Sidewinder_AA". Allows you to stay alive if you are around 35 meters from it. So you can see the scene better. Adding the building destruction makes it look bigger. PERFECT !

My dad should be in for a couple of surprises.

Note to self.

Setting the range to 250 instead of 25 will make Arma 2 crash. And it will be even more painfull if you forgot to save most of you editing .

Edited by The_Angry_Canadian

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  

×