Global Mobilization Boltcutter: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Some wiki formatting)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[File:gm module boltcutter.jpg|thumb]]
[[File:gm module boltcutter.jpg|thumb]]
== Overview ==
'''[[Global Mobilization]]''' introduces Bolt Cutters. These work straight out of the box and do not need any special enabling.
'''[[Global Mobilization]]''' introduces Bolt Cutters. These work straight out of the box and do not need any special enabling.


With these Bolt Cutters you are able to
With these Bolt Cutters you are able to:


* Cut holes into fences
* Cut holes into fences
Line 11: Line 10:


=== Modding ===
=== Modding ===
The Bolt Cutters are easy to integrate into your mods.
The Bolt Cutters are easy to integrate into your mods.


Line 20: Line 20:
class gm_useBoltcutters
class gm_useBoltcutters
{
{
displayName        = $STR_DN_GM_BOLTCUTTER_PREPARE;
displayName        = "$STR_DN_GM_BOLTCUTTER_PREPARE";
displayNameDefault = "<img image='\gm\gm_weapons\gm_items\data\ui\holdaction_boltcutter_ca.paa' size='2.5' />";
displayNameDefault = "<img image='\gm\gm_weapons\gm_items\data\ui\holdaction_boltcutter_ca.paa' size='2.5' />";
priority          = 10;
priority          = 10;
Line 37: Line 37:
Alternatively you can do this same interaction via [[addAction]] to any object you like:
Alternatively you can do this same interaction via [[addAction]] to any object you like:


<sqf>this addAction
<sqf>
[
this addAction
localize "STR_DN_GM_BOLTCUTTER_PREPARE",  
[
{(_this select 0) call gm_boltcutter_fnc_addAction},
localize "STR_DN_GM_BOLTCUTTER_PREPARE",
[],  
{ (_this select 0) call gm_boltcutter_fnc_addAction },
10,  
[],
false,  
10,
true,  
false,
"",  
true,
"alive _target and !(_target getVariable ['gm_noBoltCutting', false]) and ('gm_boltcutter' in items _this)",  
"",
2.5  
toString { alive _target and !(_target getVariable ["gm_noBoltCutting", false]) and ("gm_boltcutter" in items _this) },
];</sqf>
2.5
];
</sqf>


==== Config Parameters ====
==== Config Parameters ====
Line 55: Line 57:
{{ConfigPage|abc}}
{{ConfigPage|abc}}
===== gm_boltcutAction =====
===== gm_boltcutAction =====
;Type: [[TokenNameValueTypes|String]]
; Type: [[TokenNameValueTypes|String]]
;Description: This parameter controls what happens to the environment after using the cutters:
; Description: This parameter controls what happens to the environment after using the cutters:


{| class="wikitable"
{| class="wikitable"
! Value        !! Type !! Description
! Type !! Description
|-
|-
| {{hl|0}}  || "powerbox" || All surrounding lights within 300m will be disabled
| "powerbox" || All surrounding lights within 300m will be disabled
|-
|-
| {{hl|1}}  || "light" || This indivudal object's lights will be disabled
| "light" || This indivudal object's lights will be disabled
|-
|-
| {{hl|2}}  || "code" || Executes the given code on the client where the boltcutter was used
| "code" || Executes the given code on the client where the boltcutter was used
|-
|-
| {{hl|3}}  || "" || Destroys the object
| "" || Destroys the object
|}
|}


<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
gm_boltcutAction = powerbox;
gm_boltcutAction = powerbox;
</syntaxhighlight>
</syntaxhighlight>


===== gm_replaceObject =====
===== gm_replaceObject =====
;Type: [[TokenNameValueTypes|String]]
; Type: [[TokenNameValueTypes|String]]
;Description: Specifies a CfgVehicles object that is spawned in place for the old one
; Description: Specifies a CfgVehicles object that is spawned in place for the old one
<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
gm_replaceObject = "myDestroyedFenceObject";
gm_replaceObject = "myDestroyedFenceObject";
</syntaxhighlight>
</syntaxhighlight>


===== gm_fenceCutAnimationSource =====
===== gm_fenceCutAnimationSource =====
;Type: [[TokenNameValueTypes|String]]
; Type: [[TokenNameValueTypes|String]]
;Description: Specifies a the animation source that is animated to phase 1 using [[animateSource]]
; Description: Specifies a the animation source that is animated to phase 1 using [[animateSource]]
<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
gm_fenceCutAnimationSource = "hide_fence_hole_source";
gm_fenceCutAnimationSource = "hide_fence_hole_source";
</syntaxhighlight>
</syntaxhighlight>


===== gm_boltcut_code=====
===== gm_boltcut_code=====
;Type: [[TokenNameValueTypes|String]]
; Type: [[TokenNameValueTypes|String]]
;Description: Specifies string containing code that will be executed once the bolt cut action is finished.
; Description: Specifies string containing code that will be executed once the bolt cut action is finished.
<syntaxhighlight lang="c">
<syntaxhighlight lang="cpp">
gm_boltcut_code= "player sidechat 'I am breaking in!'";
gm_boltcut_code = "player sidechat 'I am breaking in!'";
</syntaxhighlight>
</syntaxhighlight>
{{ConfigPage|end}}


{{ConfigPage|end}}
=== Scripting ===
=== Scripting ===
A scripted eventhandler and object variables are also available to further control the bolt cutters.
A scripted eventhandler and object variables are also available to further control the bolt cutters.
{{ConfigPage|start}}
{{ConfigPage|start}}
Line 103: Line 106:
The Scripted Eventhandler <sqf inline>gm_boltCutterUsed</sqf> is available. It will trigger every time a user applies the bolt cutters.
The Scripted Eventhandler <sqf inline>gm_boltCutterUsed</sqf> is available. It will trigger every time a user applies the bolt cutters.


<sqf inline>[missionNamespace, "gm_boltCutterUsed", {player sidechat "I am breaking in!"}] call BIS_fnc_addScriptedEventHandler;</sqf>
<sqf inline>[missionNamespace, "gm_boltCutterUsed", { player sidechat "I am breaking in!" }] call BIS_fnc_addScriptedEventHandler;</sqf>


''Two arguments are processed by this eventhandler.''[_object, _actionType]
''Two arguments are processed by this eventhandler.''[_object, _actionType]


{| class="wikitable"
{| class="wikitable"
! Value        !! Type !! Description
! Type !! Description
|-
|-
| {{hl|0}} || OBJECT || the object that was interacted with
|  OBJECT || the object that was interacted with
|-
|-
| {{hl|1}} || STRING || The action type of this interaction (see gm_boltcutAction for action types)
|  STRING || The action type of this interaction (see gm_boltcutAction for action types)
|}
|}


Line 119: Line 122:
if (_actionType == "light") then
if (_actionType == "light") then
{
{
[_object, "OFF"] remoteExec ["switchLight",0, true]; // turn this light off and add to JIP Queue
[_object, "OFF"] remoteExec ["switchLight", 0, true]; // turn this light off and add to JIP Queue
};
};
</sqf>
</sqf>
==== gm_noBoltCutting ====
==== gm_noBoltCutting ====
If you wish to disable the bolt cutters on a specific object, you can simply set the <sqf inline>gm_noBoltCutting</sqf> variable to true on that object:
If you wish to disable the bolt cutters on a specific object, you can simply set the <sqf inline>gm_noBoltCutting</sqf> variable to true on that object:


<sqf inline>MyPowerBox setVariable ["gm_noBoltCutting", true];</sqf>
<sqf inline>MyPowerBox setVariable ["gm_noBoltCutting", true];</sqf>
==== gm_boltcutAction====
==== gm_boltcutAction====
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_boltcutAction</syntaxhighlight> value.
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_boltcutAction</syntaxhighlight> value.
Line 132: Line 137:


See [[Global_Mobilization_Boltcutter#gm_boltcutAction]] for possible values.
See [[Global_Mobilization_Boltcutter#gm_boltcutAction]] for possible values.
==== gm_fenceCutAnimationSource====
==== gm_fenceCutAnimationSource====
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_fenceCutAnimationSource</syntaxhighlight> value.
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_fenceCutAnimationSource</syntaxhighlight> value.


<sqf inline>MyPowerBox setVariable ["gm_fenceCutAnimationSource", "door_1"];</sqf>
<sqf inline>MyPowerBox setVariable ["gm_fenceCutAnimationSource", "door_1"];</sqf>
==== gm_replaceObject ====
==== gm_replaceObject ====
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_replaceObject</syntaxhighlight> value.
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_replaceObject</syntaxhighlight> value.


<sqf inline>MyPowerBox setVariable ["gm_replaceObject", "land_gm_euro_toy_dinosaur_01"];</sqf>
<sqf inline>MyPowerBox setVariable ["gm_replaceObject", "land_gm_euro_toy_dinosaur_01"];</sqf>
==== gm_boltcut_code====
==== gm_boltcut_code====
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_boltcut_code</syntaxhighlight> segment that will be executed when a bolt cutter is used.
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_boltcut_code</syntaxhighlight> segment that will be executed when a bolt cutter is used.
Line 145: Line 153:
<sqf inline>MyPowerBox setVariable ["gm_boltcut_code", "player sidechat 'I am breaking in!'"];</sqf>
<sqf inline>MyPowerBox setVariable ["gm_boltcut_code", "player sidechat 'I am breaking in!'"];</sqf>
{{ConfigPage|end}}
{{ConfigPage|end}}


[[Category:Global Mobilization]]
[[Category:Global Mobilization]]

Latest revision as of 16:28, 11 February 2024

gm module boltcutter.jpg

Global Mobilization introduces Bolt Cutters. These work straight out of the box and do not need any special enabling.

With these Bolt Cutters you are able to:

  • Cut holes into fences
  • Cut down barbed wire
  • Cut the power of indiviual lights (editor placed ones, only)
  • Sabotage a utility box to turn off multiple lights in a radius (works with map placed and editor placed items)

Modding

The Bolt Cutters are easy to integrate into your mods.

User Action

To tag any of your objects with the "Prepare Bolt Cutter" user action, you'll want to add a user action for that:

		class UserActions
		{
			class gm_useBoltcutters
			{
				displayName        = "$STR_DN_GM_BOLTCUTTER_PREPARE";
				displayNameDefault = "<img image='\gm\gm_weapons\gm_items\data\ui\holdaction_boltcutter_ca.paa' size='2.5' />";
				priority           = 10;
				radius             = 2.5;
				position           = "";
				showWindow         = 0;
				hideOnUse          = 1;
				onlyForPlayer      = 1;
				shortcut           = "";
				condition          = "alive this and !(this getVariable ['gm_noBoltCutting', false]) and ('gm_boltcutter' in items player)";
				statement          = "[this] call gm_boltcutter_fnc_addAction;";
			};
		};

Alternatively you can do this same interaction via addAction to any object you like:

this addAction [ localize "STR_DN_GM_BOLTCUTTER_PREPARE", { (_this select 0) call gm_boltcutter_fnc_addAction }, [], 10, false, true, "", toString { alive _target and !(_target getVariable ["gm_noBoltCutting", false]) and ("gm_boltcutter" in items _this) }, 2.5 ];

Config Parameters

The exact behaviour of the bolt-cutting event is controlled by specific config parameters inside the object that has your user action activated (For example the fence being cut).

gm_boltcutAction
Type
String
Description
This parameter controls what happens to the environment after using the cutters:
Type Description
"powerbox" All surrounding lights within 300m will be disabled
"light" This indivudal object's lights will be disabled
"code" Executes the given code on the client where the boltcutter was used
"" Destroys the object
gm_boltcutAction = powerbox;
gm_replaceObject
Type
String
Description
Specifies a CfgVehicles object that is spawned in place for the old one
gm_replaceObject = "myDestroyedFenceObject";
gm_fenceCutAnimationSource
Type
String
Description
Specifies a the animation source that is animated to phase 1 using animateSource
gm_fenceCutAnimationSource = "hide_fence_hole_source";
gm_boltcut_code
Type
String
Description
Specifies string containing code that will be executed once the bolt cut action is finished.
gm_boltcut_code = "player sidechat 'I am breaking in!'";

Scripting

A scripted eventhandler and object variables are also available to further control the bolt cutters.

gm_boltCutterUsed

The Scripted Eventhandler gm_boltCutterUsed is available. It will trigger every time a user applies the bolt cutters.

[missionNamespace, "gm_boltCutterUsed", { player sidechat "I am breaking in!" }] call BIS_fnc_addScriptedEventHandler;

Two arguments are processed by this eventhandler.[_object, _actionType]

Type Description
OBJECT the object that was interacted with
STRING The action type of this interaction (see gm_boltcutAction for action types)

params ["_object", "_actionType"]; if (_actionType == "light") then { [_object, "OFF"] remoteExec ["switchLight", 0, true]; // turn this light off and add to JIP Queue };

gm_noBoltCutting

If you wish to disable the bolt cutters on a specific object, you can simply set the gm_noBoltCutting variable to true on that object:

MyPowerBox setVariable ["gm_noBoltCutting", true];

gm_boltcutAction

Overwrites the config-specified gm_boltcutAction value.

MyPowerBox setVariable ["gm_boltcutAction", "code"];

See Global_Mobilization_Boltcutter#gm_boltcutAction for possible values.

gm_fenceCutAnimationSource

Overwrites the config-specified gm_fenceCutAnimationSource value.

MyPowerBox setVariable ["gm_fenceCutAnimationSource", "door_1"];

gm_replaceObject

Overwrites the config-specified gm_replaceObject value.

MyPowerBox setVariable ["gm_replaceObject", "land_gm_euro_toy_dinosaur_01"];

gm_boltcut_code

Overwrites the config-specified gm_boltcut_code segment that will be executed when a bolt cutter is used.

MyPowerBox setVariable ["gm_boltcut_code", "player sidechat 'I am breaking in!'"];