Mikero/Sandbox - modules – User
m (Bot: Adding category Sandbox) |
m (Erentar moved page Mikero's Sandbox - modules to User:Mikero/Sandbox - modules: Bot: Moved page) |
(No difference)
|
Revision as of 03:17, 3 December 2018
modules are a way to add pre-packaged features to a mission or island
modules is a pbo addon like any other with a config.cpp
basic constructions are:
- instantiate whatever functions give you a thrill in the modules package via a config.cpp eventhandler
- optionally, modify, ammend, alter or bash, whatever gives you a thrill in the init field of the 'module' when added via the editor
- optionally, call various functions declared above in the init field of given objects/vehicles/units
config.cpp
cfgPatches
class CfgPatches { class Module_Whatever { units[] = {}; weapons[] = {}; // requiredVersion = 0.1;// if needed, although BI themselves haven't respected standard versioning increases until arrowhead. most went backwards. // ofp resistance still remains the highest version 'out there' making upgrade compatibilities pointless // trying to detect arma1 vs 2 addons is another fruitless excercise. // past history being a guide, arma 3 will start off at version 1.00 again requiredAddons[] = {CAUI};//to get at class Logic; }; };
CfgVehicles
class CfgVehicles { class Logic; class Whatever: Logic { displayName = "Whatever"; icon = some\sexy\icon\somewhere; picture = \some\sexy\picture\somewhere.paa; // note the \ and paa requirement vehicleClass = "Modules";//for standard F7 editing class Eventhandlers { init = "_this execVM '\your\modules\init_whatever.sqf';"; init = "[this] execVM '\your\modules\init_whatever.sqf';";//alternate syntax }; }; };
- note that just like everything else, all file references are hard paths to make portability impossible
- You can try screaming about _this, and [this]. it doesn't help much.
module init script
whatever functions (plural) you want to achieve, and whatever you *might* want init fields of units to play with, they must be reference via
YourFunc1 = compile preprocessFile "\some\function\somewhere1.sqf"; YourFunc2 = compile preprocessFile "\some\function\somewhere2.sqf"; YourFunc3 = compile preprocessFile "\some\function\somewhere3.sqf";
'YourFunc1' is the reference name. Thus, later on...
returnval= ([whatever,arguments]) spawn/call YourFunc1;
returnval can of course be anything, including arrays or nothing at all
the awfullness of the comref describes arguments as 'anything at all', or _this, or this, or [an array] or somevalue
the truth is
_this is an unconditional name used in the function itself. it refers to the passed argument(s) if any
what _this is, can be, an array, a single value ,or indeed nil. it purely depends on what is passed (why the biki can't state this is beyond me)
thus
retval= call 'blah'; retval= [] call blah; retval= somevar call blah; retval= [somevar] call blah;
are purely dependent on the function 'blah'. eg what it wants. not, some semantic requirement of the call verb itself