JacobJ 10 Posted December 12, 2009 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
W0lle 182 Posted December 12, 2009 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
JacobJ 10 Posted December 13, 2009 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
Deadfast 43 Posted December 13, 2009 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
JacobJ 10 Posted December 13, 2009 (edited) 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 December 13, 2009 by JacobJ Share this post Link to post Share on other sites
Deadfast 43 Posted December 13, 2009 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
JacobJ 10 Posted December 13, 2009 Okay nice. Thank you very much. Share this post Link to post Share on other sites
JacobJ 10 Posted December 13, 2009 (edited) 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 December 14, 2009 by JacobJ Share this post Link to post Share on other sites