summaryrefslogtreecommitdiffstats
path: root/Client/PVFunctions/SetTask.sqf
diff options
context:
space:
mode:
authorhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
committerhybrid <hybrid@hybridlabs.pro>2026-06-11 19:58:31 +0300
commite670b4ed55c459a21090bd0178ceaaaf12d87989 (patch)
treeb6833d5e842475f0ee27f5f617096445fdd4e4a1 /Client/PVFunctions/SetTask.sqf
downloada2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.gz
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.tar.bz2
a2wf_fallujah-e670b4ed55c459a21090bd0178ceaaaf12d87989.zip
init
Diffstat (limited to '')
-rw-r--r--Client/PVFunctions/SetTask.sqf36
1 files changed, 36 insertions, 0 deletions
diff --git a/Client/PVFunctions/SetTask.sqf b/Client/PVFunctions/SetTask.sqf
new file mode 100644
index 0000000..fa33e86
--- /dev/null
+++ b/Client/PVFunctions/SetTask.sqf
@@ -0,0 +1,36 @@
+Private ["_task","_taskPos","_taskTime","_taskTimeLabel"];
+
+_task = _this select 0;
+_taskTime = _this select 1;
+_taskTimeLabel = _this select 2;
+_taskPos = _this select 3;
+
+if (!isNull(comTask)) then {player removeSimpleTask comTask};
+comTask = player createSimpleTask ["CommanderOrder"];
+comTask setSimpleTaskDescription [Format[localize "STR_WF_CHAT_TaskTO_Display",_task,_taskTimeLabel], _task, _task];
+comTask setSimpleTaskDestination _taskPos;
+player setCurrentTask comTask;
+
+taskHint [format [localize "str_taskNew" + "\n%1",_task], [1,1,1,1], "taskNew"];
+
+[comTask,_taskTime,_taskPos,_task] Spawn {
+ Private ["_duration","_pos","_succeed","_task","_timer","_type"];
+ _task = _this select 0;
+ _duration = (_this select 1)*60; //--- Converts to seconds.
+ _pos = _this select 2;
+ _type = _this select 3;
+
+ _timer = 0;
+ _succeed = false;
+ while {(taskDestination _task) select 0 == (_pos select 0) && !_succeed} do {
+ sleep 5;
+ if (player distance _pos < 250) then {_timer = _timer + 5};
+ if (_timer > _duration) then {_succeed = true};
+ };
+
+ if (_succeed) then {
+ taskHint [format [localize "str_taskAccomplished" + "\n%1",_type], [1,1,1,1], "taskDone"];
+ _task setTaskState "Succeeded";
+ player kbTell [sideHQ, WFBE_V_HQTopicSide, "OrderDone",["1","","HQ",["HQ"]],["2","","We are",["WeAre"]],["3","","ready for orders",["ReadyForOrders"]],["4","","over.",["Over1"]],true];
+ };
+}; \ No newline at end of file