Functions Library - Theseus-Aegis/MissionTemplate GitHub Wiki

This page has direct links to all functions currently available in the library for immediate use with headers and usage examples. This has replaced functions being in the template although new custom ones can be added to a specific mission. The only exception from the library is briefing.


Macro Usage

Functions INSIDE a mission file are still accessed via FUNC(myFunction) or TAC_Scripts_fnc_myFunction
Anything from the functions library are accessed via MFUNC(reinforcements) or TAC_Mission_fnc_reinforcements

Variable Macros are also:
Mission Template:

  • GVAR(myVar) > TAC_Scripts_MyVar
  • QGVAR(myVar) > "TAC_Scripts_MyVar"

Functions Library:

  • MGVAR(myVar) > TAC_Mission_myVar
  • QMGVAR(myVar) > "TAC_Mission_myVar"

Available Variables

List of variables available for use.

GVAR(timeUntilStart)
Will be available after initServer has run and will determine the seconds remaining until 14:00 Zulu. If testing a mission do not use the variable until you're satisfied with results.
(Note: This does not get updated, if you use it later in the mission, you must take into account the time since start as well.)

Example:

[{
    // Code to run 1 hour after mission start
}, [], GVAR(timeUntilStart) + 3600] call CBA_fnc_waitAndExecute;

Available Functions

Full list is available on the sidebar.


Custom Scripts

This section describes how to make changes to the existing library scripts or create your own specific to your mission. General scripts useful to more missions should be added to the Functions Library at least eventually, while scripts specific to the mission should live in the mission itself.

  • Copy the desired script file to your mission's functions folder.
  • Add the script to CfgFunctions.hpp.
  • Follow the instructions found inside the specific script for how to use it (eg. where to call it from).

Example

  • Copy fnc_teleport.sqf to my_mission.Map/functions/fnc_teleport.sqf.
  • Add DFUNC(teleport) to CfgFunctions.hpp.
  • Following the instructions in the script, add [tpObj, tpPos, "Teleport"] call FUNC(teleport); to initPlayerLocal.sqf.

Development

Development defines are available in script_component.hpp which you can uncomment:

  • DEBUG_MODE_FULL to enable debug mode for all functions in the template.
  • RECOMPILE to recompile the functions in-game without reloading (or even restarting) the mission.