Skip to content

Commit

Permalink
(#642): started on refactor of standard wave
Browse files Browse the repository at this point in the history
  • Loading branch information
Ansible2 committed Jul 9, 2023
1 parent 9df1d71 commit 10bb815
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* ----------------------------------------------------------------------------
Function: BLWK_fnc_standardWave_generateManSpawnPosition
Description:
Gets a spawn position for a unit to a man unit to spawn at.
Parameters:
NONE
Returns:
<PositionATL[]> - A position for a man unit to spawn.
Examples:
(begin example)
private _position = call BLWK_fnc_standardWave_generateManSpawnPosition;
(end)
Author(s):
Ansible2
---------------------------------------------------------------------------- */
scriptName "BLWK_fnc_standardWave_generateManSpawnPosition";

selectRandom BLWK_infantrySpawnPositions
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* ----------------------------------------------------------------------------
Function: BLWK_fnc_standardWave_generateMenClassnames
Description:
Gets the standard (weighted) list of available men classes.
Parameters:
NONE
Returns:
<(STRING | NUMBER)[]> - A weighted or unweighted array of classnames that
enemy units will spawn from.
Examples:
(begin example)
private _availableClasses = call BLWK_fnc_standardWave_generateMenClassnames;
(end)
Author(s):
Ansible2
---------------------------------------------------------------------------- */
scriptName "BLWK_fnc_standardWave_generateMenClassnames";


private _availableClasses = [];
// classes
_availableClasses pushback BLWK_level1Faction_menClasses;
// weight of class
_availableClasses pushBack BLWK_level1Faction_weight;

if (BLWK_currentWaveNumber >= BLWK_level2Faction_startWave) then {
_availableClasses pushback BLWK_level2Faction_menClasses;
_availableClasses pushBack BLWK_level2Faction_weight;
};
if (BLWK_currentWaveNumber > BLWK_level3Faction_startWave) then {
_availableClasses pushback BLWK_level3Faction_menClasses;
_availableClasses pushBack BLWK_level3Faction_weight;
};
if (BLWK_currentWaveNumber > BLWK_level4Faction_startWave) then {
_availableClasses pushback BLWK_level4Faction_menClasses;
_availableClasses pushBack BLWK_level4Faction_weight;
};
if (BLWK_currentWaveNumber > BLWK_level5Faction_startWave) then {
_availableClasses pushback BLWK_level5Faction_menClasses;
_availableClasses pushBack BLWK_level5Faction_weight;
};


_availableClasses
Empty file.
Empty file.
62 changes: 48 additions & 14 deletions Headers/descriptionEXT/Wave Types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,52 @@ class BLWK_waveTypes
{
class standardWave
{
onSelected = "remoteExec ['BLWK_fnc_handleStandardWave',BLWK_theAIHandlerOwnerID]"; // uncompiled code that is run on the server when the wave is selected (started). For context of execution see BLWK_fnc_startWave's use of BLWK_fnc_spawnWaveEnemies
//onWaveEnd = ""; // uncompiled code that is run on the server when the wave is ended
creationNotificationTemplate = TASK_ASSIGNED_TEMPLATE; // a CfgNotification template for when the wave starts
notificationText = "['','Incoming Wave: ' + (str BLWK_currentWaveNumber)]"; // text to appear in wave start notification
compileNotificationText = 1; // notificationText will be compiled and called. It must return an array compatible with the "arguments" parameter of BIS_fnc_showNotification
// uncompiled code that is run on the server when the wave is selected (started).
// For context of execution see BLWK_fnc_startWave's use of BLWK_fnc_getConfigForWave
// onSelected = "remoteExecCall ['BLWK_fnc_handleStandardWave',BLWK_theAIHandlerOwnerID]";

// a function that returns a list of queue entries of enemies to spawn
// an example of the expected return shape:
/*
[
[
"I_Soldier_A_F", // enemy class name
[0,0,0] // spawn position ATL
]
]
*/
generateMenClassnames = "BLWK_fnc_standardWave_generateMenClassnames";
generateManSpawnPosition = "BLWK_fnc_standardWave_generateManSpawnPosition";

// The name of a function that exists on the AI handler owner that will be called
onWaveSelected = "BLWK_fnc_standardWave_onWaveSelected";
onManCreated = "BLWK_fnc_standardWave_onManCreated";

// uncompiled code that is run on the server when the wave is ended
//onWaveEnd = "";

// a CfgNotification template for when the wave starts
creationNotificationTemplate = TASK_ASSIGNED_TEMPLATE;

// "notificationText" is text to appear in wave start notification
notificationText = "['','Incoming Wave: ' + (str BLWK_currentWaveNumber)]";

// whether notificationText will be compiled and called or not.
// It must return an array compatible with the "arguments" parameter of BIS_fnc_showNotification
compileNotificationText = 1;

// A missionNamespace variable that is available on the server and must evaluate to a number
// This will determine the likelihood (relative to other normal waves) that it is created on any given wave
weightVariable = "BLWK_standardWaveWeight";
};
class paratrooperWave : standardWave
{
onSelected = "remoteExec ['BLWK_fnc_handleParatrooperWave',BLWK_theAIHandlerOwnerID]";
onSelected = "remoteExecCall ['BLWK_fnc_handleParatrooperWave',BLWK_theAIHandlerOwnerID]";
weightVariable = "BLWK_paratrooperWaveWeight";
};
class defectorWave : standardWave
{
onSelected = "remoteExec ['BLWK_fnc_handleDefectorWave',BLWK_theAIHandlerOwnerID]";
onSelected = "remoteExecCall ['BLWK_fnc_handleDefectorWave',BLWK_theAIHandlerOwnerID]";
weightVariable = "BLWK_defectorWaveWeight";
};
};
Expand All @@ -29,40 +60,43 @@ class BLWK_waveTypes
{
class suicideWave
{
onSelected = "remoteExec ['BLWK_fnc_handleSuicideWave',BLWK_theAIHandlerOwnerID]";
onSelected = "remoteExecCall ['BLWK_fnc_handleSuicideWave',BLWK_theAIHandlerOwnerID]";
creationNotificationTemplate = SPECIAL_WARNING_TEMPLATE;
notificationText = "Enemy Suicide Bombers Are Incoming!";
toggleVariable = "BLWK_allowSuicideWave"; // a name of a missionNamespace variable (on the server) that can be set to true or false to toggle the ability to have the wave (usually paired with the KISKA parameter menu)
// The "toggleVariable" is a name of a missionNamespace variable (on the server)
// that can be set to true or false to toggle the ability to have the wave
// (likely paired with a KISKA parameter menu mission param)
toggleVariable = "BLWK_allowSuicideWave";
};
class civilianWave : suicideWave
{
onSelected = "remoteExec ['BLWK_fnc_handleStandardWave',BLWK_theAIHandlerOwnerID]; call BLWK_fnc_civiliansWave";
onSelected = "remoteExecCall ['BLWK_fnc_handleStandardWave',BLWK_theAIHandlerOwnerID]; call BLWK_fnc_civiliansWave";
notificationText = "Civilians Are Fleeing, Watch Your Fire!";
onWaveEnd = "call BLWK_fnc_onCivWaveEnd";
toggleVariable = "BLWK_allowCivWave";
};
class droneWave : suicideWave
{
onSelected = "remoteExec ['BLWK_fnc_handleDroneWave',BLWK_theAIHandlerOwnerID]";
onSelected = "remoteExecCall ['BLWK_fnc_handleDroneWave',BLWK_theAIHandlerOwnerID]";
notificationText = "Enemy Drones Inbound!";
onWaveEnd = "call BLWK_fnc_onDroneWaveEnd";
toggleVariable = "BLWK_allowDroneWave";
};
class overrunWave : suicideWave
{
onSelected = "remoteExec ['BLWK_fnc_handleOverrunWave',BLWK_theAIHandlerOwnerID]";
onSelected = "remoteExecCall ['BLWK_fnc_handleOverrunWave',BLWK_theAIHandlerOwnerID]";
notificationText = "The Area Was Overrun!";
toggleVariable = "BLWK_allowOverrunWave";
};
class heliWave : suicideWave
{
onSelected = "remoteExec ['BLWK_fnc_handleHelicopterWave',BLWK_theAIHandlerOwnerID]";
onSelected = "remoteExecCall ['BLWK_fnc_handleHelicopterWave',BLWK_theAIHandlerOwnerID]";
notificationText = "Enemy Helicopters Inbound!";
toggleVariable = "BLWK_allowHeliWave";
};
class mortarWave : suicideWave
{
onSelected = "remoteExec ['BLWK_fnc_handleMortarWave',BLWK_theAIHandlerOwnerID]";
onSelected = "remoteExecCall ['BLWK_fnc_handleMortarWave',BLWK_theAIHandlerOwnerID]";
notificationText = "Incoming Mortar Fire!";
toggleVariable = "BLWK_allowMortarWave";
};
Expand Down
12 changes: 12 additions & 0 deletions Headers/descriptionEXT/functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,18 @@ class BLWK
{};
};
class StandardWaveLib
{
file = "Functions\Wave Type Libraries\Standard Wave Lib";
class standardWave_generateManSpawnPosition
{};
class standardWave_generateMenClassnames
{};
class standardWave_onManCreated
{};
class standardWave_onWaveSelected
{};
};


class StandardWaveLibrary
{
Expand Down

0 comments on commit 10bb815

Please sign in to comment.