Jump to content
Sign in to follow this  
jandrews

trigger condition question

Recommended Posts

I am trying to make this trigger condition once any IND forces are present distance _name < 2. I know its not this easy BUT not sure if I can make it to any IND present to object. I have seen where _player distance trigger < ; but not faction or side.

ideas? thanks

_trg = createTrigger ["EmptyDetector", getMarkerPos _markerCO];

_trg setTriggerArea [400, 400, 0, false];

_trg setTriggerActivation ["EAST", "NOT PRESENT", false];

_trg setTriggerStatements ["this", "", ""];

enemyDead = false;

waitUntil {triggerActivated _trg && guer distance SDV < 2 && guer distance SDV1 < 2};

Share this post


Link to post
Share on other sites

Not sure if I understand you correctly with the "distance < 2", but at least your trigger activation has to be different:

_trg setTriggerActivation ["GUER", "PRESENT", false];

"EAST" is opfor. And by "NOT PRESENT", your trigger would have fired as soon as a unit of the respective side leaves the trigger area.

See here for more information.

So, what do you mean by "once any IND forces are present distance _name < 2"? Do you mean, the trigger should fire as soon as an indfor unit is closer than 2m to the trigger? In that case:

_trg setTriggerArea [2, 2, 0, false];

Share this post


Link to post
Share on other sites

Sorry for the confusion

_trg = createTrigger ["EmptyDetector", getMarkerPos _markerCO];

_trg setTriggerArea [400, 400, 0, false];

_trg setTriggerActivation ["EAST", "NOT PRESENT", false];

_trg setTriggerStatements ["this", "", ""];

enemyDead = false;

waitUntil {triggerActivated _trg == this is set for when all units in zone are killed

&& guer distance SDV < 2 && guer distance SDV1 < 2}; == is for when Ind units are <2 2 SDV's.

Its basically clear the area and capture 2 SDV's. But task success does not happen until all are met.

enemyDead = false;

waitUntil {triggerActivated _trg && guer distance SDV < 2 && guer distance SDV1 < 2};

hopefully that is more clear.

BUT I am not sure how to script x_player on Ind side to be within <2 of each SDV for condition to be met.

I have a thought. This is more work but....

_trg = createTrigger ["EmptyDetector", getMarkerPos _markerCO];

_trg setTriggerArea [400, 400, 0, false];

_trg setTriggerActivation ["EAST", "NOT PRESENT", false];

_trg setTriggerStatements ["this", "", ""];

_trg1 = createTrigger ["EmptyDetector", getPos SDV];

_trg1 setTriggerArea [3, 3, 0, false];

_trg1 setTriggerActivation ["GUER", "PRESENT", true];

_trg1 setTriggerStatements ["this", "hint captured", "hint captured"];

_trig1 attachTo [sDV,[0,0,0]];

_trig1 setTriggerTimeout [10, 10,10, true];

_trg2 = createTrigger ["EmptyDetector", getPos SDV1];

_trg2 setTriggerArea [3, 3, 0, false];

_trg2 setTriggerActivation ["GUER", "PRESENT", true];

_trg2 setTriggerStatements ["this", "hint captured", "hint captured"];

_trig2 attachTo [sDV1,[0,0,0]];

_trig2 setTriggerTimeout [10, 10,10, true];

enemyDead = false;

waitUntil {triggerActivated _trg && triggerActivated _trg1 && triggerActivated _trg2};

Ideas?

Edited by JAndrews1

Share this post


Link to post
Share on other sites

Alright, I was searching for a command to get all units of a specific side, but as that obviously doesn't exists, here's what I'd do:

Create a trigger checking for the driver of the two SVDs:

