Skip to content

Commit

Permalink
Patch to fix secure and resupply mission
Browse files Browse the repository at this point in the history
  • Loading branch information
theace0296 committed Oct 19, 2021
1 parent bb121cd commit 6b63cd5
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 40 deletions.
36 changes: 14 additions & 22 deletions RandFramework/Global/common/fn_supplyHelicopter.sqf
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// private _fnc_scriptName = "TRGM_GLOBAL_fnc_supplyHelicopter";


params ["_finishedVariable", "_finishedValue", "_side", "_spawnPos", "_exitPos", "_destPos", "_unit"];

format["SupplyHelicopter: %1, %2, %3, %4, %5, %6, %7", _finishedVariable, _finishedValue, _side, _spawnPos, _exitPos, _destPos, _unit] call TRGM_GLOBAL_fnc_log;
Expand Down Expand Up @@ -36,25 +34,19 @@ _heloGroup setCombatMode "BLUE";
_airDropHelo setCaptive true;
} forEach crew _airDropHelo;

_airDropHelo setVariable ["TRGM_VAR_DroppedCrate", false];

private _v1wp1 = _heloGroup addWaypoint [[(_spawnPos select 0), (_spawnPos select 1)], 100];
[_heloGroup, 0] setWaypointStatements ["true", "(vehicle this) flyInHeight 200;"];
[_heloGroup, 0] setWaypointSpeed "FULL";
[_heloGroup, 0] setWaypointBehaviour "COMBAT";

private _v1wp2 = _heloGroup addWaypoint [[(_destPos select 0), (_destPos select 1)], 100];
[_heloGroup, 1] setWaypointStatements ["true", "(vehicle this) flyInHeight 200; "];
[_heloGroup, 1] setWaypointSpeed "FULL";

private _v1wp3 = _heloGroup addWaypoint [[(_exitPos select 0), (_exitPos select 1)], 100];
[_heloGroup, 2] setWaypointStatements ["true", "(vehicle this) flyInHeight 200; (vehicle this) setVariable ['TRGM_VAR_DroppedCrate', true];"];
[_heloGroup, 2] setWaypointSpeed "FULL";
_airDropHelo doMove [(_spawnPos select 0), (_spawnPos select 1), 200];
waitUntil {
sleep 2;
(_airDropHelo distance2D [(_spawnPos select 0), (_spawnPos select 1), 200]) < 100;
};

_airDropHelo doMove [(_destPos select 0), (_destPos select 1), 200];
waitUntil {
sleep 2;
_airDropHelo getVariable ["TRGM_VAR_DroppedCrate", false];
(_airDropHelo distance2D [(_destPos select 0), (_destPos select 1), 200]) < 100;
};

_airDropHelo doMove [(_exitPos select 0), (_exitPos select 1), 200];
sleep 1;

private _supplyObjectDummy = "B_supplyCrate_f" createVehicle[0, 0, 200];
Expand Down Expand Up @@ -86,15 +78,15 @@ deleteVehicle _supplyObjectDummy;
"SmokeShellBlue" createVehicle _finalPos;
sleep 0.1;
private _supplyObject = "B_supplyCrate_f" createVehicle _finalPos;
if !(isNil "_unit") then {
[_supplyObject, (units group _unit)] call TRGM_GLOBAL_fnc_initAmmoBox;
};
try {
if !(isNil "_unit") then {
[_supplyObject, (units group _unit)] call TRGM_GLOBAL_fnc_initAmmoBox;
};
} catch {};
_supplyObject allowDamage false;
[_supplyObject] call TRGM_GLOBAL_fnc_setVehicleUpright;
_supplyObject allowDamage true;

_airDropHelo setVariable ["TRGM_VAR_DroppedCrate", false];

