Global Mobilization Boltcutter: Difference between revisions
Lou Montana (talk | contribs) m (Some wiki formatting) |
|||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
[[File:gm module boltcutter.jpg|thumb]] | [[File:gm module boltcutter.jpg|thumb]] | ||
'''[[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 }, | |||
[], | |||
10, | |||
false, | |||
true, | |||
"", | |||
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" | ||
! 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 | |||
|} | |} | ||
<syntaxhighlight lang=" | <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=" | <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=" | <syntaxhighlight lang="cpp"> | ||
gm_fenceCutAnimationSource = "hide_fence_hole_source"; | gm_fenceCutAnimationSource = "hide_fence_hole_source"; | ||
</syntaxhighlight> | </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="cpp"> | |||
gm_boltcut_code = "player sidechat 'I am breaking in!'"; | |||
</syntaxhighlight> | |||
{{ConfigPage|end}} | {{ConfigPage|end}} | ||
=== Scripting === | === Scripting === | ||
A scripted eventhandler and | |||
A scripted eventhandler and object variables are also available to further control the bolt cutters. | |||
{{ConfigPage|start}} | {{ConfigPage|start}} | ||
{{ConfigPage|abc}} | {{ConfigPage|abc}} | ||
Line 94: | 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" | ||
! Type !! Description | |||
|- | |- | ||
| | | OBJECT || the object that was interacted with | ||
|- | |- | ||
| | | STRING || The action type of this interaction (see gm_boltcutAction for action types) | ||
|} | |} | ||
Line 110: | 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==== | |||
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]] |
Latest revision as of 15:28, 11 February 2024
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:
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) |
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!'"];