Warning: include(/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php): failed to open stream: No such file or directory in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Warning: include(): Failed opening '/var/www/html/forum/Sources/../../../includes/depot_files/OFPEC_get_header_image.inc.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 146

Notice: Undefined index: OFPEC in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152

Notice: Trying to access array offset on value of type null in /var/www/html/forum/Sources/Load.php(2272) : eval()'d code on line 152
    Home   Help Login Register  

Author Topic: timed fuse  (Read 3063 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.