jakkob4682 23 Posted January 17, 2021 So I have a function that creates a trigger dynamically, whats the best way to pass a local variable to the trigger? params ["_pos"]; _a = createTriggger ["EmptyDetector",_pos]; //settTriggerArea, activation, etc _buildings = nearestObjects [_pos,["House","Building"],350]; _building = _buildings select (count _buildings - 1); _bPos = getPosASL _builidng; how do I pass _bPos to a function within the triggerStatements? Share this post Link to post Share on other sites
Von Quest 1161 Posted January 17, 2021 Format. An Example from my SCAR project : _trg setTriggerStatements ["(vehicle player) in thisList", format["[%1,%2] execVM ""zdz_scar\System\AO\LAND\INF1\infantry_1_trg.sqf""",_fSize,_pBIS], ""]; 1 Share this post Link to post Share on other sites
Larrow 2816 Posted January 17, 2021 See second half of post, for different options. 1 Share this post Link to post Share on other sites
pierremgi 4822 Posted January 18, 2021 Your trigger is an object. You can set a variable on it: _a setVariable ["Bpos", _bpos]; In trigger statement: thisTrigger getVariable 'Bpos' Example: 0 = [] spawn { _a = createTrigger ["emptyDetector",getpos player]; _a setTriggerArea [200,200,0]; _a setTriggerActivation ["WEST","present",true]; _buildings = nearestObjects [getpos _a,["House","Building"],350]; _building = selectRandom _buildings; _bPos = getPosASL _building; _a setVariable ["Bpos",_bpos]; _a setTriggerStatements ["player in thislist && !(thisTrigger getVariable ['bpos',[0,0,0]] isEqualTo [0,0,0])", "player setposASL (thisTrigger getVariable 'bpos')", ""]; }; 1 Share this post Link to post Share on other sites