diff --git a/helotraining_rewrite.Altis/createDropoffLZ.sqf b/helotraining_rewrite.Altis/createDropoffLZ.sqf index a949b5a..49c7d3d 100644 --- a/helotraining_rewrite.Altis/createDropoffLZ.sqf +++ b/helotraining_rewrite.Altis/createDropoffLZ.sqf @@ -44,7 +44,8 @@ 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,"AUTOASSIGNED",1,true, _taskType, true] call BIS_fnc_taskCreate; +[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],getPos _lzLocation,"CREATED",(STARTPRIORITY-lzCounter),true, _taskType, true] call BIS_fnc_taskCreate; +_assignToPlayer setCurrentTask _taskid; private _trg = createTrigger["EmptyDetector",getPos _lzLocation, false]; _trg setTriggerArea[lzSize,lzSize,0,false]; diff --git a/helotraining_rewrite.Altis/createPickupLZ.sqf b/helotraining_rewrite.Altis/createPickupLZ.sqf index 82c7ad1..bad2031 100644 --- a/helotraining_rewrite.Altis/createPickupLZ.sqf +++ b/helotraining_rewrite.Altis/createPickupLZ.sqf @@ -25,16 +25,24 @@ if (_lzhot) then lzCounter = lzCounter + 1; publicVariable "lzCounter"; +private _side = side _squad; +private _squadCmdr = (units _squad) select 0; +private _lzLocationName = text ((nearestLocations [getPos _lzLocation, ["NameCityCapital", "NameCity", "NameVillage"], 1500]) select 0); +[[_side, "HQ"], format["%1 is requesting pickup from near %2", groupId _squad, _lzLocationName]] remoteExec ["sideChat", _side]; + + private _shortestDesc = format["LZ %1", lzCounter]; private _longdesc = format["%1 wants a pickup from this location", _squad]; private _shortdesc = format["Pick up %1", _squad]; if (_lzAA and _lzhot) then { _longdesc = _longdesc + "
Be advised: Intel reports heavy enemy activity with AA assets at the location"; + [_squadCmdr, "Be advised, LZ is very hot with AA assets present"] remoteExec ["sideChat", _side]; }; if (!_lzAA and _lzhot) then { _longdesc = _longdesc + "
Be advised: Intel reports enemy activity at the location"; + [_squadCmdr, "Be advised, LZ is hot"] remoteExec ["sideChat", _side]; }; private _assignTo = [west]; @@ -43,9 +51,12 @@ if (!(_assignExtra isEqualTo false)) then _assignTo = _assignTo + _assignExtra; }; + + // PONDER: make a parent task "ferry squad X" ?? private _taskid = format["pickup_%1", lzCounter]; -[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],getPos _lzLocation,"AUTOASSIGNED",1,true, "meet", true] call BIS_fnc_taskCreate; +[_assignTo,[_taskid],[_longdesc, _shortdesc, _shortestDesc],getPos _lzLocation,"AUTOASSIGNED",(STARTPRIORITY-lzCounter),true, "meet", true] call BIS_fnc_taskCreate; +(_assignExtra select 0) setCurrentTask _taskid; if (bSmoke) then { diff --git a/helotraining_rewrite.Altis/ejectSquad.sqf b/helotraining_rewrite.Altis/ejectSquad.sqf index ae5cf2b..894d4dd 100644 --- a/helotraining_rewrite.Altis/ejectSquad.sqf +++ b/helotraining_rewrite.Altis/ejectSquad.sqf @@ -3,6 +3,9 @@ private _lz = _this select 0; private _vehicle = _this select 1; private _squad = _this select 2; private _fromTaskId = _this select 3; +private _pilot = driver _vehicle; +private _side = side _squad; +private _squadCmdr = (units _squad) select 0; deleteWaypoint [_squad,1]; @@ -13,6 +16,8 @@ deleteWaypoint [_squad,1]; private _wp = _squad addwaypoint [_lz,5,1]; _wp setwaypointType "MOVE"; +[_squadCmdr, format["%1, please standby as we're getting off.", name _pilot]] remoteExec ['sideChat', _side]; + scopeName "main"; while {true} do { @@ -26,4 +31,7 @@ while {true} do }; sleep 2; }; + +[_squadCmdr, format["%1, everyone is out, you're clear to lift off", name _pilot]] remoteExec ['sideChat', _side]; + diag_log format["ejectSquad done, _this: %1", _this]; diff --git a/helotraining_rewrite.Altis/init.sqf b/helotraining_rewrite.Altis/init.sqf index 327beb1..dbe41f4 100644 --- a/helotraining_rewrite.Altis/init.sqf +++ b/helotraining_rewrite.Altis/init.sqf @@ -1,18 +1,19 @@ // Config constant globals LZCOUNT = 86; +STARTPRIORITY = 1000; // Precompile code execVM "precompile.sqf"; -//Handle MP parameters -execVM "readparams.sqf"; - // We can't run this before if (isServer) then { + //Handle MP parameters + _handle = execVM "readparams.sqf"; + waitUntil {isNull _handle}; execVM "taskSpawner.sqf"; }; // Flag init complete missionInitComplete = true; -publicVariable "missionInitComplete"; \ No newline at end of file +publicVariable "missionInitComplete"; diff --git a/helotraining_rewrite.Altis/initServer.sqf b/helotraining_rewrite.Altis/initServer.sqf index ddc62ff..f1b4ee2 100644 --- a/helotraining_rewrite.Altis/initServer.sqf +++ b/helotraining_rewrite.Altis/initServer.sqf @@ -1 +1,3 @@ -// This is actually a bit early to do anything. +// Keep track of how many LZ we have created, used to give tasks unique names and priorities +lzCounter = 0; +publicVariable "lzCounter"; diff --git a/helotraining_rewrite.Altis/loadSquad.sqf b/helotraining_rewrite.Altis/loadSquad.sqf index 234379b..8e55ce1 100644 --- a/helotraining_rewrite.Altis/loadSquad.sqf +++ b/helotraining_rewrite.Altis/loadSquad.sqf @@ -2,6 +2,10 @@ diag_log format["loadSquad called, _this: %1", _this]; private _vehicle = _this select 0; private _squad = _this select 1; private _fromTaskId = _this select 2; +private _pilot = driver _vehicle; +private _side = side _squad; +private _squadCmdr = (units _squad) select 0; + {_x assignAsCargo _vehicle} foreach units _squad; {[_x] ordergetin true} foreach units _squad; @@ -10,6 +14,8 @@ private _fromTaskId = _this select 2; private _wp = _squad addwaypoint [_vehicle,5,1]; _wp setwaypointType "GETIN"; +[_squadCmdr, format["%1, please standby as we're loading up.", name _pilot]] remoteExec ["sideChat", _side]; + scopeName "main"; while {true} do { @@ -29,4 +35,7 @@ while {true} do }; sleep 2; }; + +[_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]; diff --git a/helotraining_rewrite.Altis/mission.sqm b/helotraining_rewrite.Altis/mission.sqm index ac300fa..2b6f21b 100644 --- a/helotraining_rewrite.Altis/mission.sqm +++ b/helotraining_rewrite.Altis/mission.sqm @@ -8,7 +8,7 @@ class EditorData toggles=1; class ItemIDProvider { - nextID=134; + nextID=147; }; class MarkerIDProvider { @@ -16,10 +16,10 @@ class EditorData }; class Camera { - pos[]={14253.876,161.88496,15821.944}; - dir[]={0.081877343,-0.63147533,0.7711519}; - up[]={0.066685185,0.77530128,0.62804556}; - aside[]={0.99447972,4.1961903e-007,-0.10559266}; + pos[]={14290.831,164.33411,15773.51}; + dir[]={-0.18160321,-0.59209311,0.78515315}; + up[]={-0.13343464,0.80584365,0.57689732}; + aside[]={0.97428519,1.8044375e-009,0.22534904}; }; }; binarizationWanted=0; @@ -36,13 +36,14 @@ addons[]= "A3_Modules_F_Multiplayer", "A3_Characters_F", "A3_Modules_F", - "cba_main" + "cba_main", + "A3_Armor_F_Beta_APC_Wheeled_01" }; class AddonsMetaData { class List { - items=8; + items=9; class Item0 { className="A3_Ui_F"; @@ -99,6 +100,13 @@ class AddonsMetaData author="CBA Team"; url="https://www.github.com/CBATeam/CBA_A3"; }; + class Item8 + { + className="A3_Armor_F_Beta"; + name="Arma 3 Beta - Armored Land Vehicles"; + author="Bohemia Interactive"; + url="http://www.arma3.com"; + }; }; }; randomSeed=14406749; @@ -408,7 +416,7 @@ class Mission }; class Entities { - items=115; + items=119; class Item0 { dataType="Marker"; @@ -567,7 +575,8 @@ class Mission dataType="Logic"; class PositionInfo { - position[]={14269.223,18.337202,16021.074}; + position[]={14264.385,18.635801,16031.822}; + angles[]={6.2711902,0,6.2605233}; }; name="chopperRespawn"; id=9; @@ -2392,16 +2401,286 @@ class Mission type="CBA_main_require"; atlOffset=-8.7738037e-005; }; + class Item115 + { + dataType="Group"; + side="West"; + class Entities + { + items=4; + class Item0 + { + dataType="Object"; + class PositionInfo + { + position[]={14268.474,18.13788,15888.054}; + angles[]={0.014664836,2.7202222,6.2631893}; + }; + side="West"; + flags=4; + class Attributes + { + }; + id=136; + type="B_crew_F"; + }; + class Item1 + { + dataType="Object"; + class PositionInfo + { + position[]={14268.474,18.13788,15888.054}; + angles[]={0.014664836,2.7202222,6.2631893}; + }; + side="West"; + flags=6; + class Attributes + { + }; + id=137; + type="B_crew_F"; + }; + class Item2 + { + dataType="Object"; + class PositionInfo + { + position[]={14268.474,18.13788,15888.054}; + angles[]={0.014664836,2.7202222,6.2631893}; + }; + side="West"; + flags=4; + class Attributes + { + }; + id=138; + type="B_crew_F"; + }; + class Item3 + { + dataType="Waypoint"; + position[]={14267.931,17.781204,15868.208}; + type="Guard"; + class Effects + { + }; + showWP="NEVER"; + id=146; + atlOffset=8.5830688e-005; + }; + }; + class Attributes + { + }; + class CrewLinks + { + class LinkIDProvider + { + nextID=3; + }; + class Links + { + items=3; + class Item0 + { + linkID=0; + item0=136; + item1=135; + class CustomData + { + role=1; + }; + }; + class Item1 + { + linkID=1; + item0=137; + item1=135; + class CustomData + { + role=2; + turretPath[]={0,0}; + }; + }; + class Item2 + { + linkID=2; + item0=138; + item1=135; + class CustomData + { + role=2; + turretPath[]={0}; + }; + }; + }; + }; + id=134; + atlOffset=-0.0016822815; + }; + class Item116 + { + dataType="Object"; + class PositionInfo + { + position[]={14268.503,20.5984,15887.951}; + angles[]={0.014664836,2.7202222,6.2631893}; + }; + side="West"; + flags=6; + class Attributes + { + }; + id=135; + type="B_APC_Wheeled_01_cannon_F"; + atlOffset=-0.0016822815; + }; + class Item117 + { + dataType="Group"; + side="West"; + class Entities + { + items=4; + class Item0 + { + dataType="Object"; + class PositionInfo + { + position[]={14344.261,17.931919,16131.581}; + angles[]={6.2818484,6.0772042,6.2765174}; + }; + side="West"; + flags=4; + class Attributes + { + }; + id=141; + type="B_crew_F"; + atlOffset=0.00018501282; + }; + class Item1 + { + dataType="Object"; + class PositionInfo + { + position[]={14344.261,17.931919,16131.581}; + angles[]={6.2818484,6.0772042,6.2765174}; + }; + side="West"; + flags=6; + class Attributes + { + }; + id=142; + type="B_crew_F"; + atlOffset=0.00018501282; + }; + class Item2 + { + dataType="Object"; + class PositionInfo + { + position[]={14344.261,17.931919,16131.581}; + angles[]={6.2818484,6.0772042,6.2765174}; + }; + side="West"; + flags=4; + class Attributes + { + }; + id=143; + type="B_crew_F"; + atlOffset=0.00018501282; + }; + class Item3 + { + dataType="Waypoint"; + position[]={14358.525,17.717602,16107.497}; + type="Guard"; + class Effects + { + }; + showWP="NEVER"; + id=145; + }; + }; + class Attributes + { + }; + class CrewLinks + { + class LinkIDProvider + { + nextID=3; + }; + class Links + { + items=3; + class Item0 + { + linkID=0; + item0=141; + item1=140; + class CustomData + { + role=1; + }; + }; + class Item1 + { + linkID=1; + item0=142; + item1=140; + class CustomData + { + role=2; + turretPath[]={0,0}; + }; + }; + class Item2 + { + linkID=2; + item0=143; + item1=140; + class CustomData + { + role=2; + turretPath[]={0}; + }; + }; + }; + }; + id=139; + atlOffset=0.00018501282; + }; + class Item118 + { + dataType="Object"; + class PositionInfo + { + position[]={14344.277,20.39312,16131.528}; + angles[]={6.2818484,6.0772042,6.2765174}; + }; + side="West"; + flags=6; + class Attributes + { + }; + id=140; + type="B_APC_Wheeled_01_cannon_F"; + atlOffset=0.00018501282; + }; }; class Connections { class LinkIDProvider { - nextID=7; + nextID=9; }; class Links { - items=7; + items=9; class Item0 { linkID=0; @@ -2472,6 +2751,26 @@ class Mission type="Sync"; }; }; + class Item7 + { + linkID=7; + item0=135; + item1=9; + class CustomData + { + type="Sync"; + }; + }; + class Item8 + { + linkID=8; + item0=140; + item1=9; + class CustomData + { + type="Sync"; + }; + }; }; }; }; diff --git a/helotraining_rewrite.Altis/playerVehicleInList.sqf b/helotraining_rewrite.Altis/playerVehicleInList.sqf index 050344a..952e5da 100644 --- a/helotraining_rewrite.Altis/playerVehicleInList.sqf +++ b/helotraining_rewrite.Altis/playerVehicleInList.sqf @@ -2,6 +2,7 @@ diag_log format["playerVehicleInList called, _this: %1", _this]; private _triggerList = _this select 0; private _returnValue = false; +private _justPlayers = (call BIS_fnc_listPlayers) - entities "HeadlessClient_F"; scopeName "main"; { private _plr = _x; @@ -11,7 +12,7 @@ scopeName "main"; _returnValue = _veh; breakTo "main"; } -} forEach (call BIS_fnc_listPlayers); +} forEach _justPlayers; -diag_log format["playerVehicleInList returning: %1", _returnValue]; +diag_log format["playerVehicleInList returning: %1 (driver: %2)", _returnValue, driver _returnValue]; _returnValue \ No newline at end of file diff --git a/helotraining_rewrite.Altis/precompile.sqf b/helotraining_rewrite.Altis/precompile.sqf index 5cf1a0d..fdf8c1a 100644 --- a/helotraining_rewrite.Altis/precompile.sqf +++ b/helotraining_rewrite.Altis/precompile.sqf @@ -15,3 +15,5 @@ getSideTasks = compile preProcessfile "getSideTasks.sqf"; getSideActiveTasks = compile preProcessfile "getSideActiveTasks.sqf"; taskSpawner = compile preProcessfile "taskSpawner.sqf"; +xenoRepair = compile preProcessfile "xenoRepair.sqf"; +vehicleInit = compile preProcessfile "vehicleInit.sqf"; diff --git a/helotraining_rewrite.Altis/readparams.sqf b/helotraining_rewrite.Altis/readparams.sqf index 6401350..19b46ec 100644 --- a/helotraining_rewrite.Altis/readparams.sqf +++ b/helotraining_rewrite.Altis/readparams.sqf @@ -36,9 +36,3 @@ while {_x < LZCOUNT} do lzList = lzList + [_lz]; _x = _x + 1; }; - -publicVariable "lzList"; - -// Keep track of how many LZ we have created, used to give tasks unique names and priorities -lzCounter = 0; -publicVariable "lzCounter"; diff --git a/helotraining_rewrite.Altis/vehicleInit.sqf b/helotraining_rewrite.Altis/vehicleInit.sqf index 5415915..7251cdd 100644 --- a/helotraining_rewrite.Altis/vehicleInit.sqf +++ b/helotraining_rewrite.Altis/vehicleInit.sqf @@ -2,3 +2,8 @@ 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 diff --git a/helotraining_rewrite.Altis/xenoRepair.sqf b/helotraining_rewrite.Altis/xenoRepair.sqf new file mode 100644 index 0000000..a2399cf --- /dev/null +++ b/helotraining_rewrite.Altis/xenoRepair.sqf @@ -0,0 +1,107 @@ +// by Xeno +private ["_config","_count","_i","_magazines","_object","_type","_type_name"]; + +_object = _this select 0; + +_type = typeof _object; + +if (_object isKindOf "ParachuteBase") exitWith {}; + +if (isNil "x_reload_time_factor") then {x_reload_time_factor = 1;}; + +//if (!local _object) exitWith {}; + +if (!alive _object) exitWith {}; +_object setFuel 0; +_object setVehicleAmmo 1; // Reload turrets / drivers magazine + +_type_name = typeOf _object; + +_object vehicleChat format ["Servicing %1... Please stand by...", _type]; + +_magazines = getArray(configFile >> "CfgVehicles" >> _type >> "magazines"); + +if (count _magazines > 0) then { + _removed = []; + { + if (!(_x in _removed)) then { + _object removeMagazines _x; + _removed set [count _removed, _x]; + }; + } forEach _magazines; + { + _object vehicleChat format ["Reloading %1", _x]; + sleep x_reload_time_factor; + if (!alive _object) exitWith {}; + _object addMagazine _x; + } forEach _magazines; +}; + +_count = count (configFile >> "CfgVehicles" >> _type >> "Turrets"); + +if (_count > 0) then { + for "_i" from 0 to (_count - 1) do { + scopeName "xx_reload2_xx"; + _config = (configFile >> "CfgVehicles" >> _type >> "Turrets") select _i; + _magazines = getArray(_config >> "magazines"); + _removed = []; + { + if (!(_x in _removed)) then { + _object removeMagazines _x; + _removed set [count _removed, _x]; + }; + } forEach _magazines; + { + _object vehicleChat format ["Reloading %1", _x]; + sleep x_reload_time_factor; + if (!alive _object) then {breakOut "xx_reload2_xx"}; + _object addMagazine _x; + sleep x_reload_time_factor; + if (!alive _object) then {breakOut "xx_reload2_xx"}; + } forEach _magazines; + // check if the main turret has other turrets + _count_other = count (_config >> "Turrets"); + // this code doesn't work, it's not possible to load turrets that are part of another turret ?? + // nevertheless, I leave it here + if (_count_other > 0) then { + for "_i" from 0 to (_count_other - 1) do { + _config2 = (_config >> "Turrets") select _i; + _magazines = getArray(_config2 >> "magazines"); + _removed = []; + { + if (!(_x in _removed)) then { + _object removeMagazines _x; + _removed set [count _removed, _x]; + }; + } forEach _magazines; + { + _object vehicleChat format ["Reloading %1", _x]; + sleep x_reload_time_factor; + if (!alive _object) then {breakOut "xx_reload2_xx"}; + _object addMagazine _x; + sleep x_reload_time_factor; + if (!alive _object) then {breakOut "xx_reload2_xx"}; + } forEach _magazines; + }; + }; + }; +}; +_object setVehicleAmmo 1; // Reload turrets / drivers magazine + +sleep x_reload_time_factor; +if (!alive _object) exitWith {}; +_object vehicleChat "Repairing..."; +_object setDamage 0; +sleep x_reload_time_factor; +if (!alive _object) exitWith {}; +_object vehicleChat "Refueling..."; +while {fuel _object < 0.99} do { + //_object setFuel ((fuel _vehicle + 0.1) min 1); + _object setFuel 1; + sleep 0.01; +}; +sleep x_reload_time_factor; +if (!alive _object) exitWith {}; +_object vehicleChat format ["%1 is ready...", _type_name]; + +if (true) exitWith {}; \ No newline at end of file