Jump to content
Sign in to follow this  
zwobot

Create an explosion with createVehicle

Recommended Posts

I've got a bit of a hangover here.

I want to spawn an explosion for a roadside bomb using a trigger and a function.

the trigger's onActivation line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[this, "grenade"] call IED

IED is defined in the init.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">IED = preprocessFile "scripts\ied.sqf"

The bomb function itsself:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">// example call inside a trigger: [this, "grenade"] call IED

private ["_ied", "_pos", "_ammo"];

_pos = getPos (_this select 0);

_ammo = _this select 1;

_ied = _ammo createVehicle [_pos select 0, _pos select 1, 5];

_ied setDammage 1;

deleteVehicle _ied;

When I activate the trigger nothing happens, what am I doing wrong?

Share this post


Link to post
Share on other sites

Negative, "Shell125" does not work.

I have tried "Shell73" before and it did not work either.

Alternatively I also tried to put this into the onActivation field of the trigger:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">bomb = "Shell73" camCreate getPos this

Neither did that create an explosion sad_o.gif

EDIT: "Grenade" is supposed to be the ammo class name of some grenadelauncher ammo btw. Look it up here: Ofp weapon class names

Share this post


Link to post
Share on other sites

There is a "grenade" (for grenade launchers) but I think you need to name the trigger, "this" doesn't work with them iirc.

[triggername, "grenade"] call IED

Also, I'm not sure if it will explode when you setdammage 1 it. You could create a pipebomb on the same pos so the grenade will hit it and explode, then delete the pipebomb a 0.5s later by executing a script such as:

;call with: _ammo exec "delpipebomb.sqs"

~0.5

deleteVehicle _this

exit

You don't need to delete the grenade (or a tank shell), it'll be removed automaticly once it hits something and explodes.

It would be easier if you just let it go off by touching the ground.

Share this post


Link to post
Share on other sites

Thanks Pulverizer, naming the trigger worked thumbs-up.gif

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  

×