_trg2 setTriggerStatements ["
 side driver (missionNamespace getVariable 'SDV_1') isEqualTo independent &&
 side driver (missionNamespace getVariable 'SDV_2') isEqualTo independent
", "", ""];
//where "SDV_1" and "SDV_2" are the names you gave those SDVs in the editor

And check in your first triggers condition if the second trigger is activated:

_trg1 setTriggerStatements ["this && triggerActivated (missionNamespace getVariable 'second_trigger')", "", ""];

I haven't tested it, but it should work.

Edited by waltenberg

Share this post


Link to post
Share on other sites

The code does exist:


_units = [];

{
 if (side _x == GUER) then   {
   _units set [count _units, _x];
 };
}forEach allUnits;//<<this needs to be changed for trigger list.

Edited by JShock

Share this post


Link to post
Share on other sites

Trigger

_trg = createTrigger ["EmptyDetector", getMarkerPos _markerCO];
_trg setTriggerArea [400, 400, 0, false];
_trg setTriggerActivation ["EAST", "NOT PRESENT", false];
_trg setTriggerStatements ["this && {{
_sdv = _x;
{
	if (side _x == independent && {_x distance _sdv <= 3}) exitWith {true};

}forEach allUnits;
}count [sdv, sdv1] == 2}", "", ""];

commented statement

//trigger condition
this && {{
_sdv = _x;
{
	//independent AND is near sub
	if (side _x == independent && {_x distance _sdv <= 3}) exitWith {true};

//all units		
}forEach allUnits;

//each sub
}count [sdv, sdv1] == 2}

So the trigger fires when OFOR are not present (this) AND for each sub (count [sdv, sdv1] ) it will check to see if there is an INDEP within 3 meters. If its true for both subs (== 2) then the trigger fires

Edited by Larrow

Share this post


Link to post
Share on other sites

thanks for all your help guys.

---------- Post added at 02:09 ---------- Previous post was at 01:59 ----------

Trigger

_trg = createTrigger ["EmptyDetector", getMarkerPos _markerCO];
_trg setTriggerArea [400, 400, 0, false];
_trg setTriggerActivation ["EAST", "NOT PRESENT", false];
_trg setTriggerStatements ["this && {{
_sdv = _x;
{
	if (side _x == independent && {_x distance _sdv <= 3}) exitWith {true};

}forEach allUnits;
}count [sdv, sdv1] == 2}", "", ""];

I have another task which is similar but with the large sub. Could I just replace "sub" in the 2 places and count == 1 to still work?

Trigger

_trg = createTrigger ["EmptyDetector", getMarkerPos _markerCO];

_trg setTriggerArea [400, 400, 0, false];

_trg setTriggerActivation ["EAST", "NOT PRESENT", false];

_trg setTriggerStatements ["this && {{

_sdv = _x;

{

if (side _x == independent && {_x distance sub <= 3}) exitWith {true};

}forEach allUnits;

}count == 1}", "", ""];

Share this post


Link to post
Share on other sites

Yes that will give you the same affect for just the one object.

Just make sure that the _sdv = _x; is changed over to sub as well:

_trg = createTrigger ["EmptyDetector", getMarkerPos _markerCO];
_trg setTriggerArea [400, 400, 0, false];
_trg setTriggerActivation ["EAST", "NOT PRESENT", false];
_trg setTriggerStatements ["this && {{

sub = _x; //<<<<<< _sdv to sub
{
if (side _x == independent && {_x distance sub <= 3}) exitWith {true};

}forEach allUnits;
}count [sub] == 1}", "", ""];

Share this post


Link to post
Share on other sites
Yes that will give you the same affect for just the one object.

Just make sure that the _sdv = _x; is changed over to sub as well:

_trg = createTrigger ["EmptyDetector", getMarkerPos _markerCO];
_trg setTriggerArea [400, 400, 0, false];
_trg setTriggerActivation ["EAST", "NOT PRESENT", false];
_trg setTriggerStatements ["this && {{

sub = _x; //<<<<<< _sdv to sub
{
if (side _x == independent && {_x distance sub <= 3}) exitWith {true};

}forEach allUnits;
}count [sub] == 1}", "", ""];

Thanks by the way. appreciate the help.

Share this post


Link to post
Share on other sites

No need to change any of the variables other than the one in the count array. The other _subs are just references to this when its used to iterate around allUnits. Maybe i shouldnt of called it _sub to avoid confusion.

_trg setTriggerStatements ["this && {{
_currentObject = _x;
{
	if (side _x == independent && {_x distance _currentObject <= 3}) exitWith {true};
}forEach allUnits;
}count [sub] == 1}", "", ""]; //sub here is the object to check against

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
Sign in to follow this  

×