Global Mobilization Boltcutter: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
Line 65: Line 65:
| {{hl|1}}  || "light" || This indivudal object's lights will be disabled
| {{hl|1}}  || "light" || This indivudal object's lights will be disabled
|-
|-
| {{hl|2}}  || "" || Destroys the object
| {{hl|2}}  || "code" || Executes the given code on the client where the boltcutter was used
|-
| {{hl|3}}  || "" || Destroys the object
|}
|}


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


{{ConfigPage|end}}
{{ConfigPage|end}}
=== Scripting ===
=== Scripting ===
A scripted eventhandler and an object variable 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}}
{{ConfigPage|abc}}
{{ConfigPage|abc}}
Line 117: Line 126:


<sqf inline>MyPowerBox setVariable ["gm_noBoltCutting", true];</sqf>
<sqf inline>MyPowerBox setVariable ["gm_noBoltCutting", true];</sqf>
==== gm_boltcutAction====
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_boltcutAction</syntaxhighlight> value.
<sqf inline>MyPowerBox setVariable ["gm_boltcutAction", "code"];</sqf>
See [[Global_Mobilization_Boltcutter#gm_boltcutAction]] for possible values.
==== gm_fenceCutAnimationSource====
Overwrites the config-specified <syntaxhighlight lang="cpp" inline>gm_fenceCutAnimationSource</syntaxhighlight> value.
<sqf inline>MyPowerBox setVariable ["gm_fenceCutAnimationSource", "door_1"];</sqf>
==== gm_replaceObject ====
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>
==== 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.
<sqf inline>MyPowerBox setVariable ["gm_boltcut_code", "player sidechat 'I am breaking in!'"];</sqf>
{{ConfigPage|end}}
{{ConfigPage|end}}


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

Revision as of 17:00, 8 April 2023

gm module boltcutter.jpg

Overview

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, "", "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:
Value Type Description
0 "powerbox" All surrounding lights within 300m will be disabled
1 "light" This indivudal object's lights will be disabled
2 "code" Executes the given code on the client where the boltcutter was used
3 "" 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]

Value Type Description
0 OBJECT the object that was interacted with
1 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!'"];