Global Mobilization Boltcutter

From Bohemia Interactive Community
Jump to navigation Jump to search
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!'"];