Reaction Forces/Modules and Functions

From Bohemia Interactive Community
Revision as of 09:51, 28 March 2024 by POLPOX (talk | contribs)
Jump to navigation Jump to search

This article explains useful Modules and Functions you can use in your mission making.

Modules

Wildfire

Creates a fire with defined size and intensity that can be extinguished with the helicopter water bucket. If synchronized to each other, the module with the highest fire intensity will slowly increase lower intensity fire modules. If you synchronize Wildfire modules in Eden Editor, the fire intensity will spread to synchronized modules. This “influence” system will not spread everything randomly but only happens on predetermined/placed modules so it won't go uncontrollable.

Arugments

Fire Intensity

The intensity of fire. 0% is no fire, 100% is very intense fire and damage everything near the fire so hard.

Size

Determines the size of the fire area.

On Intensity Changed

A code that will run upon an intensity change e.g. a bucket water has landed on the fire.

params ["_module", "_intensityBefore", "_intensityAfter"]

Where:

  • _module: the module object
  • _intensityBefore: the intensity before the change
  • _intensityAfter: the intensity after the change

You can use a number between 0 to 1 to overwrite the intensity.

On Extinguishment

A code that will run upon the fire has been extinguished.

params ["_module"]

Where:

  • _module: the module object

Note

The extinguished wildfire module will not be deleted automatically. You can use deleteVehicle to remove the module and effects. If the simulation is disabled (enableSimulation) the influence system will stop to receive nearby wildfire's intensity.

See also

#lxRF_fnc_wildfire

Hit Indicator

Enables audio cues when hitting and taking down enemy soldiers. The sound is only played if player successfully hit a target.

Arguments

Headshots only

Plays the sound only when you've done a headshot.

Scream on death

Plays a scream voice upon you killed a target.

Functions

lxRF_fnc_bucket

Controls Helicopter Bucket functionalities.

Syntax

[bucketObject, mode, arguments] call lxRF_fnc_bucket

  • bucketObject - Object. Either of "WaterBucket_1000L_Red_RF" or "WaterBucket_1000L_Yellow_RF" type of object should be used.
  • mode - String.
    • "ReleaseWater" - releases the current water.
    • "setFill" - sets the water level.
    • "aimPos" - returns the estimated water aiming/land position.
  • arguments - see below.
    • if "setFill",
      • Number - 0 to 1 where 0 is empty and 1 is full.
Return value
  • Position - Array if "aimPos" mode.

Examples

  • Fills the bucket:
    [bucket_1, "setFill", 1] call lxRF_fnc_bucket;
  • Perform a waterbomb:
    [bucket_1, "ReleaseWater"] call lxRF_fnc_bucket;

lxRF_fnc_triggerWater

Use in a condition of a trigger so the trigger will detect a water drop from a bucket.

Examples

lxRF_fnc_wildFire

Controls Wildfire module's functionalities.

Syntax

[wildfireModule, mode, arguments] call lxRF_fnc_wildFire

  • wildfireModule - Module Object.
  • mode - String.
    • "setIntensity" - sets the wildfire's intensity level.
    • "getIntensity" - gets the wildfire's intensity level.
    • "DebugOn" - enables the debug system on the module. The debulg will show the position of the module, intensity and area in 3D space and map.
    • "DebugOff" - disables the debug system on the module.
Return Value
  • Intesity - Number, 0 to 1 if "getIntensity" mode.

Alternative Syntax

[position, mode, [intensity, area, onExtinguishedScript, onIntensityChangedScript]] call lxRF_fnc_wildFire

  • position - Array.
  • mode - String.
    • "fireCreate" - sets the wildfire's intensity level.
  • arguments - (Optional) Array.
    • intensity - (Optional) Number. Sets the initial intensity in 0 to 1. Default: 0.3
    • area - (Optional) Number. Sets the fire area in 1 to 50 in meters. Default: 5
    • onExtinguishedScript - (Optional) String. See #On Intensity Changed. Default: "true"
    • onIntensityChangedScript - (Optional) String. See #On Extinguishment. Default: "true"
Return Value
  • module - Created Wildfire module.

Alternative Syntax 2

mode call lxRF_fnc_wildFire

  • mode - String.
    • "DebugOn" - Enables the debug on every Wildfire modules.
    • "DebugOff" - Disables the debug on every Wildfire modules.
    • "AutoConnect" - In Eden Editor only: sets the synchronization network on every selected Wildfire modules, depends on the distance between and area, so spread/influence system will work.

lxRF_fnc_mapContextMenu

