Reaction Forces/Modules and Functions: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Global note)
(→‎Fire Intensity: More damage was misleading)
 
(One intermediate revision by one other user not shown)
Line 2: Line 2:


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


== Modules ==
== Modules ==
=== Wildfire ===
=== 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.
Creates a fire with defined size and intensity that can be extinguished with the helicopter water bucket. If synchronised 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 synchronised modules. This "influence" system will not spread everything randomly but only happens on predetermined/placed modules so it won't go uncontrollable.
 
==== Arugments ====
==== Arugments ====
===== Fire Intensity =====
===== Fire Intensity =====
The intensity of fire. 0% is no fire, 100% is very intense fire and damage everything near the fire so hard.
The intensity of fire. 0% is no fire, 100% is very intense fire that requires more water to be put out.
 
===== Size =====
===== Size =====
Determines the size of the fire area.
Determines the size of the fire area.
===== On Intensity Changed =====
===== On Intensity Changed =====
A code that will run upon an intensity change e.g. a bucket water has landed on the fire.
A code that will run upon an intensity change e.g. a bucket water has landed on the fire.
<sqf>params ["_module", "_intensityBefore", "_intensityAfter"]</sqf>
<sqf>params ["_module", "_intensityBefore", "_intensityAfter"];</sqf>
Where:
Where:
* _module: the module object
* _module: the module object
Line 20: Line 27:
* _intensityAfter: the intensity after the change
* _intensityAfter: the intensity after the change
You can use a number between 0 to 1 to overwrite the intensity.
You can use a number between 0 to 1 to overwrite the intensity.
===== On Extinguishment =====
===== On Extinguishment =====
A code that will run upon the fire has been extinguished.
A code that will run upon the fire has been extinguished.
<sqf>params ["_module"]</sqf>
<sqf>params ["_module"];</sqf>
Where:
Where:
* _module: the module object
* _module: the module object
==== Note ====
==== Note ====
The extinguished wildfire module will not be deleted automatically. You can use [[deleteVehicle]] to remove the module and effects.
The extinguished wildfire module will not be deleted automatically. You can use [[deleteVehicle]] to remove the module and effects.
Line 30: Line 39:


