Global Mobilization Script Snippets

From Bohemia Interactive Community
Jump to navigation Jump to search
borderless

This page serves as a place to collect all smaller known script snippets (and other tricks) related to using the content of Global Mobilization.


Destroy specific chunks of a house

Use this code on an invisible object nearby the house. chunk_01_hp to chunk_11_hp. But most homes only have 3-4 chunks.

(nearestBuilding this) setHit ["chunk_03_hp", 1, false];


Extend a vehicle's large antenna

_vic animateSource ["antennamast_01_elev_source", 1, true];

To lower it again, set the second parameter from 1 to 0. If you want to have a slow assembly/disassembly animation, omit the last parameter that is set to true in this example.

Close the XSW-30 target searchlight on the Leopard tanks

leo animateSource ["MainTurret_searchLight_door_source", 0, true];

Set the second parameter to 1 to open it again. Warning: This doesn't affect the searchlight functionality. It will shine through closed doors.


Open doors and hatches on a vehicle

<object> animatedoor ["<DoorName>", 1];

Animate the M113's main rear hatch:

m113dk animatedoor ["hatch_2_1_source", 1];

All doors and hatches in GM follow a unified naming standard:

<type>_<row>_<side>_source

A list of most commonly found doors and hatches:

  • hatch_1_1_source
  • hatch_1_2_source
  • hatch_2_1_source
  • hatch_2_2_source
  • door_1_1_source
  • door_1_2_source
  • door_2_1_source
  • door_2_2_source

It varies per asset, so you may have to try a few combinations until you find the right animation.


Set a vehicle's tactical sign

[myM113, ["1", "gm_din_norm_gry", "gm_tacticalSign_nato_mechanizedInfantry", "100", "gm_din_norm_gry"]] call gm_core_vehicles_fnc_setTacticalSign;

The array is in format [preIconNumber, preIconNumberFont, tacticalSymbol, postIconNumber, postIconNumberFont]:

  • preIconNumber: String - pre-icon number
  • preIconNumberFont: String - pre-icon number font
  • tacticalSymbol: String - tactical symbol; for available tactical symbols browse configFile >> "gm_tacticalSigns"; possible values:
    • "gm_tacticalSign_nato_armored"
    • "gm_tacticalSign_nato_armoredEngineer"
    • "gm_tacticalSign_nato_armoredRecon"
    • "gm_tacticalSign_nato_artillery"
  • postIconNumber: String - post-icon number
  • postIconNumberFont: String - post-icon number font


GM flags present on a flagpole

Place an existing flagpole, and write the following into the init-field of this object:

this setFlagTexture "\gm\gm_core\data\flags\gm_flag_gc_co.paa";

The following flags are available from within GM:

  • gm_flag_au_co.paa
  • gm_flag_be_co.paa
  • gm_flag_bu_co.paa
  • gm_flag_ca_co.paa
  • gm_flag_cs_co.paa
  • gm_flag_cz_co.paa
  • gm_flag_dk_co.paa
  • gm_flag_fi_co.paa
  • gm_flag_fr_co.paa
  • gm_flag_gc_co.paa
  • gm_flag_ge_co.paa
  • gm_flag_gr_co.paa
  • gm_flag_hu_co.paa
  • gm_flag_ic_co.paa
  • gm_flag_it_co.paa
  • gm_flag_lu_co.paa
  • gm_flag_nato_co.paa
  • gm_flag_nl_co.paa
  • gm_flag_no_co.paa
  • gm_flag_pl_co.paa
  • gm_flag_po_co.paa
  • gm_flag_ro_co.paa
  • gm_flag_se_co.paa
  • gm_flag_sp_co.paa
  • gm_flag_tu_co.paa
  • gm_flag_uk_co.paa
  • gm_flag_ur_co.paa
  • gm_flag_us_co.paa

They are assigned via the NATO 2-Letter Nation code from STANAG 1059 7th Edition.

Find the 9th edition (which differs) here: List of NATO country codes

GE = West Germany
GC = East Germany


Toggle vehicle beacons and sirens

[this, "gm_beacons_org", true] call gm_core_vehicles_fnc_beaconSwitch;

