Global Mobilization Boltcutter

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

Scripting

A scripted eventhandler and an object variable 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];