Jump to content
Sign in to follow this  
TheoryOfWar

ArmA 3 - Make Two Triggers Set Task as Succeeded Without Modues

Recommended Posts

Hi chaps.

My knowledge of ArmA 3 scripting overall is very limited.

I am trying to put together a small script which basically starts, creates a task, assigns the task, waits for there to be no OPFOR in the town, waits for there to be at least one BLUFOR in the town and then succeeds.

At this stage, the task is created and assigned perfectly but then will just succeed regardless of the trigger states.

I already have a working script which will then randomly select a new task.

sleep 5;

_null = [west, "town2", ["Enemy forces have been sighted in and around this area. Move to and secure the town.", "Move to and secure the town", "Move to and secure the town"], getMarkerPos "town2", false] spawn BIS_fnc_taskCreate;

_null = ["town2", "ASSIGNED"] spawn BIS_fnc_taskSetState;

_trg=createTrigger["EmptyDetector",getMarkerPos "town2"];
_trg setTriggerArea[300,300,0,false];
_trg setTriggerActivation["EAST","NOT PRESENT",true]; 

sleep 2;

_trg=createTrigger["EmptyDetector",getMarkerPos "town2"];
_trg setTriggerArea[5,5,0,false];
_trg setTriggerActivation["WEST","PRESENT",true];

sleep 5;

_null = ["town2", "SUCCEEDED"] spawn BIS_fnc_taskSetState;

Player sidechat "0, this is 10A, the town has been secured, awaiting further instructions, out.";

null=[]execVM "RandomArray.sqf";

I have tried messing about with an if loop to solve the issue but then it just hangs on the trigger and won't succeed no matter what.

if(triggerActivated westcheck1) and (triggerActivated eastcheck1) exitWith 
{["town1", "SUCCEEDED", true] spawn BIS_fnc_taskSetState;
Player sidechat "0, this is 10A, the town has been secured, awaiting further instructions, out.";

};

Note: The names of the triggers differ in the loop because I used in-game triggers for that one just to see if it made a difference.

Thank you in advanced for any information.

Share this post


Link to post
Share on other sites

You will want a waitUntil:

sleep 5;

_null = [west, "town2", ["Enemy forces have been sighted in and around this area. Move to and secure the town.", "Move to and secure the town", "Move to and secure the town"], getMarkerPos "town2", false] spawn BIS_fnc_taskCreate;

_null = ["town2", "ASSIGNED"] spawn BIS_fnc_taskSetState;

_trg=createTrigger["EmptyDetector",getMarkerPos "town2"];
_trg setTriggerArea[300,300,0,false];
_trg setTriggerActivation["EAST","NOT PRESENT",true]; 

sleep 2;

_trg=createTrigger["EmptyDetector",getMarkerPos "town2"];
_trg setTriggerArea[5,5,0,false];
_trg setTriggerActivation["WEST","PRESENT",true];

sleep 5;

waitUntil {(triggerActivated westcheck1) && (triggerActivated eastcheck1)};

["town2", "SUCCEEDED"] spawn BIS_fnc_taskSetState;

Player sidechat "0, this is 10A, the town has been secured, awaiting further instructions, out.";

null=[]execVM "RandomArray.sqf";

Share this post


Link to post
Share on other sites

You absolute beauty. I'm going to try it now.

---------- Post added at 19:18 ---------- Previous post was at 19:17 ----------

Perfect. It worked exactly how I wanted it to.

Thank you very much.

Share this post


Link to post
Share on other sites

Oh, and if it's MP and you want every player to see the sideChat message, replace that line withe the following:

[[player,"0, this is 10A, the town has been secured, awaiting further instructions, out."],"sideChat",true,false,false] call BIS_fnc_MP;

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  

×