Jump to content

Recommended Posts

Hello!

 

It's probably a very easy situation but I can't find any help so far. I want to apply the steps below between three locations (LA, LB, LC)

 

Start (anywhere):
Task 1- Go LA

(On LA)
- Success
Task 2- Go LB

(On LB)
- Success
Task 3- Go LA

(On LA)
- Success
Task 4- Go LC

(On LC)
- Success

 

I use trigger (Blufor Present) but I'm having problems. When I sync one trigger and set it to "Repeat", both Task 2 and Task 4 gets activated and when I activate again, Task 2 completes and starts again.

 

When I use two different triggers, Task 4 is enabled when units reach LA for the first time.

 

I need tasks to be activated and completed just like the steps I mentioned above. How can I do that?

Share this post


Link to post
Share on other sites

This can be cumbersome with triggers.

I suggest using a simple script for this:

init.sqf or wherever you seem fit:


GOM_fnc_simpleTask = {


params ["_taskDetails","_condition"];

_taskDetails params ["_taskID","_taskOwner","_taskTitle","_taskText","_taskMarker"];

_create = [_taskID,_taskOwner,[_taskText,_taskTitle,_taskMarker],getMarkerPos _taskMarker,"ASSIGNED",1,true,true,"MOVE",false] call BIS_fnc_setTask;



waitUntil {call _condition};
if (call _condition) then {[_taskID,"SUCCEEDED"] call BIS_fnc_taskSetState};
true

};

GOM_fnc_linearTasks = {
	sleep 3;
	_taskID = "001";
	_taskOwner = player;
	_taskTitle = "Go to Location A!";
	_taskText = "It's not really that complicated...";
	_taskMarker = "LA";
	_condition = {player distance2D getmarkerpos "LA" < 5};

	_task1 = [[_taskID,_taskOwner,_taskTitle,_taskText,_taskMarker],_condition] spawn GOM_fnc_simpleTask;

	waitUntil {scriptDone _task1};
	sleep 3;

	_taskID = "002";
	_taskOwner = player;
	_taskTitle = "Go to Location B!";
	_taskText = "One step after the other.";
	_taskMarker = "LB";
	_condition = {player distance2D getmarkerpos "LB" < 5};

	_task2 = [[_taskID,_taskOwner,_taskTitle,_taskText,_taskMarker],_condition] spawn GOM_fnc_simpleTask;

	waitUntil {scriptDone _task2};
	sleep 3;

	_taskID = "003";
	_taskOwner = player;
	_taskTitle = "Go to Location A again!";
	_taskText = "Just walk 500 more...";
	_taskMarker = "LA";
	_condition = {player distance2D getmarkerpos "LA" < 5};

	_task3 = [[_taskID,_taskOwner,_taskTitle,_taskText,_taskMarker],_condition] spawn GOM_fnc_simpleTask;

	waitUntil {scriptDone _task3};
	sleep 3;

	_taskID = "004";
	_taskOwner = player;
	_taskTitle = "Go to Location C!";
	_taskText = "There you go!";
	_taskMarker = "LC";
	_condition = {player distance2D getmarkerpos "LC" < 5};

	_task4 = [[_taskID,_taskOwner,_taskTitle,_taskText,_taskMarker],_condition] spawn GOM_fnc_simpleTask;

	waitUntil {scriptDone _task4};
	systemchat "You're done!";
	true
};

Now when you want to run those tasks simply use this:

_runTasks = [] spawn GOM_fnc_linearTasks;

Also check out this little mission.

 

Cheers

  • Like 1
  • Thanks 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

×