diff options
| author | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:55:41 +0300 |
|---|---|---|
| committer | hybrid <hybrid@hybridlabs.pro> | 2026-06-11 19:55:41 +0300 |
| commit | dee52083d359434fc3ac51a871c1b836d092d2ac (patch) | |
| tree | 89bbb6326348a99bcf4a68761bd0c9628b80d4bb /Client/PVFunctions/SetTask.sqf | |
| download | a2wf_lingor-dee52083d359434fc3ac51a871c1b836d092d2ac.tar.gz a2wf_lingor-dee52083d359434fc3ac51a871c1b836d092d2ac.tar.bz2 a2wf_lingor-dee52083d359434fc3ac51a871c1b836d092d2ac.zip | |
init
Diffstat (limited to 'Client/PVFunctions/SetTask.sqf')
| -rw-r--r-- | Client/PVFunctions/SetTask.sqf | 36 |
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 |