[this, "", true] call gm_core_vehicles_fnc_beaconSwitch;


true for on, false for off.

gm_beacons_org for the orange one, and gm_beacons_blu for blue. Leave it empty "" as secondary method.

To toggle beacons on a car via script: (also possible gm_beacons_orn on vehicles with orange beacon lights).

Toggle on: [this, "gm_beacons_blu", true] call gm_core_vehicles_fnc_beaconSwitch;

Toggle off: [this, "gm_beacons_blu", false] call gm_core_vehicles_fnc_beaconSwitch;

Sirens on: [this, "CustomSoundController1", 1, 0.2] remoteExec ["BIS_fnc_setCustomSoundController"];

Sirens off: [this, "CustomSoundController1", 0, 0.4] remoteExec ["BIS_fnc_setCustomSoundController"];


Use the teletype effect from the Campaign Intro

1) Include this in your description.ext in class RscTitles

"\gm\gm_missions\gm_campaign_01\missions\gm_campaign_intro.gm_weferlingen_summer\resources.inc"


2) Include this in CfgSounds:

class gm_teletype_stroke_01
{
	name = "";
	titles[] = {};
	sound[] = { "@gm\gm_missions\gm_campaign_01\missions\gm_campaign_intro.gm_weferlingen_summer\sounds\gm_teletype_stroke_01.ogg", 3, 1, 100 };
};

class gm_teletype_stroke_02 : gm_teletype_stroke_01
{
	sound[] = { "@gm\gm_missions\gm_campaign_01\missions\gm_campaign_intro.gm_weferlingen_summer\sounds\gm_teletype_stroke_01.ogg", 3, 0.98, 100 };
};

class gm_teletype_stroke_03 : gm_teletype_stroke_01
{
	sound[] = { "@gm\gm_missions\gm_campaign_01\missions\gm_campaign_intro.gm_weferlingen_summer\sounds\gm_teletype_stroke_01.ogg", 3, 1.02, 100 };
};


3) Create script called typeText.sqf.

