Tutorial Create an Editor Module
Tupolov edited this page May 12, 2016
·
8 revisions
- Create a new feature branch to push to GIT
git checkout -b sys_modulename
where:
- sys – the category (amb, civ, grp, mil, sup, sys, ui, x_)
- modulename – full name (try to avoid abbreviations and all lowercase) - In alive\addons\ create a new directory in the current format: sys_modulename
- Create config.cpp file, with the following entries:
#include “script_component.hpp”
#include “CfgPatches.hpp”
#include “CfgVehicles.hpp”
#include “CfgFunctions.hpp”
#include “CfgHints.hpp” - Create script_component.cpp file, with the following:
#define COMPONENT sys_modulename
//#define DEBUG_MODE_FULL
#ifdef DEBUG_ENABLED_MAIN
#define DEBUG_MODE_FULL
#endif
#ifdef DEBUG_SETTINGS_MAIN
#define DEBUG_SETTINGS DEBUG_SETTINGS_MAIN
#endif
#include “\x\alive\addons\main\script_mod.hpp”
#include “\x\alive\addons\main\script_macros.hpp”
Modify the first line (sys_modulename) with the name of your module. - Add CfgVehicles.hpp to publish your module in the editor
class CfgVehicles {
class ModuleAliveBase;
class ADDON : ModuleAliveBase
{
scope = 2;
displayName = “$STR_ALIVE_MODULE_NAME”;
function = “ALIVE_fnc_moduleNameInit”;
author = MODULE_AUTHOR;
functionPriority = xx;
isGlobal = 1;
icon = “x\alive\addons\sys_modulename\icon_sys_modulename.paa”;
picture = “x\alive\addons\sys_modulename\icon_sys_modulename.paa”;
displayName = “$STR_ALIVE_MODULE_NAME”;
vehicleClass = “Modules”;
class Arguments {
…
};
};
};
Modify the displayName, icon, picture and init lines with the correct stringtable reference and paths. - If you are pre-compiling functions, add the CfgFunctions.hpp file
class cfgFunctions {
class PREFIX {
class COMPONENT {
file = “\x\alive\addons\sys_modulename\functions”;
class moduleName {
description = “The main class”;
};
};
};
};
For more information on creating an SQF class see here - Create your StringTable.xml to allow multiple languages
<Key ID="STR_ALIVE_REQUIRES_ALIVE"> <English>(ALiVE) Requires ALiVE</English> <German>(ALiVE) Erfordern ALiVE</German> <Italian>(ALiVE) Richiedono ALiVE</Italian> <Spanish>(ALiVE) Requieren ALiVE</Spanish> <French>(ALiVE) Exiger ALiVE</French> <Czech>(ALiVE) Vyžadovat ALiVE</Czech> <Russian>(ALiVE) Требовать ALiVE</Russian> <Polish>(ALiVE) Wymagaj ALiVE</Polish> <Hungarian>(ALiVE) Igénylése ALiVE</Hungarian> </Key>
- Find an existing alive\images\icon_xxx.png and modify accordingly representing the icon for your module
- Using Tex2View, convert the PNG file to a PAA file, and copy into your alive\addons\sys_modulename directory
- Plan your module into its Model/View/Controller components, where:
- Module – the data for your module including data that will be persisted
- Controller – the process used to coordinate the View component with the Model
- View – the component that controls the visual display for the player
Example:
Model – no visual just reference data
- server side object init
- player side object init (wait for server?)
Controller – coordination
- regular server or player checks (use CBA PFH)
View – purely visual
- initialise menu
- frequent check to modify menu and display status