OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: The-Architect on 30 Sep 2005, 03:34:12

Title: Detect Satchel touched off.
Post by: The-Architect on 30 Sep 2005, 03:34:12
How do I check if a satchel has been touched off?

I want a base to go haywire if I detonate a satchel charge.
Title: Re:Detect Satchel touched off.
Post by: h- on 30 Sep 2005, 08:42:48
hmm...

Add a "fired" eventHandler for the unit placing the satchel, like this:
Code: [Select]
this addEventHandler ["fired",{[if (_this select 4 == "PipeBomb") then {(nearestObject [_this select 0,_this select 4]) exec "placed.sqs"}]
and in init.sqs something like MYTAG_baseGoHaywire=false

Then, in the placed.sqs something like this
Code: [Select]
#loop
~1
? alive _this: goto "loop"

MYTAG_baseGoHaywire=true

And then of course for example a trigger having a condition MYTAG_baseGoHaywire which would then set the base go haywire...


None of the syntaxes or 'code' have guarantees whatsoever :P
Title: Re:Detect Satchel touched off.
Post by: Raptorsaurus on 30 Sep 2005, 23:02:42
Give a "fired" event handler to the unit placing the satchel, then in the script called by that event handler start a loop that checks the "typeOf" of the satchel.  When the "typeOf" is no longer the same as the original "typeOf" then you know the sachel has exploded.
Title: Re:Detect Satchel touched off.
Post by: 456820 on 30 Sep 2005, 23:18:08
what about getdammage command on the satchel to relise when the satchel has been destroyed then set everyone to combat mode ?
Title: Re:Detect Satchel touched off.
Post by: h- on 30 Sep 2005, 23:51:01
Variations are endless, but the basic idea still stands...

You can use isNull, alive, damage, typeOf...