svarun 16 Posted August 19, 2016 How could this be achieved? I want the trigger to fire once IR grenade is present in the zone. Share this post Link to post Share on other sites
foxtin 15 Posted August 20, 2016 1.) Into your Trigger add the following condition: !isNil "IrCalled" 2.) Change the name of the trigger to TriggerIR 3.) Add the following to the player's init field: this addEventhandler[ "Fired", { private ["_range"]; _range = 50; if (_this select 2 == "IRGrenade" && (_this select 0) distance TriggerIR <= _range) then { IrCalled = true; publicVariable "IrCalled"; }; }]; Also check out my mission, if you want: Operation Python {Typhoon Series} Share this post Link to post Share on other sites
svarun 16 Posted August 20, 2016 Thanks! I'll check it out. Share this post Link to post Share on other sites
FleebJuice 0 Posted February 26, 2017 (edited) On 8/20/2016 at 8:44 AM, foxtin said: 1.) Into your Trigger add the following condition: !isNil "IrCalled" 2.) Change the name of the trigger to TriggerIR 3.) Add the following to the player's init field: this addEventhandler [ "Fired", { private ["_range"]; _range = 50; if (_this select 2 == "IRGrenade" && (_this select 0) distance TriggerIR <= _range) then { IrCalled = true; publicVariable "IrCalled"; }; } ]; Also check out my mission, if you want: Operation Python {Typhoon Series} Thank you! I'm using this, but I ran into a bit of problem. What I wrote: Trigger: variable: irtag1 condition: !isNil "irset1" Player: init: this addEventhandler [ "Fired", { private ["_range"]; _range = 5; if (_this select 2 == "IRGrenade" && (_this select 0) distance irtag1 <= _range) then { irset1 = true; publicVariable "irset1"; }; } ]; The problem!!! I made one more trigger like this (i.e. two targets for "marking"), renamed it with _1, added another line to init with the _1. this addEventhandler [ "Fired", { private ["_range"]; _range = 5; if (_this select 2 == "IRGrenade" && (_this select 0) distance irtag1 <= _range) then { irset1 = true; publicVariable "irset1"; }; } ]; this addEventhandler [ "Fired", { private ["_range"]; _range = 5; if (_this select 2 == "IRGrenade" && (_this select 0) distance irtag1_1 <= _range) then { irset1 = true; publicVariable "irset1"; }; } ]; The thing is, no matter in what order, first one triggers, the second one doesn't. If I throw IR at A, B won't respond. If I throw at B, A won't respond. I tried adding on trigger deactivation: player removeEventHandler ["fired",0]; I also tried renaming irset1 to irset1_1 for the second trigger, didn't help. Even separated the inits with line break :D Didn't help Do you know where might the problem be? Are the addeventhandler activated alltogether on the first trigger, so there's nothing left for the second (whichever comes first)? Edited February 26, 2017 by FleebJuice Share this post Link to post Share on other sites