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: Detecting Explosinon  (Read 729 times)

0 Members and 1 Guest are viewing this topic.

StonedSoldier

  • Guest
Detecting Explosinon
« on: 02 Feb 2005, 12:02:11 »
i grab the bomb when it is launched from an A10(LGB) with the eventhandler fired and the script;

_shooter = _this select 0
_bomb = _this select 4

_bomb = nearestobject [_shooter,_bomb]

is there an easier way of detecting when the bomb has exploded and where???, at the moment im constantly checking the bombs altitude and when its < 2 i assume its detonated,
« Last Edit: 02 Feb 2005, 12:02:32 by StonedSoldier »

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Detecting Explosinon
« Reply #1 on: 02 Feb 2005, 12:50:38 »
@ isNull _bomb

You might also wanna grab the bomb from the eventhandler itself, to ensure that it will get grabbed when somebody has a low FPS...

EH:
Code: [Select]
this addEventHandler ["fired",{(nearestObject [_this select 0,_this select 4]) exec "bomb.sqs"}]
bomb.sqs:
Quote
@isNull _this
hint "bomb detonated"

Or if you don't like using @ use goto loop...
This short @ loop should not add much lag though...

And no guarantees on any syntaxes... :P
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

StonedSoldier

  • Guest
Re:Detecting Explosinon
« Reply #2 on: 02 Feb 2005, 13:18:43 »
cheers for the EH idea, ive never thought about doing that, anywho how would i add an eventhadler during a script as the varible _this is already declared

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re:Detecting Explosinon
« Reply #3 on: 02 Feb 2005, 16:01:34 »
It would be better not to add that kind of eventhandler in a script, but to do it from init field or init.sqs...
Or from the config, depending entirely on what you are doing...

But, I think the _this in the script won't matter because inside the eventhandler array the _this refers to the eventHandler, and is in it's own 'scope'...
You just need to test it ;)

Of course that lag thing might not be so big issue as the bomb is not so fast a projectile so that EH method might not be so vital...
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.