Results 1 to 8 of 8

Thread: Explosion on bullet impact HELP

  1. #1

    Explosion on bullet impact HELP

    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

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

  3. #3
    Staff Sergeant
    Join Date
    Nov 10 2009
    Location
    Denmark
    Posts
    307
    Author of the Thread
    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??

  4. #4
    Add this to your barrel's init line:
    PHP Code:
    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:
    PHP Code:
    _obj = (_this select 0select 0;
    _type _this select 1;

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

  5. #5
    Staff Sergeant
    Join Date
    Nov 10 2009
    Location
    Denmark
    Posts
    307
    Author of the Thread
    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?
    Last edited by JacobJ; Dec 13 2009 at 12:52.

  6. #6
    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).

  7. #7
    Staff Sergeant
    Join Date
    Nov 10 2009
    Location
    Denmark
    Posts
    307
    Author of the Thread
    Okay nice. Thank you very much.

  8. #8
    Staff Sergeant
    Join Date
    Nov 10 2009
    Location
    Denmark
    Posts
    307
    Author of the Thread
    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?
    Last edited by JacobJ; Dec 14 2009 at 10:46.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •