Cooldown Parameter for mobile respawn

closes #187
This commit is contained in:
Christian 2017-10-10 15:59:11 +02:00
parent a8620be2cc
commit ffa5732db9
5 changed files with 96 additions and 67 deletions

View File

@ -1,31 +1,31 @@
private ["_old_fullmap", "_oldsel", "_standard_map_pos", "_frame_pos", "_access"];
choiceslist = [];
fullmap = 0;
_old_fullmap = 0;
_oldsel = -999;
_standard_map_pos = [];
_frame_pos = [];
private _old_fullmap = 0;
private _oldsel = -999;
private _standard_map_pos = [];
private _frame_pos = [];
GRLIB_force_redeploy = false;
waitUntil { !isNil "GRLIB_all_fobs" };
waitUntil { !isNil "blufor_sectors" };
waitUntil { !isNil "save_is_loaded" };
waitUntil {!isNil "GRLIB_all_fobs"};
waitUntil {!isNil "blufor_sectors"};
waitUntil {!isNil "save_is_loaded"};
_spawn_str = "";
private _spawn_str = "";
waitUntil { !isNil "introDone" };
waitUntil { introDone };
waitUntil { !isNil "cinematic_camera_stop" };
waitUntil { cinematic_camera_stop };
waitUntil {!isNil "introDone"};
waitUntil {introDone};
waitUntil {!isNil "cinematic_camera_stop"};
waitUntil {cinematic_camera_stop};
_basenamestr = "Operation Base";
private _basenamestr = "Operation Base";
KP_liberation_respawn_time = time;
KP_liberation_respawn_mobile_done = false;
while {true} do {
waitUntil {
sleep 0.1;
sleep 0.2;
(GRLIB_force_redeploy || (player distance (getmarkerpos GRLIB_respawn_marker) < 50)) && vehicle player == player && alive player && !dialog && howtoplay == 0
};
@ -34,11 +34,11 @@ while {true} do {
GRLIB_force_redeploy = false;
if ( !GRLIB_fatigue ) then {
if (!GRLIB_fatigue) then {
player enableStamina false;
};
_dialog = createDialog "liberation_deploy";
createDialog "liberation_deploy";
deploy = 0;
_oldsel = -999;
@ -51,42 +51,44 @@ while {true} do {
respawn_camera cameraEffect ["internal","back"];
respawn_camera camcommit 0;
waitUntil { dialog };
waitUntil {dialog};
((findDisplay 5201) displayCtrl 201) ctrlAddEventHandler [ "mouseButtonDblClick" , { deploy = 1; } ];
((findDisplay 5201) displayCtrl 201) ctrlAddEventHandler ["mouseButtonDblClick", {deploy = 1;}];
_standard_map_pos = ctrlPosition ((findDisplay 5201) displayCtrl 251);
_frame_pos = ctrlPosition ((findDisplay 5201) displayCtrl 198);
_saved_loadouts = profileNamespace getVariable "bis_fnc_saveInventory_data";
_loadouts_data = [];
_counter = 0;
if ( !isNil "_saved_loadouts" ) then {
private _saved_loadouts = profileNamespace getVariable "bis_fnc_saveInventory_data";
private _loadouts_data = [];
private _counter = 0;
if (!isNil "_saved_loadouts") then {
{
if ( _counter % 2 == 0 ) then {
if (_counter % 2 == 0) then {
_loadouts_data pushback _x;
};
_counter = _counter + 1;
} foreach _saved_loadouts;
} forEach _saved_loadouts;
};
lbAdd [ 203, "--"] ;
{ lbAdd [ 203, _x ]; } foreach _loadouts_data;
lbSetCurSel [ 203, 0 ];
lbAdd [203, "--"];
{lbAdd [203, _x];} forEach _loadouts_data;
lbSetCurSel [203, 0];
while { dialog && alive player && deploy == 0} do {
choiceslist = [ [ _basenamestr, getposATL startbase ] ];
while {dialog && alive player && deploy == 0} do {
choiceslist = [[_basenamestr, getposATL startbase]];
for [{_idx=0},{_idx < count GRLIB_all_fobs},{_idx=_idx+1}] do {
choiceslist = choiceslist + [[format [ "FOB %1 - %2", (military_alphabet select _idx),mapGridPosition (GRLIB_all_fobs select _idx) ],GRLIB_all_fobs select _idx]];
choiceslist = choiceslist + [[format ["FOB %1 - %2", (military_alphabet select _idx),mapGridPosition (GRLIB_all_fobs select _idx)],GRLIB_all_fobs select _idx]];
};
if (KP_liberation_mobilerespawn) then {
_respawn_trucks = call F_getMobileRespawns;
if (KP_liberation_respawn_time <= time) then {
private _respawn_trucks = call F_getMobileRespawns;
for [ {_idx=0},{_idx < count _respawn_trucks},{_idx=_idx+1} ] do {
choiceslist = choiceslist + [[format [ "%1 - %2", localize "STR_RESPAWN_TRUCK",mapGridPosition (getposATL (_respawn_trucks select _idx)) ],getposATL (_respawn_trucks select _idx),(_respawn_trucks select _idx)]];
};
for [ {_idx=0},{_idx < count _respawn_trucks},{_idx=_idx+1} ] do {
choiceslist = choiceslist + [[format ["%1 - %2", localize "STR_RESPAWN_TRUCK",mapGridPosition (getposATL (_respawn_trucks select _idx))],getposATL (_respawn_trucks select _idx),(_respawn_trucks select _idx)]];
};
};
};
lbClear 201;
@ -94,21 +96,21 @@ while {true} do {
lbAdd [201, (_x select 0)];
} foreach choiceslist;
if ( lbCurSel 201 == -1 ) then {
if (lbCurSel 201 == -1) then {
lbSetCurSel [201,0];
};
if ( lbCurSel 201 != _oldsel ) then {
if (lbCurSel 201 != _oldsel) then {
_oldsel = lbCurSel 201;
_objectpos = [0,0,0];
if ( dialog ) then {
private _objectpos = [0,0,0];
if (dialog) then {
_objectpos = ((choiceslist select _oldsel) select 1);
};
respawn_object setposATL ((choiceslist select _oldsel) select 1);
_startdist = 120;
_enddist = 120;
_alti = 35;
if ( dialog ) then {
private _startdist = 120;
private _enddist = 120;
private _alti = 35;
if (dialog) then {
if (((choiceslist select (lbCurSel 201)) select 0) == _basenamestr) then {
_startdist = 200;
_enddist = 300;
@ -132,9 +134,9 @@ while {true} do {
respawn_camera camcommit 90;
};
if ( _old_fullmap != fullmap ) then {
if (_old_fullmap != fullmap) then {
_old_fullmap = fullmap;
if ( fullmap % 2 == 1 ) then {
if (fullmap % 2 == 1) then {
((findDisplay 5201) displayCtrl 251) ctrlSetPosition [ (_frame_pos select 0) + (_frame_pos select 2), (_frame_pos select 1), (0.6 * safezoneW), (_frame_pos select 3)];
} else {
((findDisplay 5201) displayCtrl 251) ctrlSetPosition _standard_map_pos;
@ -142,24 +144,24 @@ while {true} do {
((findDisplay 5201) displayCtrl 251) ctrlCommit 0.2;
_oldsel = -1;
};
uiSleep 0.1;
};
if (dialog && deploy == 1) then {
_idxchoice = lbCurSel 201;
private _idxchoice = lbCurSel 201;
_spawn_str = (choiceslist select _idxchoice) select 0;
if (count (choiceslist select _idxchoice) == 3) then {
_truck = (choiceslist select _idxchoice) select 2;
player setposATL ([_truck, 5 + (random 3), random 360] call BIS_fnc_relPos)
private _truck = (choiceslist select _idxchoice) select 2;
player setposATL ([_truck, 5 + (random 3), random 360] call BIS_fnc_relPos);
KP_liberation_respawn_mobile_done = true;
} else {
_destpos = ((choiceslist select _idxchoice) select 1);
private _destpos = ((choiceslist select _idxchoice) select 1);
player setposATL [((_destpos select 0) + 5) - (random 10),((_destpos select 1) + 5) - (random 10),(_destpos select 2)];
};
if ( (lbCurSel 203) > 0 ) then {
[ player, [ profileNamespace, _loadouts_data select ((lbCurSel 203) - 1) ] ] call bis_fnc_loadInventory;
if ((lbCurSel 203) > 0) then {
[player, [profileNamespace, _loadouts_data select ((lbCurSel 203) - 1)]] call bis_fnc_loadInventory;
};
};
@ -175,8 +177,12 @@ while {true} do {
if (alive player && deploy == 1) then {
[_spawn_str] spawn spawn_camera;
if (KP_liberation_respawn_mobile_done) then {
KP_liberation_respawn_time = time + KP_liberation_respawn_cooldown;
KP_liberation_respawn_mobile_done = false;
};
};
if (KP_liberation_arsenalUsePreset) then {
_playerItems = [];
if ((headgear player) != "") then {_playerItems pushback (headgear player);};
@ -210,10 +216,16 @@ while {true} do {
};
};
if (KP_liberation_mobilerespawn && (KP_liberation_respawn_time > time)) then {
hint format [localize "STR_RESPAWN_COOLDOWN_HINT", ceil ((KP_liberation_respawn_time - time) / 60)];
sleep 3;
hint "";
};
// Arty Supp deactivated for now
/*if (KP_liberation_suppMod_enb > 0) then {
waitUntil {sleep 1; (!isNil "KP_liberation_suppMod_grp") && (!isNil "KP_liberation_suppMod_arty")};
_access = false;
private _access = false;
switch (KP_liberation_suppMod_enb) do {
case 1: {if (player == ([] call F_getCommander)) then {_access = true};};
case 2: {if ((getPlayerUID player) in KP_liberation_suppMod_whitelist) then {_access = true};};

View File

@ -40,6 +40,7 @@ if ( isMultiplayer ) then {
KP_liberation_logistic_debug = ["DebugLogistic",0] call bis_fnc_getParamValue;
KP_liberation_sectorspawn_debug = ["DebugSectorSpawn",0] call bis_fnc_getParamValue;
KP_liberation_kill_debug = ["DebugKill",0] call bis_fnc_getParamValue;
KP_liberation_respawn_cooldown = ["RespawnCooldown",900] call bis_fnc_getParamValue;
} else {
GRLIB_difficulty_modifier = 2;
GRLIB_time_factor = 12;
@ -82,19 +83,20 @@ if ( isMultiplayer ) then {
KP_liberation_logistic_debug = 0;
KP_liberation_sectorspawn_debug = 0;
KP_liberation_kill_debug = 0;
KP_liberation_respawn_cooldown = 900;
};
if ( GRLIB_fatigue < 0.1 ) then { GRLIB_fatigue = false } else { GRLIB_fatigue = true };
if ( GRLIB_introduction == 1 ) then { GRLIB_introduction = true } else { GRLIB_introduction = false };
if ( GRLIB_deployment_cinematic == 1 ) then { GRLIB_deployment_cinematic = true } else { GRLIB_deployment_cinematic = false };
if ( GRLIB_build_first_fob == 1 ) then { GRLIB_build_first_fob = true } else { GRLIB_build_first_fob = false };
if ( GRLIB_teamkill_penalty == 1 ) then { GRLIB_teamkill_penalty = true } else { GRLIB_teamkill_penalty = false };
if ( GRLIB_adaptive_opfor == 1 ) then { GRLIB_adaptive_opfor = true } else { GRLIB_adaptive_opfor = false };
if ( GRLIB_permissions_param == 1 ) then { GRLIB_permissions_param = true } else { GRLIB_permissions_param = false };
if ( GRLIB_use_whitelist == 1 ) then { GRLIB_use_whitelist = true } else { GRLIB_use_whitelist = false };
if ( GRLIB_shorter_nights == 1 ) then { GRLIB_shorter_nights = true } else { GRLIB_shorter_nights = false };
if ( GRLIB_blufor_defenders == 1 ) then { GRLIB_blufor_defenders = true } else { GRLIB_blufor_defenders = false };
if ( GRLIB_autodanger == 1 ) then { GRLIB_autodanger = true } else { GRLIB_autodanger = false };
if (GRLIB_fatigue < 0.1) then {GRLIB_fatigue = false} else {GRLIB_fatigue = true};
if (GRLIB_introduction == 1) then {GRLIB_introduction = true} else {GRLIB_introduction = false};
if (GRLIB_deployment_cinematic == 1) then {GRLIB_deployment_cinematic = true} else {GRLIB_deployment_cinematic = false};
if (GRLIB_build_first_fob == 1) then {GRLIB_build_first_fob = true} else {GRLIB_build_first_fob = false};
if (GRLIB_teamkill_penalty == 1) then {GRLIB_teamkill_penalty = true} else {GRLIB_teamkill_penalty = false};
if (GRLIB_adaptive_opfor == 1) then {GRLIB_adaptive_opfor = true} else {GRLIB_adaptive_opfor = false};
if (GRLIB_permissions_param == 1) then {GRLIB_permissions_param = true} else {GRLIB_permissions_param = false};
if (GRLIB_use_whitelist == 1) then {GRLIB_use_whitelist = true} else {GRLIB_use_whitelist = false};
if (GRLIB_shorter_nights == 1) then {GRLIB_shorter_nights = true} else {GRLIB_shorter_nights = false};
if (GRLIB_blufor_defenders == 1) then {GRLIB_blufor_defenders = true} else {GRLIB_blufor_defenders = false};
if (GRLIB_autodanger == 1) then {GRLIB_autodanger = true} else {GRLIB_autodanger = false};
if (KP_liberation_arsenalUsePreset == 1) then {KP_liberation_arsenalUsePreset = true} else {KP_liberation_arsenalUsePreset = false};
if (KP_liberation_mapmarkers == 1) then {KP_liberation_mapmarkers = true; GREUH_allow_mapmarkers = true; GREUH_allow_platoonview = true} else {KP_liberation_mapmarkers = false; GREUH_allow_mapmarkers = false; GREUH_allow_platoonview = false; show_platoon = false; show_teammates = false; show_nametags = false};
if (KP_liberation_mobilerespawn == 1) then {KP_liberation_mobilerespawn = true} else {KP_liberation_mobilerespawn = false};

View File

@ -4888,5 +4888,13 @@
<Original>The officer has moved on.</Original>
<German>Der Offizier ist weitergezogen.</German>
</Key>
<Key ID="STR_PARAM_RESPAWN_COOLDOWN">
<Original>Mobile Respawn Cooldown (minutes)</Original>
<German>Mobiler Respawn Cooldown (Minuten)</German>
</Key>
<Key ID="STR_RESPAWN_COOLDOWN_HINT">
<Original>%1 minutes mobile respawn cooldown left.</Original>
<German>%1 Minuten Mobiler Respawn Cooldown übrig.</German>
</Key>
</Package>
</Project>

View File

@ -208,6 +208,12 @@ class Params
texts[] = { $STR_PARAMS_DISABLED, $STR_PARAMS_ENABLED };
default = 1;
};
class RespawnCooldown {
title = $STR_PARAM_RESPAWN_COOLDOWN;
values[] = {0, 300, 600, 900, 1200, 1800, 3600};
texts[] = {$STR_PARAMS_DISABLED, 5, 10, 15, 20, 30, 60};
default = 900;
};
class MobileArsenal {
title = $STR_PARAMS_MOBILEARSENAL;
values[] = { 0, 1 };

View File

@ -169,7 +169,7 @@ class Missions
* Added: Config variables in `kp_liberation_config.sqf`.
* Added: Reputation penalty for killing civilians.
* Added: Reputation penalty for seizing civil vehicles.
* Added: Reputation penalty for destroyed/damaged civil buildings.
* Added: Reputation penalty for destroyed/damaged civil buildings. (evaluated only on capture a sector event)
* Added: Mission parameter to choose building penalty for damaged or only destroyed buildings.
* Added: Reputation gain for liberated sectors.
* Added: After capturing a sector you might find wounded civilians. You can also gain reputation for offering medical support.
@ -193,6 +193,7 @@ class Missions
* Added: LoW UAVs to the default blacklist.
* Added: Some of the new RHS vehicles.
* Added: Turkish localization. Thanks to [Carbneth](https://github.com/Carbneth)
* Added: Parameter to set a cooldown for using mobile respawns.
* Removed: Liberation skill handling of AI units, as BI do this good enough now concerning wounds, etc.
* Removed: Vehicle explosion chance script for convoy ambush.
* Removed: Old debug messages.