Jump to content
Sign in to follow this  
nullsystems

Adding init to CfgAmmo or alike.

Recommended Posts

Hi all,

Im having a grenade thrown from a player and aside from the usual BANG and what not, im looking for something else to happen.

Can you add a script to go off when its thrown?

I don't want to add eventHandlers to every player tho, so it would have to be from the ammo, or magazine itself.

Thanks.

Share this post


Link to post
Share on other sites

Kindof.

The best you can do is modify the explosionEffects or the craterEffects of the ammo. These are the particle effects that run when the ammo explodes. As with the drop command, you can run a script when a particle is destroyed.

So, you could add a particle effect to your explosionEffects, which drops one particle only, and that particle makes a script run. In that script you would get passed the location where the particle destroyed itself (i.e. the location where the ammo was exploded).

The only problem with this method is that (a) you can't tell who threw the ammo, and (b) I don't think it would work on dedicated servers, since they might not actually run particle effects.

Share this post


Link to post
Share on other sites

Wow, this is incredibly frustrating!

All I want to do is attach a light to a thrown object. I get really agrivated by the lack of light and ammo functions in this game.

Thanks for your help man but im afraid I don't think im going to be able to go that route as its just confused me lol

Share this post


Link to post
Share on other sites

You can use a fired eventhandler on the unit and use the nearestobject command to catch the grenade. Check out how the tracer mods attach tracers to bullets to get an idea of how it works.

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  

×