{"name":"BIS_fnc_packStaticWeapon","operator":null,"title":"BIS fnc packStaticWeapon","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_packStaticWeapon","revid":352142,"updated":"2024-02-01T23:25:13Z","groups":["Weapons"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.00"}],"since":{"game":"arma3","name":"Arma 3","version":"1.00"},"arma3_since":"1.00","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"This function will make weapon team pack a static weapon. The weapon crew will pack carried weapon (or given weapon if different) and follow leader. Requires three personnel in the team: Team Leader, Gunner and Asst. Gunner. This function is MP compatible\n\nWhen the weapon is packed, scripted EH \"StaticWeaponPacked\" is called with the following params:\n- [group, leader, gunner, assistant, weaponBag, tripodBag]\n\n> [!NOTE]\n> If a unit flees, all bets are off and the function will exit leaving units on their own. To guarantee weapon disassembly, make sure the group has maximum courage \n>\n> ```sqf\n> _group allowFleeing 0;\n> ```","syntaxes":[{"syntax":"[group, weapon, leaderPos] call BIS_fnc_packStaticWeapon","since":null,"effect":null,"exec":null,"params":[{"name":"group","type":"Group or Object","optional":false,"default":null,"description":"the support team group or a unit from this group","types":["Group","Object"],"since":null,"text":"group: Group or Object - the support team group or a unit from this group"},{"name":"weapon","type":"Object","optional":true,"default":null,"description":"weapon to pack. If nil, current group weapon is packed","types":["Object"],"since":null,"text":"weapon: Object - (Optional) weapon to pack. If nil, current group weapon is packed"},{"name":"leaderPos","type":"Array, String or Object","optional":true,"default":null,"description":"position, object or marker to which the group leader should move after the weapon is packed. By default the group will resume on to the next assigned waypoint. If this param is provided, group will not go to the next waypoint and will move to given position instead","types":["Array","String","Object"],"since":null,"text":"leaderPos: Array, String or Object - (Optional) position, object or marker to which the group leader should move after the weapon is packed. By default the group will resume on to the next assigned waypoint. If this param is provided, group will not go to the next waypoint and will move to given position instead"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[leader1] call BIS_fnc_packStaticWeapon;\n```","code":["[leader1] call BIS_fnc_packStaticWeapon;"]},{"text":"```sqf\ngroup1 allowFleeing 0;\n[group1, nil, \"leaderpos_marker\"] call BIS_fnc_packStaticWeapon;\n```","code":["group1 allowFleeing 0;\n[group1, nil, \"leaderpos_marker\"] call BIS_fnc_packStaticWeapon;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_unpackStaticWeapon","BIS_fnc_addScriptedEventHandler"],"notes":[{"user":"Killzone_Kid","date":"2017-01-06T23:23:00Z","text":"The following script will create a group consisting of a Team Leader, Gunner and Asst. Gunner and give the group 2 random MOVE waypoints.\nAfter the group reached the 1st waypoint, waypoint statement will execute BIS_fnc_unpackStaticWeapon and the group will stop and unpack static weapon, while leader is given random position to go to.\nAfter 7 seconds the BIS_fnc_packStaticWeapon is executed and the group packs and heads to 2nd waypoint.\n\n```sqf\nprivate _group = createGroup west;\nprivate _pos = player getRelPos [20, 0];\nprivate _randomDir = random 360;\nprivate _wp1 = _group addWaypoint [_pos getPos [20, _randomDir], 10];\n_wp1 setWaypointType \"MOVE\";\n_wp1 setWaypointStatements [\"true\", \"\n    group this allowFleeing 0;\n    [group this, 'StaticWeaponUnpacked', {\n        _this spawn\n        {\n            sleep 7;\n            [_this select 0] call BIS_fnc_packStaticWeapon;\n        };\n    }] call BIS_fnc_addScriptedEventHandler;\n    [\n        this, \n        this, \n        this getPos [1000, random 360], \n        this getPos [10, 0]\n    ] call BIS_fnc_unpackStaticWeapon;\n\"];\nprivate _wp2 = _group addWaypoint [_pos getPos [20, _randomDir - 180], 10];\n_wp2 setWaypointType \"MOVE\";\nprivate _leader = _group createUnit [\"B_Soldier_TL_F\", _pos, [], 0, \"NONE\"];\nprivate _gunner = _group createUnit [\"B_Support_GMG_F\", _pos, [], 0, \"NONE\"];\nprivate _assistant = _group createUnit [\"B_Support_AMG_F\", _pos, [], 0, \"NONE\"];\nunits _group doFollow _leader;\n```"}],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Weapons","Functions","Introduced with Arma 3 version 1.00"],"docblock":null,"filled_from_docblock":[]}