Jump to content
jakkob4682

scripted trigger question

Recommended Posts

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

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],

""];

  • Like 1

Share this post


Link to post
Share on other sites

See second half of post, for different options.

  • Like 1

Share this post


Link to post
Share on other sites

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')", ""];
};

 

 

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×