private _text = _this; if (isNull (uiNameSpace getVariable ["gm_teleraet_overlay", displayNull])) then {91 cutRsc ["gm_teleraet_overlay", "PLAIN"]}; private _o = uiNameSpace getVariable ["gm_teleraet_overlay", displayNull]; private _len = count _text; private _cache = [""]; private _curLnLen = 0; private _cln = 0; private _maxLines = 7; for "_i" from 1 to _len do { private _curC = _text select [_i-1, 1]; switch true do { // add a space, which is a bit faster than regular typing. case (_curC == " ") : { private _ct = (_cache select _cln); _ct = _ct + _curC; _cache set [_cln, _ct]; _curLnLen = _curLnLen + 1; sleep 0.03; }; // add a linebreak, which means writer head needs to readjust and travel back the lenngth of current line case (_curC == "@") : { _cache pushBack linebreak; _cache pushBack ""; _cln = _cln +2; _curLnLen = 0; sleep (0.14 +(_curLnLen * 0.05)); }; // text, so we write and wait, plus play sound default { private _ct = _cache select _cln; _ct = _ct + _curC; _cache set [_cln, _ct]; _curLnLen = _curLnLen + 1; playSound [selectRandom ["gm_teletype_stroke_01", "gm_teletype_stroke_02", "gm_teletype_stroke_03"], true]; sleep 0.06; }; }; // adjust cacheLines to follow the max visible lines private _dif = ((count _cache - ({_x isEqualTo linebreak} count _cache)) - _maxLines) max 0; if (_dif > 0) then { _dif = _dif + 1 }; _cache deleteRange [0, _dif]; _cln = _cln - _dif; (_o displayCtrl 2) ctrlSetStructuredText composeText _cache; };


4) Call the script via "My Text Is This" execVM "typeText.sqf". You can also make it a function and spawn it.

Using the @ character in the input text will cause a line break.


Add helmet camo to any unit

player linkItem "gm_hmd_foliage_summer_grass_01";

You can use these types:

  • gm_hmd_foliage_summer_grass_01
  • gm_hmd_foliage_summer_grass_02
  • gm_hmd_foliage_summer_grass_03
  • gm_hmd_foliage_summer_grass_04
  • gm_hmd_foliage_autumn_grass_01
  • gm_hmd_foliage_autumn_grass_02
  • gm_hmd_foliage_autumn_grass_03
  • gm_hmd_foliage_autumn_grass_04
  • gm_hmd_foliage_summer_forest_01
  • gm_hmd_foliage_summer_forest_02
  • gm_hmd_foliage_summer_forest_03
  • gm_hmd_foliage_summer_forest_04


Eject parachutists out of a vehicle

Inside "On Activation" of a waypoint for the plane (not the squad to jump out!)

temp = this spawn { { private _d = _x select 0; moveOut _d; unassignVehicle _d; sleep (0.7 + random 0.2); } forEach fullCrew [vehicle leader _this, "cargo"]; };


Mi-2Ch Smoke Generator control

Turn On: [this] call gm_countermeasures_fnc_engine_smoke_toggle;

Turn Off: [this, true] call gm_countermeasures_fnc_engine_smoke_toggle;


Override Bridge Laying Restrictions

If you want to override the red indicator and deploy/pickup the bridge regardless:

vehicle player setVariable ["GM_BRIDGE_ACCEPTED", true, true]; vehicle player setVariable ["GM_BRIDGE_INPOSITION", true, true];


Start a bridge deployment

[yourBridgeLayer] spawn gm_core_vehicles_fnc_bridge_deploy;

Once activated you can force the process into the next phase of actively deploying it via the above mentioned lines:

yourBridgeLayer setVariable ["GM_BRIDGE_ACCEPTED", true, true]; yourBridgeLayer setVariable ["GM_BRIDGE_INPOSITION", true, true];

There may be side effects from forcing the deployment in an unsuitable location.


Spawn a bridgelayer without bridge

this setVariable ["GM_BRIDGE_BRIDGELOADED", false, true]; this setVariable ["GM_BRIDGE_STATUS", false, true]; this animateSource ["gm_bridgePrepare_source", 1, true]; this animateSource ["gm_bridgeDetach_source", 1, true]; this animateSource ["gm_bridgeReady_source", 1, true];


Nuclear Warhead for the 2P16 Luna

To quickly change the 2P16 over to the nuclear missile use the following code to circumvent the long reload time the missile otherwise would have:

myLuna is the given variable name of the vehicle. You can use this instead when pasting this into the vehicle's init line.

myLuna removeMagazinesTurret ["gm_1Rnd_luna_he_3r9", [0]]; myLuna removeWeaponTurret ["gm_luna_launcher", [0]]; myLuna addMagazineTurret ["gm_1Rnd_luna_nuc_3r10", [0]]; myLuna addWeaponTurret ["gm_luna_launcher", [0]];


Searchlight Guard Towers

To easily turn the BT-6 and BT-11 guard towers in functioning towers that scan with search lights, raise alarm and shoot flares:

Paste this code into your init.sqf:

if isServer then { gm_fr_guardTowerCrew = ["gm_gc_army_rifleman_mpiak74n_80_str"]; // change the classnames in here to the type of soldier you want gm_fr_alarmSirenSound = "gm_alarmHorn"; // you can change this to other sounds gm_fr_alarmFlareAmmoType = "gm_flare_illum_red"; // you can change this to other flare sounds gm_fr_side_friendly = west; // use the appropriate side for your enemies gm_fr_side_enemy = east; // use the appropriate side for your enemies gm_fr_extendedDebugMode = 0; // leave it as 0 gm_alias_fr_fnc_debugMarker = [{ "" }]; // leave this the way it is gm_alias_fr_fnc_raiseAlarm = [gm_fr_fnc_raiseAlarm]; gm_alias_fr_fnc_shootFlare = [gm_core_fnc_shootIllumFlare]; { _x call gm_fr_fnc_makeBorderTurret; } forEach allMissionObjects "gm_missionHelper_guardtower"; // you can change the logic type to any object you want, best to leave it this way };

Then go around the map in Weferlingen and place the Guard Tower Mission Context object gm_missionHelper_guardtower near any of the guard towers you wish to equip.