Jump to content
Sign in to follow this  
JacobJ

Explosion on bullet impact HELP

Recommended Posts

Hello

How do I get ect. a barrel or can (or any unit) to explode when a bullet or two hits it?

I think it would be a cool effect to add to the battlefield.

Hope you can help me

Best regards

Jacob

Share this post


Link to post
Share on other sites

Please do not crosspost. If you posted by accident in a wrong forum, report your post and ask for movement.

Share this post


Link to post
Share on other sites

Okay sry about that. You may remove my other theard in the mission forum.

Does anyone know how to make a trigger to be activated on bullet impact??

Share this post


Link to post
Share on other sites

Add this to your barrel's init line:

this addEventHandler ["hit", {[_this, "G_40mm_HE"] execVM "explode.sqf"}];

(You can change "G_40mm_HE" to whatever projectile you want to use. You can find the list here under Ammo classnames)

Create a file called "explode.sqf" in the mission root (where mission.sqm is located). Put this into it:

_obj = (_this select 0) select 0;
_type = _this select 1;

_bomb = _type createVehicle (getPos _obj);
_bomb setPos (getPos _obj);

Share this post


Link to post
Share on other sites

Thank you very much, ill try that.

Where did you find the "hit" code, if that is the code, that makes the barrel react to the hit of a projectile?

What if I want any bullet that hits the barrel to make it explode? is there a some allround ammo-code that I can substitude with the G_40mm_HE?

I looked through the Event Handler wiki thing and found out that you can type "", insteed of giving a given weapontype. Would that work, so all hits from any weapon would cause the explosion?

Edited by JacobJ

Share this post


Link to post
Share on other sites

The script gets triggered no matter what hits it, the ammo classname is the projectile that gets created for the explosion (a 40mm grenade in this case).

Share this post


Link to post
Share on other sites

Okay I dont know what I did wrong, but now it is working with the barrel.

I still cant shoot a flying helicopter with this.. what can I do?

Edited by JacobJ

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  

×