==== See also ====
==== See also ====
[[#lxRF_fnc_wildfire]]
{{Link|#lxRF_fnc_wildfire}}


=== Hit Indicator ===
=== Hit Indicator ===
Enables audio cues when hitting and taking down enemy soldiers.
Enables audio cues when hitting and taking down enemy soldiers.
The sound is only played if player successfully hit a target.
The sound is only played if player successfully hit a target.
==== Arguments ====
==== Arguments ====
===== Headshots only =====
===== Headshots only =====
Plays the sound only when you've done a headshot.
Plays the sound only when you have done a headshot.
 
===== Scream on death =====
===== Scream on death =====
Plays a scream voice upon you killed a target.
Plays a scream voice upon you killed a target.


== Functions ==
== Functions ==
=== lxRF_fnc_bucket ===
=== lxRF_fnc_bucket ===
Controls Helicopter Bucket functionalities.
Controls Helicopter Bucket functionalities.
==== Syntax ====
==== Syntax ====
<sqf>[bucketObject, mode, arguments] call lxRF_fnc_bucket</sqf>
<sqf>[bucketObject, mode, arguments] call lxRF_fnc_bucket;</sqf>
* bucketObject - Object. Either of "WaterBucket_1000L_Red_RF" or "WaterBucket_1000L_Yellow_RF" type of object should be used.
* bucketObject - Object. Either of "WaterBucket_1000L_Red_RF" or "WaterBucket_1000L_Yellow_RF" type of object should be used.
* mode - String.
* mode - String.
Line 54: Line 71:
** if "setFill",
** if "setFill",
*** Number - 0 to 1 where 0 is empty and 1 is full.
*** Number - 0 to 1 where 0 is empty and 1 is full.
===== Return value =====
===== Return value =====
* Position - Array if "aimPos" mode.
* Position - Array if "aimPos" mode.
==== Examples ====
==== Examples ====
* Fills the bucket: <sqf>[bucket_1, "setFill", 1] call lxRF_fnc_bucket;</sqf>
* Fills the bucket: <sqf>[bucket_1, "setFill", 1] call lxRF_fnc_bucket;</sqf>
Line 61: Line 80:


=== lxRF_fnc_triggerWater ===
=== lxRF_fnc_triggerWater ===
Use in a condition of a trigger so the trigger will detect a water drop from a bucket.
Use in a condition of a trigger so the trigger will detect a water drop from a bucket.
==== Examples ====
==== Examples ====
* In a trigger's Condition: <sqf>thisTrigger call lxRF_fnc_triggerWater</sqf>
* In a trigger's Condition: <sqf>thisTrigger call lxRF_fnc_triggerWater;</sqf>


=== lxRF_fnc_wildFire ===
=== lxRF_fnc_wildFire ===
Controls Wildfire module's functionalities.
Controls Wildfire module's functionalities.
==== Syntax ====
==== Syntax ====
<sqf>[wildfireModule, mode, arguments] call lxRF_fnc_wildFire</sqf>
<sqf>[wildfireModule, mode, arguments] call lxRF_fnc_wildFire;</sqf>
* wildfireModule - Module Object.
* wildfireModule - Module Object.
* mode - String.
* mode - String.
Line 75: Line 98:
** "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.
** "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.
** "DebugOff" - disables the debug system on the module.
===== Return Value =====
===== Return Value =====
* Intesity - Number, 0 to 1 if "getIntensity" mode.
* Intensity - Number, 0 to 1 if "getIntensity" mode.
 
==== Alternative Syntax ====
==== Alternative Syntax ====
<sqf>[position, mode, [intensity, area, onExtinguishedScript, onIntensityChangedScript]] call lxRF_fnc_wildFire</sqf>
<sqf>[position, mode, [intensity, area, onExtinguishedScript, onIntensityChangedScript]] call lxRF_fnc_wildFire;</sqf>
* position - Array.
* position - Array.
* mode - String.
* mode - String.
Line 85: Line 110:
** intensity - (Optional) Number. Sets the initial intensity in 0 to 1. Default: 0.3
** 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
** area - (Optional) Number. Sets the fire area in 1 to 50 in meters. Default: 5
** onExtinguishedScript - (Optional) String. See [[#On Intensity Changed]]. Default: "true"
** onExtinguishedScript - (Optional) String. See {{Link|#On Intensity Changed}}. Default: "true"
** onIntensityChangedScript - (Optional) String. See [[#On Extinguishment]]. Default: "true"
** onIntensityChangedScript - (Optional) String. See {{Link|#On Extinguishment}}. Default: "true"
 
===== Return Value =====
===== Return Value =====
* module - Created Wildfire module.
* module - Created Wildfire module.
==== Alternative Syntax 2 ====
==== Alternative Syntax 2 ====
<sqf>mode call lxRF_fnc_wildFire</sqf>
<sqf>mode call lxRF_fnc_wildFire;</sqf>
* mode - String.
* mode - String.
** "DebugOn" - Enables the debug on every Wildfire modules.
** "DebugOn" - Enables the debug on every Wildfire modules.
** "DebugOff" - Disables 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.
** "AutoConnect" - In Eden Editor only: sets the synchronisation network on every selected Wildfire modules, depends on the distance between and area, so spread/influence system will work.


=== lxRF_fnc_mapContextMenu ===
=== lxRF_fnc_mapContextMenu ===
Generates a context menu upon a mouse click on the map.
Generates a context menu upon a mouse click on the map.
==== Syntax ====
==== Syntax ====
<sqf>["Init"] call lxRF_fnc_mapContextMenu</sqf>
<sqf>["Init"] call lxRF_fnc_mapContextMenu;</sqf>
 
==== Alternative Syntax ====
==== Alternative Syntax ====
<sqf>["Init", [LMB, RMB]] call lxRF_fnc_mapContextMenu</sqf>
<sqf>["Init", [LMB, RMB]] call lxRF_fnc_mapContextMenu;</sqf>
* LMB - Boolean. true to enable the menu upon a Left Click.
* LMB - Boolean. true to enable the menu upon a Left Click.
* RMB - Boolean. true to enable the menu upon a Right Click.
* RMB - Boolean. true to enable the menu upon a Right Click.
==== Setting the context menu items ====
==== Setting the context menu items ====
An item is defined in this syntax:
An item is defined in this syntax:
Line 115: Line 146:
* textCol - Array, format [R, G, B, A], sets the item text color
* textCol - Array, format [R, G, B, A], sets the item text color
* itemExpand - Array, define nested items within this array
* itemExpand - Array, define nested items within this array
<sqf>lxRF_fnc_mapContextMenu_menu = [
<sqf>
["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"],
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
["*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 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 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 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", nil, nil, nil, nil, nil, nil, [
["Example Item 5-1",{systemChat "Same way to define it"}],
["Example Item 5-1", { systemChat "Same way to define it" }],
[],
[],
["Example Item 5-2"]
["Example Item 5-2"]
]] // nesting items is also possible like this
]] // nesting items is also possible like this
];</sqf>
];
</sqf>
lxRF_fnc_mapContextMenu_menu is a [[missionNamespace]] variable. If the variable is empty [] nothing will happen
lxRF_fnc_mapContextMenu_menu is a [[missionNamespace]] variable. If the variable is empty [] nothing will happen
==== Event Handlers ====
==== Event Handlers ====
To run an EH before the menu generation:
To run an EH before the menu generation:
<sqf>[missionNamespace,"lxRF_fnc_mapContextMenu_beforeCall",{
<sqf>
params ["_map","_mPos"];
[missionNamespace,"lxRF_fnc_mapContextMenu_beforeCall", {
}] call BIS_fnc_addScriptedEventHandler;</sqf>
params ["_map", "_mPos"];
}] call BIS_fnc_addScriptedEventHandler;
</sqf>
* _map - Control, the map control
* _map - Control, the map control
* _mPos - Array, the mouse position
* _mPos - Array, the mouse position
Line 147: Line 183:


=== lxRF_fnc_customGameOptions ===
=== lxRF_fnc_customGameOptions ===
Gets or sets the custom game options in RF's custom game options framework.
Gets or sets the custom game options in RF's custom game options framework.
==== Syntax ====
==== Syntax ====
<sqf>[mode, option, setDefault] call lxRF_fnc_customGameOptions</sqf>
<sqf>[mode, option, setDefault] call lxRF_fnc_customGameOptions;</sqf>
* mode - String
* mode - String
** "set" - Sets the option setting.
** "set" - Sets the option setting.
Line 158: Line 196:
* value - Number, if "get" or "forceGet"
* value - Number, if "get" or "forceGet"
==== See also ====
==== See also ====
[[#Custom Game Options Framework]]
{{Link|#Custom Game Options Framework}}


=== lxRF_fnc_openCustomConfig ===
=== 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.
Use this to update the Dedicated server's setting to overwrite everyone's setting. You have to be an admin to use this.
<sqf>call lxRF_fnc_openCustomConfig</sqf>
<sqf>call lxRF_fnc_openCustomConfig;</sqf>
 


== Custom Game Options Framework ==
== Custom Game Options Framework ==
In Reaction Forces, we introduced a framework to add game options.
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.
You can access the custom category in regular Game Options screen. Also the options are very moddable via a config.
Line 170: Line 211:
class lxRF_customDifficultyOptions
class lxRF_customDifficultyOptions
{
{
    // this will be the variable header
// this will be the variable header
    class yourTag
class yourTag
    {
{
        displayName = "Your Options";
displayName = "Your Options";
        class Options
class Options
        {
{
            // this will be the variable suffix
// this will be the variable suffix
            // so will be saved into profile with the name yourTag_combo in this case
// so will be saved into profile with the name yourTag_combo in this case
            class combo
class combo
            {
{
                displayName = "combo";
displayName = "combo";
                type = "combo";
type = "combo";
                optionPicture = "something_co.paa";
optionPicture = "something_co.paa";
                optionDescription = "desc";
optionDescription = "desc";
                class items
class items
                {
{
                    class first
class first
                    {
{
                        displayName = "first";
displayName = "first";
                        value = 0;   // this variable will be stored into the profile
value = 0; // this variable will be stored into the profile
                    };
};
                    class second
 
                    {
class second
                        displayName = "second";
{
                        value = 1;
displayName = "second";
                    };
value = 1;
                    class third
};
                    {
 
                        displayName = "third";
class third
                        value = 2;
{
                    };
displayName = "third";
                };
value = 2;
            };
};
            class checkbox
};
            {
};
                displayName = "checkbox";
 
                type = "checkBox";   // 0 or 1
class checkbox
            };
{
            class slider
displayName = "checkbox";
            {
type = "checkBox"; // 0 or 1
                displayName = "slider";
};
                type = "slider";   // 0 to 1
 
            };
class slider
        };
{
    };
displayName = "slider";
type = "slider"; // 0 to 1
};
};
};
};
};
</syntaxhighlight>
</syntaxhighlight>

Latest revision as of 21:13, 12 October 2024

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 synchronised 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 synchronised 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 that requires more water to be put out.

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 have 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. (Run globally aka remoteExec or remoteExecCall to apply the changes to all client!)
    • "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
  • Intensity - 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 synchronisation 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
			};
		};
	};
};