{
deleteVehicle _x;
}
Expand Down
16 changes: 11 additions & 5 deletions RandFramework/Missions/secureAndResupplyMission.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,16 @@ MISSION_fnc_CustomMission = { //This function is the main script for your missio
private _exitPos = _flag getRelPos[25000, random 360];
private _finishedVariable = format["SupplyDropped_%1", _iTaskIndex];
private _finishedValue = 1;
private _resupplyUnit = ((allPlayers - (entities "HeadlessClient_F")) select {(_x distance _flag) < 150});
[_finishedVariable, _finishedValue, TRGM_VAR_FriendlySide, _spawnPos, _exitPos, [_flag] call TRGM_GLOBAL_fnc_getRealPos, _resupplyUnit] spawn TRGM_GLOBAL_fnc_supplyHelicopter;
private _resupplyUnit = ((allPlayers - (entities "HeadlessClient_F")) select {(_x distance _flag) < 150}) select 0;
private _supplies1Handle = [_finishedVariable, _finishedValue, TRGM_VAR_FriendlySide, _spawnPos, _exitPos, [_flag] call TRGM_GLOBAL_fnc_getRealPos, _resupplyUnit] spawn TRGM_GLOBAL_fnc_supplyHelicopter;
waitUntil {
sleep 2;
missionNamespace getVariable[format["SupplyDropped_%1", _iTaskIndex], 0] isEqualTo _finishedValue;
(missionNamespace getVariable[format["SupplyDropped_%1", _iTaskIndex], 0] isEqualTo _finishedValue) || scriptDone _supplies1Handle;
};

if !(missionNamespace getVariable[format["SupplyDropped_%1", _iTaskIndex], 0] isEqualTo _finishedValue) then {
missionNamespace setVariable[format["SupplyDropped_%1", _iTaskIndex], _finishedValue];
};

_convoyVehicles = [call sTank1ArmedCar, selectRandom (call UnarmedScoutVehicles), selectRandom (call UnarmedScoutVehicles), selectRandom (call UnarmedScoutVehicles), call sTank1ArmedCar];
_convoyStartPos = _flag getRelPos[2000, random 360];
Expand Down Expand Up @@ -198,12 +201,15 @@ MISSION_fnc_CustomMission = { //This function is the main script for your missio


_finishedValue = 2;
[_finishedVariable, _finishedValue, TRGM_VAR_FriendlySide, _spawnPos, _exitPos, [_flag] call TRGM_GLOBAL_fnc_getRealPos, _resupplyUnit] spawn TRGM_GLOBAL_fnc_supplyHelicopter;
private _supplies2Handle = [_finishedVariable, _finishedValue, TRGM_VAR_FriendlySide, _spawnPos, _exitPos, [_flag] call TRGM_GLOBAL_fnc_getRealPos, _resupplyUnit] spawn TRGM_GLOBAL_fnc_supplyHelicopter;
waitUntil {
sleep 2;
missionNamespace getVariable[format["SupplyDropped_%1", _iTaskIndex], 0] isEqualTo _finishedValue;
(missionNamespace getVariable[format["SupplyDropped_%1", _iTaskIndex], 0] isEqualTo _finishedValue) || scriptDone _supplies2Handle;
};

if !(missionNamespace getVariable[format["SupplyDropped_%1", _iTaskIndex], 0] isEqualTo _finishedValue) then {
missionNamespace setVariable[format["SupplyDropped_%1", _iTaskIndex], _finishedValue];
};

[_flag] spawn TRGM_SERVER_fnc_updateTask;
};
Expand Down
23 changes: 10 additions & 13 deletions RandFramework/Server/objectives/fn_updateTask.sqf
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// private _fnc_scriptName = "TRGM_SERVER_fnc_updateTask";
format["%1 called by %2 on %3", _fnc_scriptName, _fnc_scriptNameParent, (["Client", "Server"] select isServer)] call TRGM_GLOBAL_fnc_log;


params ["_missionObjective", ["_missionStatus", "succeeded"], ["_customRepReason", ""], ["_customHintString", ""], ["_repAmountOnFail", 0]];

if (isNil "_missionObjective") exitWith {};
Expand Down Expand Up @@ -37,20 +36,18 @@ _args params ["_hintStrOnComplete", ["_repAmountOnComplete", 0], ["_repReasonOnC
TRGM_VAR_ClearedPositions pushBack [_centralAO_x, _centralAO_y];
publicVariable "TRGM_VAR_ClearedPositions";

if (!_bCreateTask) then {
if (_repAmountOnComplete > 0 && _repAmountOnFail isEqualTo 0) then {
[_repAmountOnComplete, [[_customRepReason, _repReasonOnComplete] select (_customRepReason isEqualTo ""), "Objective Completed."] select (_repReasonOnComplete isEqualTo "")] spawn TRGM_GLOBAL_fnc_adjustMaxBadPoints;
[[_customHintString, _hintStrOnComplete] select (_customHintString isEqualTo "")] call TRGM_GLOBAL_fnc_notifyGlobal;
} else {
if (_repAmountOnFail > 0) then {
[_repAmountOnFail, [_customRepReason, "Objective Failed."] select (_customRepReason isEqualTo "")] spawn TRGM_GLOBAL_fnc_adjustBadPoints;
[[_customHintString, _hintStrOnComplete] select (_customHintString isEqualTo "")] call TRGM_GLOBAL_fnc_notifyGlobal;
};
};
if (_repAmountOnComplete > 0 && _repAmountOnFail isEqualTo 0) then {
[_repAmountOnComplete, [[_customRepReason, _repReasonOnComplete] select (_customRepReason isEqualTo ""), "Objective Completed."] select (_repReasonOnComplete isEqualTo "")] spawn TRGM_GLOBAL_fnc_adjustMaxBadPoints;
[[_customHintString, _hintStrOnComplete] select (_customHintString isEqualTo "")] call TRGM_GLOBAL_fnc_notifyGlobal;
} else {
if (!([format["InfSide%1",_iTaskIndex]] call FHQ_fnc_ttAreTasksCompleted)) then {
[format["InfSide%1",_iTaskIndex], _missionStatus] remoteExec ["FHQ_fnc_ttSetTaskState", 0];
if (_repAmountOnFail > 0) then {
[_repAmountOnFail, [_customRepReason, "Objective Failed."] select (_customRepReason isEqualTo "")] spawn TRGM_GLOBAL_fnc_adjustBadPoints;
[[_customHintString, _hintStrOnComplete] select (_customHintString isEqualTo "")] call TRGM_GLOBAL_fnc_notifyGlobal;
};
};

if (!([format["InfSide%1",_iTaskIndex]] call FHQ_fnc_ttAreTasksCompleted)) then {
[format["InfSide%1",_iTaskIndex], _missionStatus] remoteExec ["FHQ_fnc_ttSetTaskState", 0];
};

true;

0 comments on commit 6b63cd5

Please sign in to comment.