Generates a context menu upon a mouse click on the map.

Syntax

["Init"] call lxRF_fnc_mapContextMenu

Alternative Syntax

["Init", [LMB, RMB]] call lxRF_fnc_mapContextMenu

  • LMB - Boolean. true to enable the menu upon a Left Click.
  • RMB - Boolean. true to enable the menu upon a Right Click.

Setting the context menu items

An item is defined in this syntax:

[text, action, icon, tooltip, enabled, bgCol, textCol, itemExpand]

  • text - String, item text/title
  • action - Code, action to execute upon clicking this item
  • icon - String, icon path to be shown in the item
  • tooltip - String, tooltip to be shown when mouse over the item
  • enabled - Boolean, true to enable this item, false to disable so cannot click the item
  • bgCol - Array, format [R, G, B, A], sets the background color of the item
  • textCol - Array, format [R, G, B, A], sets the item text color
  • itemExpand - Array, define nested items within this array

lxRF_fnc_mapContextMenu_menu = [ ["Example Item 1",{params ["_ctrl","_mPos","_path"]; systemChat format ["Cursor pos: %1, Item path: %2",_mPos,_path]},"a3\3den\Data\Cfg3DEN\Comment\texture_ca.paa","Tooltip is also possible"], ["*hr*"], // or you can leave this array empty [] so it can create a separate line ["Example Item 2",{},"","",false], // you can disable an item ["Example Item 3",{},"","",false,[1,0,1,1],[0,1,0,1]], // you can also set BG and text color ["Example Item 4",nil,nil,nil,nil,nil,nil], // using nil will use default argument ["Example Item 5",nil,nil,nil,nil,nil,nil,[ ["Example Item 5-1",{systemChat "Same way to define it"}], [], ["Example Item 5-2"] ]] // nesting items is also possible like this ];

lxRF_fnc_mapContextMenu_menu is a missionNamespace variable. If the variable is empty [] nothing will happen

Event Handlers

To run an EH before the menu generation:

[missionNamespace,"lxRF_fnc_mapContextMenu_beforeCall",{ params ["_map","_mPos"]; }] call BIS_fnc_addScriptedEventHandler;

  • _map - Control, the map control
  • _mPos - Array, the mouse position

Useful to change the items depends on the context. To run an EH after the menu generation:

[missionNamespace,"lxRF_fnc_mapContextMenu_beforeCall",{ params ["_map","_mPos","_disp","_ctrls"]; }] call BIS_fnc_addScriptedEventHandler;

  • _map - Control, the map control
  • _mPos - Array, the mouse position
  • _disp - Display, the created display
  • _ctrls - Array, the button controls

Useful to change the GUI elements' preferences if necessary.

lxRF_fnc_customGameOptions

Gets or sets the custom game options in RF's custom game options framework.

Syntax

[mode, option, setDefault] call lxRF_fnc_customGameOptions

  • mode - String
    • "set" - Sets the option setting.
    • "get" - Gets the option setting.
    • "forceGet" - Gets the option setting. This will not consider the MP server's setting but only your profile's preference.
  • setDefault - (Optional) Boolean, if "get" or "forceGet" sets the default state and save into the profile.
Return Value
  • value - Number, if "get" or "forceGet"

See also

#Custom Game Options Framework

lxRF_fnc_openCustomConfig

Use this to update the Dedicated server's setting to overwrite everyone's setting. You have to be an admin to use this.

call lxRF_fnc_openCustomConfig

Custom Game Options Framework

In Reaction Forces, we introduced a framework to add game options. You can access the custom category in regular Game Options screen. Also the options are very moddable via a config.

class lxRF_customDifficultyOptions
{
    // this will be the variable header
    class yourTag
    {
        displayName = "Your Options";
        class Options
        {
            // this will be the variable suffix
            // so will be saved into profile with the name yourTag_combo in this case
            class combo
            {
                displayName = "combo";
                type = "combo";
                optionPicture = "something_co.paa";
                optionDescription = "desc";
                class items
                {
                    class first
                    {
                        displayName = "first";
                        value = 0;    // this variable will be stored into the profile
                    };
                    class second
                    {
                        displayName = "second";
                        value = 1;
                    };
                    class third
                    {
                        displayName = "third";
                        value = 2;
                    };
                };
            };
            class checkbox
            {
                displayName = "checkbox";
                type = "checkBox";    // 0 or 1
            };
            class slider
            {
                displayName = "slider";
                type = "slider";    // 0 to 1
            };
        };
    };
};