{"name":"BIS_fnc_taskDefend","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","games":{"arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"arma2 1.00","arma3_since":"0.50","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","params":[{"name":"group","type":"Group","type_expr":"Group"},{"name":"position","type":"Array in format Position","type_expr":"Position","types":["Array","Position"]}],"returns":{"type":"Boolean","type_expr":"Boolean"}}],"examples":[{"code":["[group player, getPosATL leader player] call BIS_fnc_taskDefend;"]}],"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   - 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     ```"}]}