Difference between revisions of "Modules"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Arma 3 Modules (List): Replaced collapsed tables with spoiler)
m (Writing the Module Function)
Line 240: Line 240:
 
* Input parameters differ based on value of ''is3DEN'' property.
 
* Input parameters differ based on value of ''is3DEN'' property.
  
'''Example''':
+
'''Example'''<br>
 
<spoiler>
 
<spoiler>
 
'''Default'''
 
'''Default'''

Revision as of 22:20, 17 June 2018

SideTOC

Introduction

This page can be considered a hub when it comes to modules. Here you'll find everything you need to know when it comes to creating modules, available modules in Arma 3 and existing module documentation.

Creating a Module

Arma 3 introduces a module framework which aims to simplify the configuration of modules and the way their functions are executed (Globally,JIP)

Create a Module Addon

  • Make a folder named myTag_addonName a create a config.cpp file in it.
  • Inside, declare a CfgPatches class with your addon and its modules (in the units array). Without this, the game wouldn't recognize the addon.
  • Make sure the addon and all objects start with your tag, e.g. myTag
class CfgPatches
{
	class myTag_addonName
	{
		units[] = {"myTag_ModuleNuke"};
		requiredVersion = 1.0;
		requiredAddons[] = {"A3_Modules_F"};
	};
};


Module Category

  • Modules are placed into basic categories which makes finding a desired module easier for an user. Use can use on of the existing categories:
class displayName
Effects Effects
Events Events
Modes Gameplay Modes
GroupModifiers Group Modifiers
Intel Intel
NO_CATEGORY Misc
Multiplayer Multiplayer
ObjectModifiers Object Modifiers
Sites Sites
StrategicMap Strategic
Supports Supports

Alternatively, you can create your own one:

class CfgFactionClasses
{
	class NO_CATEGORY;
	class myTag_explosions: NO_CATEGORY
	{
		displayName = "Explosions";
	};
};


Creating the Module Config

  • All in-game objects (soldiers, vehicles, buildings, logics, modules, ...) are defined in CfgVehicles class.
  • All modules must inherit from Module_F parent class, either directly or through some additional sub-parent. While modules inheriting from some other class will be still displayed in the Modules menu (F7), they won't be using the module framework and all benefits tied to it.
  • Modules functions are by default not executed when in Eden Editor workspace. It can be enabled using is3DEN property, but that will also change format of function params (see the section about writing a function below).

Example: Show text


2D Editor: The description is available after clicking on "Show Info" button when editing the module
Eden Editor: The description is available after opening the modules' attributes window
  • Pre-defined sync preview entities can be:
Class Descripton
Anything Any object - persons, vehicles, static objects, etc.
AnyPerson Any person. Not vehicles or static objects.
AnyVehicle Any vehicle. No persons or static objects.
GroupModifiers Group Modifiers
AnyStaticObject Any static object. Not persons or vehicles.
AnyBrain Any AI or player. Not empty objects
AnyAI Any AI unit. Not players or empty objects
AnyPlayer Any player. Not AI units or empty objects
EmptyDetector Any trigger

Configuring the Module Function

class CfgFunctions 
{
	class myTag
	{
		class Effects
		{
			file = "\myTag_addonName\functions";
			class moduleNuke{};
		};
	};
};


Writing the Module Function

  • Create the functions folder within the addon folder and place *.sqf or *.fsm files there.
  • Example: \myTag_addonName\functions\fn_moduleNuke.sqf
  • Input parameters differ based on value of is3DEN property.

Example
Show text


Module Properties

Feature arma3

Property Name Description
Name The name of a module can be used to refer to the object in script code. Like all variable names, the name must not contain any spaces or reserved characters. You should try to make it something meaningful and avoid conflicts. Note that if a variable exists with an identical name, no warning will be given and the name will refer to the variable first, rather than the named unit. If you copy and paste a named entity, the duplicate will be automatically have an underscore and number appended to it's name to avoid conflicts.
Initialization Any script code placed in this box will be executed as the mission begins. Script code is extremely powerful and useful - it allows you to create many effects and change aspects of the mission that would not be possible using only the graphical interface of the mission editor. For example, to make a soldier begin the mission unarmed, add "removeAllWeapons this" (without the quotation marks) to it's initialization string. Any expressions in the initialization field must return nothing, or an error message will prevent the unit dialogue from closing.
Description The description property is not used by modules. However, it's used by some functions and it changes the tooltip in Eden Editor when hovering over the module icon.
Probability of Presence Defines how likely it is that the entity will exist each time the mission is played. This can be used to add a bit of randomness to missions. Moving the slider all the way to the right means the object will always be there, all the way to the left means the unit will never appear. Note the Condition of Presence must also return true if the entity is to appear in the mission.
Condition of Presence This is a script code condition which must return true in order for the object to appear in the mission. By default this reads "true" which means the object will appear as defined by it's Probability of Presence. For an example, if you wanted a unit to appear only if the mission is being played in Veteran mode, place "!cadetMode" (without quotation marks) in it's Condition of Presence box. A unit with a Condition of Presence that returns false will not exist in the mission, irrespective of its Probability of Presence.
Placement Radius Changes the object's starting position to a random point within a circle of this radius, in metres. This can be used to add some randomness to your mission. For grouped units, the placement radius is only used by the group leader, and group members with a Special setting of None (or In Cargo for a group without suitable vehicle).

Arma 3 Modules (List)

Module List
Show text


Export Function
Show text


Module Documentation

Here you'll find link to modules which have been documented on this wiki.

Arma 2

Arma 3

Take On Helicopters