Skip to content

Commit

Permalink
New Secondary Objective 'Humanitarian Aid'
Browse files Browse the repository at this point in the history
  • Loading branch information
Apricot-ale committed Mar 2, 2023
1 parent 54ac026 commit 6e174fa
Show file tree
Hide file tree
Showing 9 changed files with 199 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Missionframework/KPLIB_config.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
File: KPLIB_config.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-10-16
Last Update: 2020-08-06
Last Update: 2023-03-02
License: MIT License - http://www.opensource.org/licenses/MIT
Description:
Expand Down Expand Up @@ -260,8 +260,8 @@ KPLIB_cr_wounded_gain = 2;
------------------------------------------------------------
*/

// Intel price for the secondary missions. [FOB hunting, Convoy ambush, SAR]
KPLIB_secondary_missions_costs = [15, 10, 8];
// Intel price for the secondary missions. [FOB hunting, Convoy ambush, SAR, CIV]
KPLIB_secondary_missions_costs = [15, 10, 8, 5];

// Proportionate reduction of the actual (!) enemy combat readiness for a successful FOB hunt. (e.g. 0.4 -> reduction of 24 by an actual value of 60)
KPLIB_secondary_objective_impact = 0.4;
Expand Down
Binary file added Missionframework/res/secondary/hum_aid.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions Missionframework/scripts/client/remotecall/remote_call_intel.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,33 @@ switch (_notiftype) do {
deleteMarkerLocal "secondarymarkerzone";
secondary_objective_position_marker = [];
};
// civ-supplies mission
case 9: {
waitUntil {!isNil "secondary_objective_position_marker"};
waitUntil {count secondary_objective_position_marker > 0};
waitUntil {secondary_objective_position_marker distance zeropos > 1000};
["lib_intel_civ_supplies", [markertext ([10000, secondary_objective_position_marker] call KPLIB_fnc_getNearestSector)]] call BIS_fnc_showNotification;
_secondary_marker = createMarkerLocal ["secondarymarker", secondary_objective_position_marker];
_secondary_marker setMarkerColorLocal "ColorGREEN";
_secondary_marker setMarkerTypeLocal "hd_end";

_secondary_marker_zone = createMarkerLocal ["secondarymarkerzone", secondary_objective_position_marker];
_secondary_marker_zone setMarkerColorLocal "ColorGREEN";
_secondary_marker_zone setMarkerShapeLocal "ELLIPSE";
_secondary_marker_zone setMarkerBrushLocal "FDiagonal";
_secondary_marker_zone setMarkerSizeLocal [50,50];
};
case 10: {
["lib_secondary_civ_supplies_complete"] call BIS_fnc_showNotification;
deleteMarkerLocal "secondarymarker";
deleteMarkerLocal "secondarymarkerzone";
secondary_objective_position_marker = [];
};
case 11: {
//notify there are no friendly towns
["lib_secondary_civ_supplies_no_room"] call BIS_fnc_showNotification;
//return intel points used
resources_intel = resources_intel + ( KPLIB_secondary_missions_costs select 3);
};
default {[format ["remote_call_intel.sqf -> no valid value for _notiftype: %1", _notiftype], "ERROR"] remoteExecCall ["KPLIB_fnc_log", 2];};
};
9 changes: 6 additions & 3 deletions Missionframework/scripts/client/ui/secondary_ui.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,24 @@ waitUntil { dialog };
} foreach [
"STR_SECONDARY_MISSION0",
"STR_SECONDARY_MISSION1",
"STR_SECONDARY_MISSION2"
"STR_SECONDARY_MISSION2",
"STR_SECONDARY_MISSION3"
];

private [ "_oldchoice", "_images", "_briefings", "_missioncost" ];

_images = [
"res\secondary\fob_hunting.jpg",
"res\secondary\convoy_hijack.jpg",
"res\secondary\sar.jpg"
"res\secondary\sar.jpg",
"res\secondary\hum_aid.jpg"
];

