Skip to content
BlackHawkPL edited this page Aug 18, 2017 · 3 revisions

The module system has been introduced to make it easier to control the features of your mission and have a complete overview.

modules.sqf

The modules.sqf file controls which modules are enabled for the mission. To add a module #include "PathToRoot.sqf" is used and to disable a module you can simply put // in front of the #include line.

Example:

//#include "start_text\root.sqf"
#include "jip_teleport\root.sqf"
#include "marker_control\root.sqf"

Module structure

The modules are compiled and called in their own environments so there is no danger of addressing other local variables. The name of the module is dictated by the folder name. The module can contain anything but there are 2 files in the module that have to follow the module design convention, the init.sqf and settings.sqf.

Module structure example:

jip teleport
    - init.sqf
    - root.sqf
    - settings.sqf
    - teleportAction.sqf

root.sqf

This file is essential part of any module. It allows the framework to compile init and preinit files. It shouldn't be modified by the user and consists of two parts:

#ifdef framework

    #include "init.sqf"

#endif

if module contains init.sqf, and:

#ifdef preinit

    #include "preinit.sqf"

#endif

if module contains preinit.sqf.

init.sqf

The init.sqf is the start of the module, from here anything is possible. But if the module has any settings then #include "settings.sqf" has to be put at the start of the file, so that the settings are included.

Example:

#include "settings.sqf"

if (!isDedicated) then {
    if (((leader player) distance player) >  LEADERDISTANCE) then {
...

settings.sqf

If the module has any settings then the settings.sqf file must be made. Inside the settings.sqf file all settings have to be declared using #define so that the module doesn't take up unnecessary variable space. It is important to properly comment the settings so that the mission maker can tweak the module to his needs.

Example:

// LEADERDISTANCE
// On spawn, if your squad leader is further then LEADERDISTANCE away, you get the option to teleport to him.
#define LEADERDISTANCE 200

// SPAWNDISTANCE
// If you move SPAWNDISTANCE away from your spawnpoint you loose the option to teleport.
#define SPAWNDISTANCE 200