OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: StonedSoldier 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,
-
@ 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:
this addEventHandler ["fired",{(nearestObject [_this select 0,_this select 4]) exec "bomb.sqs"}]
bomb.sqs:
@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
-
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
-
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...