_briefings = [
"STR_SECONDARY_BRIEFING0",
"STR_SECONDARY_BRIEFING1",
"STR_SECONDARY_BRIEFING2"
"STR_SECONDARY_BRIEFING2",
"STR_SECONDARY_BRIEFING3"
];

_oldchoice = -1;
Expand Down
1 change: 1 addition & 0 deletions Missionframework/scripts/server/init_server.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ send_paratroopers = compile preprocessFileLineNumbers "scripts\server\patrols\se
fob_hunting = compile preprocessFileLineNumbers "scripts\server\secondary\fob_hunting.sqf";
convoy_hijack = compile preprocessFileLineNumbers "scripts\server\secondary\convoy_hijack.sqf";
search_and_rescue = compile preprocessFileLineNumbers "scripts\server\secondary\search_and_rescue.sqf";
civ_supplies = compile preprocessFileLineNumbers "scripts\server\secondary\civ_supplies.sqf";

// Sector
attack_in_progress_fob = compile preprocessFileLineNumbers "scripts\server\sector\attack_in_progress_fob.sqf";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ resources_intel = resources_intel - ( KPLIB_secondary_missions_costs select _mis
if (_mission_index == 0) then {[] spawn fob_hunting;};
if (_mission_index == 1) then {[] spawn convoy_hijack;};
if (_mission_index == 2) then {[] spawn search_and_rescue;};
if (_mission_index == 3) then {[] spawn civ_supplies;};

KPLIB_secondary_starting = false; publicVariable "KPLIB_secondary_starting";

Expand Down
99 changes: 99 additions & 0 deletions Missionframework/scripts/server/secondary/civ_supplies.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
/*
Creates a secondary objective mission to allow players to bring 2x supply crates to a
random friendly town in order to raise civilian rep.
Configurable options (kp_liberation_config):
KPLIB_secondary_missions_costs select 3 = intel cost for mission (default 5)
KP_liberation_civ_supplies_impact = % increase in civilian rep (default 5)
*/

_supplies_present = false;

//select random blufor owned town (capture)

_blufor_towns = [];

//check if blufor_sectors item is contained within sectors_capture and push into array
{
if (_x in sectors_capture) then {
_blufor_towns pushBack _x;
};
} forEach blufor_sectors;

// Check if town array is empty
if(count _blufor_towns isEqualTo 0) exitWith {
//if empty, throw error in log and call proper intel notification
["There are no friendly towns to spawn supplies at!", "ERROR"] call KPLIB_fnc_log;
[11] remoteExec ["remote_call_intel"];
};

_objective_town = selectRandom _blufor_towns;


//create 50m radius marker at town
secondary_objective_position = getMarkerPos _objective_town;
secondary_objective_position_marker = secondary_objective_position;
publicVariable "secondary_objective_position_marker";
sleep 1;

//start secondary mission
KPLIB_secondary_in_progress = 3; publicVariable "KPLIB_secondary_in_progress";
[9] remoteExec ["remote_call_intel"];

//create note in log
diag_log format ["Starting Humanitarian Aid objective in %1",_objective_town];

//while loop to wait until 2x supply crates have been brought to within 50m of objective
while {_supplies_present isEqualTo false} do {

_supplies_in_zone = [];
_objects_to_check = [];

//get list of all objects in marker area
_objects_to_check = vehicles inAreaArray [secondary_objective_position, 50, 50];


{
//loop through all objects and check if they are the correct supply crates and not currently sitting inside vics
if (typeOf _x isEqualTo KPLIB_b_crateSupply && isNull attachedTo _x) then {

//if they are the right crate, add to the supplies array to be counted
_supplies_in_zone pushBack _x;
};

} forEach _objects_to_check;

//if there are 2 or more of the correct crates, delete them and leave the mission while loop
if (count _supplies_in_zone > 1) then {

{
deleteVehicle _x;
} forEach _supplies_in_zone;

_supplies_present = true;

//if not, wait 5 seconds and check again
} else {
sleep 5;
};

};

//add civ rep for a completed mission based on value in kp_liberation_config
[KP_liberation_civ_supplies_impact] spawn F_cr_changeCR;

//display end notificaiton
[10] remoteExec ["remote_call_intel"];

//add +1 completed secondary mission for the campaign end screen
stats_secondary_objectives = stats_secondary_objectives + 1;

//declare secondary mission completed
KPLIB_secondary_in_progress = -1; publicVariable "KPLIB_secondary_in_progress";

//execute a save
sleep 1;
[] spawn KPLIB_fnc_doSave;

//create note in log
diag_log format ["Humanitarian Aid secondary objective complete at %1. Increasing civ rep by %2",_objective_town, KP_liberation_civ_supplies_impact];
50 changes: 46 additions & 4 deletions Missionframework/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<!--
File: stringtable.xml
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2017-03-06
Date: 2023-03-02
License: MIT License - http://www.opensource.org/licenses/MIT

Localization contributors:
English | Updated: 0.96.8
English | Updated: 0.96.8a
KP Liberation Dev Team - https://github.com/KillahPotatoes

Chinese Simplified | Updated: pre 0.96.7a
Expand Down Expand Up @@ -46,10 +46,10 @@
<Project name="Liberation">
<Package name="Liberation">
<Key ID="STR_MISSION_TITLE">
<Original>CTI 34 KP Liberation v0.96.8 dev</Original>
<Original>CTI 34 KP Liberation v0.96.8 APR</Original>
</Key>
<Key ID="STR_MISSION_VERSION">
<Original>v0.96.8 dev</Original>
<Original>v0.96.8 APR</Original>
</Key>
<Key ID="STR_Deploy_OnPoint">
<Original>Deploy</Original>
Expand Down Expand Up @@ -1199,6 +1199,48 @@
<Korean>적군 전초기지 %1 가 근처에 있습니다!</Korean>
<Czech>Nepřátelské FOB poblíž %1.</Czech>
</Key>
<Key ID="STR_NOTIFICATION_CIV_SUPPLIES_TEXT">
<Original>Civil authorities request supplies at %1.</Original>
<French>Les autorités civiles demandent des fournitures à %1.</French>
<German>Zivilbehörden fordern Lieferungen an bei %1.</German>
<Spanish>Las autoridades civiles solicitan suministros en %1</Spanish>
<Russian>Гражданские власти запрашивают поставки в %1.</Russian>
<Italian>Le autorità civili richiedono forniture a %1.</Italian>
<Chinesesimp>%1民政当局在。</Chinesesimp>
<Chinese>%1 民政當局在。</Chinese>
<Turkish>Sivil makamlar, %1 konumunda malzeme talep ediyor.</Turkish>
<Portuguese>Autoridades civis solicitam suprimentos em %1.</Portuguese>
<Korean>시민 당국은 %1에서 공급을 요청합니다.!</Korean>
<Czech>Civilní úřady požadují dodávky v %1.</Czech>
</Key>
<Key ID="STR_NOTIFICATION_CIV_SUPPLIES_COMPLETE_TEXT">
<Original>Supplies have been delivered. The civilians are thankful for your help!</Original>
<French>Les fournitures ont été livrées. Les civils sont reconnaissants pour votre aide!</French>
<German>Nachschub wurde geliefert. Die Zivilisten sind dankbar für Ihre Hilfe!</German>
<Spanish>Se han entregado los suministros. ¡Los civiles están agradecidos por su ayuda!</Spanish>
<Russian>Поставки доставлены. Гражданские благодарны за вашу помощь!</Russian>
<Italian>Le forniture sono state consegnate. I civili sono grati per il tuo aiuto!</Italian>
<Chinesesimp>物资已送达。平民感谢您的帮助!</Chinesesimp>
<Chinese>物資已送達。平民感謝您的幫助!</Chinese>
<Turkish>Malzemeler teslim edildi. Siviller yardımınız için minnettar!</Turkish>
<Portuguese>Os suprimentos foram entregues. Os civis agradecem a sua ajuda!</Portuguese>
<Korean>물품이 배송되었습니다. 시민 여러분의 도움에 감사드립니다!</Korean>
<Czech>Dodávky byly dodány. Civilisté jsou vděční za vaši pomoc!</Czech>
</Key>
<Key ID="STR_NOTIFICATION_CIV_SUPPLIES_NO_ROOM">
<Original>Nno friendly towns in the area to deliver supplies to. Liberate one!</Original>
<French>Il n'y a pas de villes amies dans la région où livrer des fournitures. Libérez-en un avant de tenter cette mission.</French>
<German>Es gibt keine freundlichen Städte in der Umgebung, in die man Vorräte liefern könnte. Befreien Sie einen, bevor Sie diese Mission versuchen.</German>
<Spanish>No hay ciudades amigas en el área para entregar suministros. Libera a uno antes de intentar esta misión.</Spanish>
<Russian>В этом районе нет дружественных городов, в которые можно было бы доставлять припасы. Освободите одного перед выполнением этой миссии.</Russian>
<Italian>Non ci sono città amiche nella zona a cui consegnare rifornimenti. Liberane uno prima di tentare questa missione.</Italian>
<Chinesesimp>该地区没有友好城镇可以运送物资。在尝试此任务之前解放一个。</Chinesesimp>
<Chinese>該地區沒有友好城鎮可以運送物資。在嘗試此任務之前解放一個。</Chinese>
<Turkish>Bölgede erzak teslim edilecek dostane kasaba yok. Bu görevi denemeden önce birini serbest bırakın.</Turkish>
<Portuguese>Não há cidades amigáveis ​​na área para entregar suprimentos. Libere um antes de tentar esta missão.</Portuguese>
<Korean>이 지역에는 보급품을 배달할 우호적인 마을이 없습니다. 이 임무를 시도하기 전에 하나를 해방하십시오.</Korean>
<Czech>V této oblasti neexistují žádná spřátelená města, kam byste dodávali zásoby. Před pokusem o tuto misi jednoho osvobodte.</Czech>
</Key>
<Key ID="STR_NOTIFICATION_PRISONER_TEXT">
<Original>We have interrogated a prisoner.</Original>
<French>Nous avons interroger un prisonnier.</French>
Expand Down
15 changes: 15 additions & 0 deletions Missionframework/ui/liberation_notifications.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ class CfgNotifications {
class lib_intel_fob: lib_intel {
description = $STR_NOTIFICATION_FOB_TEXT;
};
class lib_intel_civ_supplies: lib_intel {
description = $STR_NOTIFICATION_CIV_SUPPLIES_TEXT;
};
class lib_secondary_civ_supplies_complete: lib_default_notification {
title = $STR_NOTIFICATION_SECONDARY_TITLE;
description = $STR_NOTIFICATION_CIV_SUPPLIES_COMPLETE_TEXT;
iconPicture = "res\notif\ui_notif_sob.paa";
color[] = { 0, 1, 0, 1 };
sound = "taskSucceeded";
};
class lib_intel_convoy: lib_intel {
description = $STR_NOTIFICATION_CONVOY_SPOTTED_TEXT;
};
Expand Down Expand Up @@ -120,6 +130,11 @@ class CfgNotifications {
class lib_intel_sar_succeeded: lib_secondary_fob_destroyed {
description = $STR_NOTIFICATION_SAR_SUCCESS;
};
class lib_secondary_civ_supplies_no_room: lib_secondary_fob_destroyed {
description = $STR_NOTIFICATION_CIV_SUPPLIES_NO_ROOM;
color[] = { 1, 0, 0, 1 };
sound = "taskFailed";
};
class lib_restart_60_s: lib_default_notification {
title = $STR_NOTIFICATION_RESTART_TITLE;
description = $STR_NOTIFICATION_RESTART_SECOND;
Expand Down

0 comments on commit 6e174fa

Please sign in to comment.