OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting General => Topic started by: Tobbs on 19 Feb 2010, 16:06:29

Title: timed fuse
Post by: Tobbs on 19 Feb 2010, 16:06:29
Hi. I'm making a script that will detonate a projectile after a given ammount of time. I've successfully used eventhandler "fired" to catch a projectile and then vehiclecreate'd a bomb to the coords of the projectile after the time elapsed.

Problem is that this seems to work well for slow projectiles but not so for fast ones (>1500m/s)

I'm guessing the shell leaves the 50m range of "nearestObject" before the script has time to catch it.

Anyone of you olde' scripthogs got any ideas?
Title: Re: timed fuse
Post by: h- on 19 Feb 2010, 16:46:56
Catch the bullet "in" the eventhandler, not in the script it executes

For example:
Code: [Select]
unit addEventHandler ["fired",{(nearestObject [_this select 4,_this select 0]) execVM "script.sqf"}] :dunno: