{"name":"BIS_fnc_unpackStaticWeapon","operator":null,"title":"BIS fnc unpackStaticWeapon","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_unpackStaticWeapon","revid":352038,"updated":"2024-02-01T23:24:28Z","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 move given support team to the given weapon position.\nThe weapon crew will unpack carried weapon and start watching given target position.\nRequires three personnel in the team: Team Leader, Gunner and Asst. Gunner.\nThis function is MP compatible.\n\nWhen the weapon is unpacked, the \"StaticWeaponUnpacked\" scripted EH is called.\n\n> [!NOTE]\n> If a unit flees, all bets are off and the function will exit leaving units on their own.\n> To guarantee weapon disassembly, make sure the group has maximum courage: `_group allowFleeing 0;`.","syntaxes":[{"syntax":"[group, weaponPos, targetPos, leaderPos] call BIS_fnc_unpackStaticWeapon","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":"weaponPos","type":"Array, String or Object","optional":false,"default":null,"description":"weapon placement position, object position or marker","types":["Array","String","Object"],"since":null,"text":"weaponPos: Array, String or Object - weapon placement position, object position or marker"},{"name":"targetPos","type":"Array, String or Object","optional":false,"default":null,"description":"target position, object position to watch or marker","types":["Array","String","Object"],"since":null,"text":"targetPos: Array, String or Object - target position, object position to watch or marker"},{"name":"leaderPos","type":"Array, String or Object","optional":true,"default":null,"description":"position, object or marker group leader should move to","types":["Array","String","Object"],"since":null,"text":"leaderPos:  Array, String or Object - (Optional) position, object or marker group leader should move to"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[leader1, \"weapon_mrk\", \"target_mrk\"] call BIS_fnc_unpackStaticWeapon;\n```","code":["[leader1, \"weapon_mrk\", \"target_mrk\"] call BIS_fnc_unpackStaticWeapon;"]},{"text":"```sqf\ngroup1 allowFleeing 0;\n[group1, \"weapon_mrk\", tank1, \"leader_mrk\"] call BIS_fnc_unpackStaticWeapon;\n```","code":["group1 allowFleeing 0;\n[group1, \"weapon_mrk\", tank1, \"leader_mrk\"] call BIS_fnc_unpackStaticWeapon;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["BIS_fnc_packStaticWeapon","BIS_fnc_addScriptedEventHandler"],"notes":[{"user":"Killzone_Kid","date":"2017-01-06T23:10: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. After 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. After 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":[]}