diff --git a/helotraining_rewrite.Altis/createDropoffLZ.sqf b/helotraining_rewrite.Altis/createDropoffLZ.sqf
index a9c104b..d6346e1 100644
--- a/helotraining_rewrite.Altis/createDropoffLZ.sqf
+++ b/helotraining_rewrite.Altis/createDropoffLZ.sqf
@@ -40,12 +40,13 @@ if (!_lzAA and _lzhot) then
_longdesc = _longdesc + "
Be advised: Intel reports enemy activity at the location";
};
+_longdesc = _longdesc + format["
Created for %1", _assignToPlayer];
private _assignTo = [_assignToPlayer, west];
// PONDER: make a parent task "ferry squad X" ??
private _taskid = format["dropoff_%1", lzCounter];
[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],getPos _lzLocation,"CREATED",(STARTPRIORITY-lzCounter),true, _taskType, true] call BIS_fnc_taskCreate;
-//_assignToPlayer setCurrentTask _taskid;
+_assignToPlayer setCurrentTask ([_taskid,_assignToPlayer] call BIS_fnc_taskReal);
private _trg = createTrigger["EmptyDetector",getPos _lzLocation, false];
_trg setTriggerArea[lzSize,lzSize,0,false];
diff --git a/helotraining_rewrite.Altis/createEnemySquads.sqf b/helotraining_rewrite.Altis/createEnemySquads.sqf
index 5943c59..ef76582 100644
--- a/helotraining_rewrite.Altis/createEnemySquads.sqf
+++ b/helotraining_rewrite.Altis/createEnemySquads.sqf
@@ -1,4 +1,4 @@
-diag_log format["createEnemySquad called, _this: %1", _this];
+//diag_log format["createEnemySquad called, _this: %1", _this];
private _centrePos = _this select 0;
private _includeAA = _this select 1;
@@ -26,6 +26,6 @@ if (_includeAA) then
"O_soldier_AA_F" createUnit [_enemyPosition, _groupEnemy,"",0.75, "CORPORAL"];
};
-diag_log format["createEnemySquad %1 positioned to %2", _groupEnemy, _enemyPosition];
+//diag_log format["createEnemySquad %1 positioned to %2", _groupEnemy, _enemyPosition];
[_groupEnemy]
\ No newline at end of file
diff --git a/helotraining_rewrite.Altis/createPickupLZ.sqf b/helotraining_rewrite.Altis/createPickupLZ.sqf
index f83b0af..a77cf83 100644
--- a/helotraining_rewrite.Altis/createPickupLZ.sqf
+++ b/helotraining_rewrite.Altis/createPickupLZ.sqf
@@ -12,13 +12,12 @@ if ((random 1) < hotLZChance) then
_lzhot = true
};
private _lzAA = false;
-private _taskType = "move";
if ((random 1) < AAChance) then
{
_lzhot = true;
_lzAA = true;
};
-private _taskType = "move";
+private _taskType = "meet";
if (_lzhot) then
{
_taskType = "defend";
@@ -48,20 +47,25 @@ if (!_lzAA and _lzhot) then
[_squadCmdr, "Be advised, LZ is hot"] remoteExec ["sideChat", _side];
};
+private _taskState = "AUTOASSIGNED";
private _assignTo = [west];
if (!(_assignExtra isEqualTo false)) then
{
+ _longdesc = _longdesc + format["
Created for %1", _assignExtra];
_assignTo = _assignTo + _assignExtra;
+ _taskState = "CREATED";
};
// PONDER: make a parent task "ferry squad X" ??
private _taskid = format["pickup_%1", lzCounter];
-[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],getPos _lzLocation,"AUTOASSIGNED",(STARTPRIORITY-lzCounter),true, "meet", true] call BIS_fnc_taskCreate;
+[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],getPos _lzLocation,_taskState,(STARTPRIORITY-lzCounter),true, _taskType, true] call BIS_fnc_taskCreate;
if (!(_assignExtra isEqualTo false)) then
{
-// (_assignExtra select 0) setCurrentTask _taskid;
+ {
+ _x setCurrentTask ([_taskid,_x] call BIS_fnc_taskReal);
+ } forEach _assignExtra;
};
if (bSmoke) then
@@ -101,7 +105,7 @@ while {true} do
{
diag_log format["createPickupLZ: triggedred, loading up %1", _squad];
// TODO: Filter the list so that locations near currently active tasks are not considered
- private _newLZLocation = (lzList - [_lzLocation]) call BIS_fnc_SelectRandom;
+ private _newLZLocation = [[_lzLocation]] call selectLZ;
private _veh = [list _trg] call playerVehicleInList;
private _handle = [_veh, _squad, _taskid] spawn loadSquad;
diff --git a/helotraining_rewrite.Altis/createSquad.sqf b/helotraining_rewrite.Altis/createSquad.sqf
index 8ae65a3..e0c2128 100644
--- a/helotraining_rewrite.Altis/createSquad.sqf
+++ b/helotraining_rewrite.Altis/createSquad.sqf
@@ -1,4 +1,4 @@
-diag_log format["createSquad called, _this: %1", _this];
+//diag_log format["createSquad called, _this: %1", _this];
private _spawnPos = _this select 0;
private _groupTaxi = createGroup west;
diff --git a/helotraining_rewrite.Altis/getSideActiveTasks.sqf b/helotraining_rewrite.Altis/getSideActiveTasks.sqf
index ff291c8..eacdb2d 100644
--- a/helotraining_rewrite.Altis/getSideActiveTasks.sqf
+++ b/helotraining_rewrite.Altis/getSideActiveTasks.sqf
@@ -1,4 +1,4 @@
-diag_log format["getSideActiveTasks called, _this: %1", _this];
+//diag_log format["getSideActiveTasks called, _this: %1", _this];
private _side = _this select 0;
private _returnValue = [];
@@ -9,5 +9,5 @@ private _returnValue = [];
};
} forEach ([_side] call getSideTasks);
-diag_log format["getSideActiveTasks returning: %1", _returnValue];
+//diag_log format["getSideActiveTasks returning: %1", _returnValue];
_returnValue
\ No newline at end of file
diff --git a/helotraining_rewrite.Altis/getSideTasks.sqf b/helotraining_rewrite.Altis/getSideTasks.sqf
index 5058be8..810392c 100644
--- a/helotraining_rewrite.Altis/getSideTasks.sqf
+++ b/helotraining_rewrite.Altis/getSideTasks.sqf
@@ -1,4 +1,4 @@
-diag_log format["getSideTasks called, _this: %1", _this];
+//diag_log format["getSideTasks called, _this: %1", _this];
private _side = _this select 0;
private _returnValue = [];
{
@@ -12,5 +12,5 @@ private _returnValue = [];
};
} foreach allUnits;
-diag_log format["getSideTasks returning: %1", _returnValue];
+//diag_log format["getSideTasks returning: %1", _returnValue];
_returnValue
\ No newline at end of file
diff --git a/helotraining_rewrite.Altis/init.sqf b/helotraining_rewrite.Altis/init.sqf
index dbe41f4..c803e3e 100644
--- a/helotraining_rewrite.Altis/init.sqf
+++ b/helotraining_rewrite.Altis/init.sqf
@@ -1,6 +1,7 @@
// Config constant globals
LZCOUNT = 86;
STARTPRIORITY = 1000;
+EXLUDESPAWNLZS = [(missionNamespace getVariable "lz33")]; // Exclude the airport location near spawn marker
// Precompile code
execVM "precompile.sqf";
@@ -11,7 +12,7 @@ if (isServer) then
//Handle MP parameters
_handle = execVM "readparams.sqf";
waitUntil {isNull _handle};
- execVM "taskSpawner.sqf";
+ [EXLUDESPAWNLZS] spawn taskSpawner;
};
// Flag init complete
diff --git a/helotraining_rewrite.Altis/isLanded.sqf b/helotraining_rewrite.Altis/isLanded.sqf
index 06e3038..c7d1c85 100644
--- a/helotraining_rewrite.Altis/isLanded.sqf
+++ b/helotraining_rewrite.Altis/isLanded.sqf
@@ -1,4 +1,4 @@
-diag_log format["isLanded called, _this: %1", _this];
+//diag_log format["isLanded called, _this: %1", _this];
private _vehicle = _this select 0;
private _returnValue = false;
@@ -14,7 +14,7 @@ private _isSlow = true;
if (_isSlow && (_altitude < 1)) then
{
_returnValue = true;
-}
+};
-diag_log format["isLanded returning: %1", _returnValue];
+//diag_log format["isLanded returning: %1", _returnValue];
_returnValue
\ No newline at end of file
diff --git a/helotraining_rewrite.Altis/loadSquad.sqf b/helotraining_rewrite.Altis/loadSquad.sqf
index 8e55ce1..479b5df 100644
--- a/helotraining_rewrite.Altis/loadSquad.sqf
+++ b/helotraining_rewrite.Altis/loadSquad.sqf
@@ -1,4 +1,4 @@
-diag_log format["loadSquad called, _this: %1", _this];
+//diag_log format["loadSquad called, _this: %1", _this];
private _vehicle = _this select 0;
private _squad = _this select 1;
private _fromTaskId = _this select 2;
@@ -20,7 +20,7 @@ scopeName "main";
while {true} do
{
scopeName "loadingLoop";
- diag_log format["loadSquad: ticking %1", _this];
+ //diag_log format["loadSquad: ticking %1", _this];
if ({alive _x} count units _squad == 0) then
{
// Everybody died before boarding :(
@@ -38,4 +38,4 @@ while {true} do
[_squadCmdr, format["%1, everyone is onboard, you're clear to lift off", name _pilot]] remoteExec ["sideChat", _side];
-diag_log format["loadSquad done, _this: %1", _this];
+//diag_log format["loadSquad done, _this: %1", _this];
diff --git a/helotraining_rewrite.Altis/mission.sqm b/helotraining_rewrite.Altis/mission.sqm
index c77dbc4..285f6fb 100644
--- a/helotraining_rewrite.Altis/mission.sqm
+++ b/helotraining_rewrite.Altis/mission.sqm
@@ -16,7 +16,7 @@ class EditorData
};
class Camera
{
- pos[]={14297.817,83.489143,15876.068};
+ pos[]={14534.677,467.11179,15490.579};
dir[]={-0.18160321,-0.59209311,0.78515315};
up[]={-0.13343464,0.80584365,0.57689732};
aside[]={0.97428519,1.8044375e-009,0.22534904};
diff --git a/helotraining_rewrite.Altis/onPlayerRespawn.sqf b/helotraining_rewrite.Altis/onPlayerRespawn.sqf
new file mode 100644
index 0000000..bf0b255
--- /dev/null
+++ b/helotraining_rewrite.Altis/onPlayerRespawn.sqf
@@ -0,0 +1 @@
+player addRating 9999;
diff --git a/helotraining_rewrite.Altis/playerVehicleInList.sqf b/helotraining_rewrite.Altis/playerVehicleInList.sqf
index a836512..8298bce 100644
--- a/helotraining_rewrite.Altis/playerVehicleInList.sqf
+++ b/helotraining_rewrite.Altis/playerVehicleInList.sqf
@@ -7,12 +7,12 @@ scopeName "main";
{
private _plr = _x;
private _veh = vehicle _plr;
- if ( (_plr != _veh) && (isLanded _veh) && (_veh in _triggerList) ) then
+ if ( (_plr != _veh) && ([_veh] call isLanded) && (_veh in _triggerList) ) then
{
_returnValue = _veh;
breakTo "main";
}
} forEach _justPlayers;
-diag_log format["playerVehicleInList returning: %1 (driver: %2)", _returnValue, driver _returnValue];
+//diag_log format["playerVehicleInList returning: %1", _returnValue];
_returnValue
\ No newline at end of file
diff --git a/helotraining_rewrite.Altis/playerVehicleInListBool.sqf b/helotraining_rewrite.Altis/playerVehicleInListBool.sqf
index 8b92c3c..4f809f1 100644
--- a/helotraining_rewrite.Altis/playerVehicleInListBool.sqf
+++ b/helotraining_rewrite.Altis/playerVehicleInListBool.sqf
@@ -1,4 +1,4 @@
-diag_log format["playerVehicleInListBool called, _this: %1", _this];
+//ag_log format["playerVehicleInListBool called, _this: %1", _this];
private _triggerList = _this select 0;
private _returnValue = false;
@@ -7,5 +7,5 @@ if (!(([_triggerList] call playerVehicleInList) isEqualTo false)) then
_returnValue = true;
};
-diag_log format["playerVehicleInListBool returning: %1", _returnValue];
+//ag_log format["playerVehicleInListBool returning: %1", _returnValue];
_returnValue
\ No newline at end of file
diff --git a/helotraining_rewrite.Altis/precompile.sqf b/helotraining_rewrite.Altis/precompile.sqf
index 861042e..6a804f9 100644
--- a/helotraining_rewrite.Altis/precompile.sqf
+++ b/helotraining_rewrite.Altis/precompile.sqf
@@ -1,21 +1,21 @@
-// Compile helpers
-createDropoffLZ = compile preProcessfile "createDropoffLZ.sqf";
-createPickupLZ = compile preProcessfile "createPickupLZ.sqf";
+// compileFinal helpers
+createDropoffLZ = compileFinal preProcessfile "createDropoffLZ.sqf";
+createPickupLZ = compileFinal preProcessfile "createPickupLZ.sqf";
-createSquad = compile preProcessfile "createSquad.sqf";
-createEnemySquads = compile preProcessfile "createEnemySquads.sqf";
-loadSquad = compile preProcessfile "loadSquad.sqf";
-ejectSquad = compile preProcessfile "ejectSquad.sqf";
-spawnSmokeBySquad = compile preProcessfile "spawnSmokeBySquad.sqf";
+createSquad = compileFinal preProcessfile "createSquad.sqf";
+createEnemySquads = compileFinal preProcessfile "createEnemySquads.sqf";
+loadSquad = compileFinal preProcessfile "loadSquad.sqf";
+ejectSquad = compileFinal preProcessfile "ejectSquad.sqf";
+spawnSmokeBySquad = compileFinal preProcessfile "spawnSmokeBySquad.sqf";
-deleteSquads = compile preProcessfile "deleteSquads.sqf";
-playerVehicleInList = compile preProcessfile "playerVehicleInList.sqf";
-playerVehicleInListBool = compile preProcessfile "playerVehicleInListBool.sqf";
-getSideTasks = compile preProcessfile "getSideTasks.sqf";
-getSideActiveTasks = compile preProcessfile "getSideActiveTasks.sqf";
-isLanded = compile preProcessfile "isLanded.sqf";
-selectLZ = compile preProcessfile "selectLZ.sqf";
+deleteSquads = compileFinal preProcessfile "deleteSquads.sqf";
+playerVehicleInList = compileFinal preProcessfile "playerVehicleInList.sqf";
+playerVehicleInListBool = compileFinal preProcessfile "playerVehicleInListBool.sqf";
+getSideTasks = compileFinal preProcessfile "getSideTasks.sqf";
+getSideActiveTasks = compileFinal preProcessfile "getSideActiveTasks.sqf";
+isLanded = compileFinal preProcessfile "isLanded.sqf";
+selectLZ = compileFinal preProcessfile "selectLZ.sqf";
-taskSpawner = compile preProcessfile "taskSpawner.sqf";
-xenoRepair = compile preProcessfile "xenoRepair.sqf";
-vehicleInit = compile preProcessfile "vehicleInit.sqf";
+taskSpawner = compileFinal preProcessfile "taskSpawner.sqf";
+xenoRepair = compileFinal preProcessfile "xenoRepair.sqf";
+vehicleInit = compileFinal preProcessfile "vehicleInit.sqf";
diff --git a/helotraining_rewrite.Altis/selectLZ.sqf b/helotraining_rewrite.Altis/selectLZ.sqf
index b02b7b7..11049a0 100644
--- a/helotraining_rewrite.Altis/selectLZ.sqf
+++ b/helotraining_rewrite.Altis/selectLZ.sqf
@@ -1,13 +1,38 @@
-diag_log format["selectLZ called, _this: %1", _this];
+//diag_log format["selectLZ called, _this: %1", _this];
private _excludeList = _this select 0;
private _returnValue = false;
-private _candidates = lzList - _excludeList;
-private _tasks = [west] call getSideActiveTasks;
+private _candidates = lzList;
+if (!(_excludeList isEqualTo false)) then
+{
+ _candidates = _candidates - _excludeList;
+};
+private _taskLocations = [];
+{
+ _taskLocations = _taskLocations + [([_x] call BIS_fnc_taskDestination)];
+} forEach ([west] call getSideActiveTasks);
scopeName "main";
-while {true};
+while {true} do
+{
+ scopeName "selectloop";
+ private _usable = true;
+ private _candidate = _candidates call BIS_fnc_SelectRandom;
+ {
+ scopeName "checkloop";
+ private _dist = _candidate distance _x;
+ if (_dist < (4*lzSize)) then
+ {
+ _usable = false;
+ breakOut "checkloop";
+ };
+ } forEach _taskLocations;
+ if (_usable) then
+ {
+ _returnValue = _candidate;
+ breakOut "selectloop";
+ };
+};
-
-diag_log format["selectLZ returning: %1", _returnValue];
+//diag_log format["selectLZ returning: %1", _returnValue];
_returnValue
\ No newline at end of file
diff --git a/helotraining_rewrite.Altis/taskSpawner.sqf b/helotraining_rewrite.Altis/taskSpawner.sqf
index 33e0c91..2dd2bf4 100644
--- a/helotraining_rewrite.Altis/taskSpawner.sqf
+++ b/helotraining_rewrite.Altis/taskSpawner.sqf
@@ -1,33 +1,48 @@
diag_log "taskSpawner called";
+private _lzexclude = _this select 0;
+private _respawn = missionNamespace getVariable ("respawn_west");
+private _tryAssignPlr = true;
+
+
scopeName "main";
while {true} do
{
scopeName "mainloop";
private _justPlayers = (call BIS_fnc_listPlayers) - entities "HeadlessClient_F";
- diag_log format["taskSpawner: active tasks: %1 players: %2", (count ([west] call getSideActiveTasks)), (count _justPlayers)];
- while {count ([west] call getSideActiveTasks) < count _justPlayers} do
+ private _alivePlayers = [];
+ {
+ if (alive _x) then
+ {
+ _alivePlayers = _alivePlayers + [_x];
+ };
+ } forEach _justPlayers;
+ while {count ([west] call getSideActiveTasks) < count _alivePlayers} do
{
scopename "spawnloop";
+ diag_log format["taskSpawner: active tasks: %1 players: %2", (count ([west] call getSideActiveTasks)), (count _alivePlayers)];
// TODO: Filter the list so that locations near currently active tasks are not considered
- private _newLZLocation = lzList call BIS_fnc_SelectRandom;
+ private _newLZLocation = [_lzexclude] call selectLZ;
private _plrAssigned = false;
+ if (_tryAssignPlr) then
{
- scopename "playerloop";
- private _plr = _x;
- diag_log format["taskSpawner: checking if %1 is free to take a pickup", _plr];
- if (count (_plr call BIS_fnc_tasksUnit) == 0) then
{
- [_newLZLocation, [_plr]] spawn createPickupLZ;
- _plrAssigned = true;
- breakTo "spawnloop";
- };
- } forEach _justPlayers;
+ scopename "playerloop";
+ private _plr = _x;
+ diag_log format["taskSpawner: checking if %1 is free to take a pickup", _plr];
+ if (count (_plr call BIS_fnc_tasksUnit) == 0) then
+ {
+ [_newLZLocation, [_plr]] spawn createPickupLZ;
+ _plrAssigned = true;
+ breakTo "spawnloop";
+ };
+ } forEach _alivePlayers;
+ };
if (!_plrAssigned) then
{
[_newLZLocation, false] spawn createPickupLZ;
};
// rate limit
- sleep 1;
+ sleep 10;
};
- sleep 10;
+ sleep 5;
};
diff --git a/helotraining_rewrite.Altis/vehicleInit.sqf b/helotraining_rewrite.Altis/vehicleInit.sqf
index 7251cdd..08661b4 100644
--- a/helotraining_rewrite.Altis/vehicleInit.sqf
+++ b/helotraining_rewrite.Altis/vehicleInit.sqf
@@ -1,9 +1,5 @@
-diag_log format["vehicleIinit called, _this: %1", _this];
+//diag_log format["vehicleIinit called, _this: %1", _this];
_vehicle = _this select 0;
-_pilot = _this select 1;
-diag_log format["vehicleIinit called, _this: %1", _this];
-[_vehicle, ["Repair", "xenoRepair.sqf"]] remoteExec ["addAction", 0, netId _vehicle];
-
-_pilot addRating 9999;
\ No newline at end of file
+[_vehicle, ["Repair", { [_this select 0] spawn xenoRepair; }]] remoteExec ["addAction", 0, netId _vehicle];