Here are some more useful scripts for mission-making in Arma 3. First, a script to put a hold-action on a laptop to allow players to read about Humanitarian laws and laws of war.
1 2 3 4 5 | [BIS_laptop01, localize "STR_A3_Orange_Faction_IDAP_action_article", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_view_article_ca", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_view_article_ca", "(_this distance _target < 3) && (isNull (findDisplay 2035))", "isNull (findDisplay 2035)", {}, BIS_holdActionProgress, {BIS_laptop01 say3D "Orange_Read_Article"; [] execVM "article.sqf"}, {}, [], 0.5, nil, false] call BIS_fnc_holdActionAdd; [BIS_TV1, localize "STR_A3_Orange_Faction_IDAP_action_FM", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_access_fm_ca", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_access_fm_ca", "(_this distance _target < 3) && (isNull (findDisplay 162))", "isNull (findDisplay 162)", {}, BIS_holdActionProgress, {BIS_TV1 say3D "Orange_Access_FM"; ["InternationalHumanitarianLaw", "Overview", findDisplay 46, localize "STR_A3_Orange_Faction_IDAP_FM_filter_LoW"] call BIS_fnc_openFieldManual}, {}, [], 0.5, nil, false] call BIS_fnc_holdActionAdd; [BIS_laptop1, localize "STR_A3_Orange_Faction_IDAP_action_article", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_view_article_ca", "\a3\Missions_F_Orange\Data\Img\Showcase_LawsOfWar\action_view_article_ca", "(_this distance _target < 3) && (isNull (findDisplay 2035))", "isNull (findDisplay 2035)", {}, BIS_holdActionProgress, {BIS_laptop1 say3D "Orange_Read_Article"; [] execVM "\a3\Missions_F_Orange\Campaign\Functions\fn_showCampaignArticle.sqf"}, {}, [], 0.5, nil, false] call BIS_fnc_holdActionAdd; |
Put this in the initPlayerLocal.sqf and then place a laptop named BIS_laptop1. This will be applied to the laptop and then you may use the hold actions to access the Field manual entries.
Set stamina disabled and minimize weapon sway.
1 2 3 4 | player setCustomAimCoef 0.35; player setUnitRecoilCoefficient 0.75; player enablestamina false; player setUnitTrait ["camouflageCoef",0.4]; |
Put this into the initPlayerLocal.sqf file. This will allow a First Aid Kit to provide full healing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | player addEventHandler ["HandleHeal", { _this spawn { params ["_injured","_healer"]; missionNamespace setVariable ['Health', damage _injured,FALSE]; _damage = Health; if (_injured == _healer) then { waitUntil { damage _injured != _damage }; if (damage _injured < _damage) then { titletext ["You used Bandages and Morphine.", "PLAIN DOWN"]; _injured setDamage 0; }; }; }; }]; |
This code will greet the player when they open the arsenal.
1 2 3 4 5 6 7 8 | [missionnamespace,"arsenalClosed", { [player, [missionNamespace, "inventory_var"]] call BIS_fnc_saveInventory; titletext ["Arsenal loadout saved.", "PLAIN DOWN"]; }] call bis_fnc_addScriptedEventhandler; [missionnamespace,"arsenalOpened", { cuttext [format ["Welcome %1, your role is: %2.",profileNameSteam ,getText(configFile >> "CfgVehicles" >> (typeOf player) >> "displayName")],"PLAIN DOWN", 1]; }] call bis_fnc_addScriptedEventhandler; |
Finally, put this code in the initServer.sqf file. This will delete player bodies when they leave the server.
1 2 3 4 5 6 7 8 | handleDisconnect = { _unit = _this select 0; _containers = nearestObjects[_unit,["WeaponHolderSimulated"],8]; { deleteVehicle _x; } foreach _containers; deleteVehicle _unit; }; |