Home   Help Search Login Register  

Author Topic: timed fuse  (Read 2242 times)

0 Members and 1 Guest are viewing this topic.

Offline Tobbs

  • Members
  • *
timed fuse
« 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?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: timed fuse
« Reply #1 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:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.