Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check win condition, end campaign and wipe save #408

Merged
merged 4 commits into from
May 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Missionframework/KPLIB_debriefs.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class CfgDebriefing
{
class KPLIB_Win
{
title = $STR_DEBRIEF_WINTITLE;
subtitle = "";
description = $STR_DEBRIEF_WINDESCR;
pictureBackground = "";
};
};
1 change: 1 addition & 0 deletions Missionframework/description.ext
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@ minPlayerDistance = 1000;
#include "KPLIB_params.hpp"
#include "KPLIB_functions.hpp"
#include "KPLIB_ui.hpp"
#include "KPLIB_debriefs.hpp"
2 changes: 2 additions & 0 deletions Missionframework/modules/00_init/fnc/fn_init_save.sqf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
BOOL
*/

if (!KPLIB_campaignRunning) exitWith {false};

if (KPLIB_param_debugSave > 0) then {diag_log format ["[KP LIBERATION] [SAVE] ----- Time: %1 - Save function started -----", diag_tickTime];};

// Call the save data fetch functions from each module and store them in a multidimensional array for saving
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ params ["_sectorToChange", ["_toPlayerSide", true]];

if (_toPlayerSide) then {
KPLIB_sectors_blufor pushBack _sectorToChange;
call KPLIB_fnc_core_checkWinCond;
} else {
KPLIB_sectors_blufor = KPLIB_sectors_blufor - [_sectorToChange];
};
Expand Down
27 changes: 27 additions & 0 deletions Missionframework/modules/01_core/fnc/fn_core_checkWinCond.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
KPLIB_fnc_core_checkWinCond

File: fn_core_checkWinCond.sqf
Author: KP Liberation Dev Team - https://github.com/KillahPotatoes
Date: 2018-05-10
Last Update: 2018-05-10
License: GNU General Public License v3.0 - https://www.gnu.org/licenses/gpl-3.0.html

Description:
Checks if the selected win conditions are met and end the mission.

Parameter(s):
NONE

Returns:
BOOL
*/

// In the next steps we'll implement a parameter for more win conditions. For now the "old one" will be used.
if (({_x in KPLIB_sectors_blufor} count KPLIB_sectors_metropolis) == count KPLIB_sectors_metropolis) then {
KPLIB_campaignRunning = false;
call KPLIB_fnc_init_wipe;
"KPLIB_win" call BIS_fnc_endMissionServer;
};

true
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,12 @@
if ((_x select 1) in KPLIB_sectors_blufor) then {
(_x select 0) setMarkerColor KPLIB_preset_colorPlayers;
} else {
(_x select 0) setMarkerColor KPLIB_preset_colorEnemy;
}
if ((_x select 1) in KPLIB_sectors_active) then {
(_x select 0) setMarkerColor KPLIB_preset_colorEnemyAct;
} else {
(_x select 0) setMarkerColor KPLIB_preset_colorEnemy;
};
};
} forEach KPLIB_sectors_lockedVehMarkers;

true
3 changes: 3 additions & 0 deletions Missionframework/modules/01_core/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class core {
// Check player gear against blacklist
class core_checkGear {};

// Check if win conditions are met
class core_checkWinCond {};

// The intro cinematic procedure
class core_cinematic {};

Expand Down
9 changes: 9 additions & 0 deletions Missionframework/stringtable.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,15 @@
<Turkish>Canlan</Turkish>
<Portuguese>Mobilizar</Portuguese>
</Key>
<!-- Debriefings -->
<Key ID="STR_DEBRIEF_WINTITLE">
<Original>The area is liberated.</Original>
<German>Das Gebiet wurde befreit.</German>
</Key>
<Key ID="STR_DEBRIEF_WINDESCR">
<Original>Later you'll have a cinematic with the stats etc.</Original>
<German>Später wird hier eine Sequenz mit den Statistiken etc. laufen.</German>
</Key>
<!-- Hints -->
<Key ID="STR_HINT_RESPAWNCOOLDOWN">
<Original>%1 minutes mobile respawn cooldown left.</Original>
Expand Down