{"name":"BIS_fnc_taskDefend","operator":null,"title":"BIS fnc taskDefend","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_taskDefend","revid":325114,"updated":"2022-07-01T12:28:08Z","groups":["Tasks"],"status":"ok","replaced_by":[],"games":[{"game":"arma2","name":"Arma 2","version":"1.00"},{"game":"arma2oa","name":"Arma 2: Operation Arrowhead","version":"1.50"},{"game":"tkoh","name":"Take On Helicopters","version":"1.00"},{"game":"arma3","name":"Arma 3","version":"0.50"}],"since":{"game":"arma2","name":"Arma 2","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Group will man nearby static defenses within a 100 metre radius of the defense position and guard the position. Some units will man weapons, others will patrol and the remainder will sit on the ground.","syntaxes":[{"syntax":"[group, position] call BIS_fnc_taskDefend","since":null,"effect":null,"exec":null,"params":[{"name":"group","type":"Group","optional":false,"default":null,"description":null,"types":["Group"],"since":null,"text":"group: Group"},{"name":"position","type":"Array in format Position","optional":false,"default":null,"description":null,"types":["Array","Position"],"since":null,"text":"position: Array in format Position"}],"returns":{"type":"Boolean","types":["Boolean"],"description":null,"text":"Boolean"}}],"examples":[{"text":"```sqf\n[group player, getPosATL leader player] call BIS_fnc_taskDefend;\n```","code":["[group player, getPosATL leader player] call BIS_fnc_taskDefend;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["Functions Library","BIS_fnc_taskAttack","BIS_fnc_taskPatrol"],"notes":[{"user":"Preacher","date":"2009-12-20T12:00:00Z","text":"The easiest way to use this function is to create a group, then add the following code to the group leader's init field:\n\n```sqf\n[group this, getPosATL this] call BIS_fnc_taskDefend;\n```"},{"user":"McHide","date":"2009-12-09T01:59:00Z","text":"The **more correct way** is to:\n\n1. Place function module on map (Arma 2 only)\n1. Make one waypoint for group and put this code in Waypoints  On.Act. field\n\n```sqf\n[group this, getPosATL this] call BIS_fnc_taskDefend;\n```\n\n  - You can use triggers for this function too, but your groups must be named\n\n```sqf\n{ [_x, getPosATL leader _x] call BIS_fnc_taskDefend } forEach [grpName1, grpName2];\n```"}],"categories":["Arma 2: Functions","Arma 2: New Functions","Arma 2: Operation Arrowhead: Functions","Arma 3: Functions","Function Group: Tasks","Functions","Introduced with Arma 2 version 1.00","Take On Helicopters: Functions"],"docblock":null,"filled_from_docblock":[]}