{"name":"setCombatMode","title":"setCombatMode","type":"command","url":"https://community.bistudio.com/wiki/setCombatMode","revid":364240,"updated":"2024-05-06T09:38:16Z","groups":["Groups","AI Behaviour"],"status":"ok","games":{"ofp":"1.00","ofpe":"1.00","arma1":"1.00","arma2":"1.00","arma2oa":"1.50","tkoh":"1.00","arma3":"0.50"},"since":"ofp 1.00","arma3_since":"0.50","locality":{"argument":"local","effect":"global"},"description":"Sets AI group combat mode (engagement rules). For individual unit's combat mode see setUnitCombatMode. Mode may be one of the following:\n\n- `\"BLUE\"` : Never fire, keep formation\n- `\"GREEN\"` : Hold fire, keep formation\n- `\"WHITE\"` : Hold fire, engage at will/loose formation\n- `\"YELLOW\"` : Fire at will, keep formation\n- `\"RED\"` : Fire at will, engage at will/loose formation\n\nSee Combat Modes for more information on combat modes.","syntaxes":[{"syntax":"group setCombatMode mode","params":[{"name":"group","type":"Group or Object","description":"if the argument is unit Object, unit's current group is used.","type_expr":"Group | Object"},{"name":"mode","type":"String","description":"see description","type_expr":"String"}],"returns":{"type":"Nothing","type_expr":"Nothing"},"form":"binary","left":{"text":"group"},"right":{"text":"mode"}}],"examples":[{"code":["_group1 setCombatMode \"BLUE\";"]}],"see_also":["Combat Modes","Mission Editor: Waypoints","combatMode","behaviour","setBehaviour","skill","setSkill","Arma 3: AI Skill","setUnitCombatMode","unitCombatMode","setCombatBehaviour","combatBehaviour"],"notes":[{"user":".kju","date":"2020-01-01T07:35:00Z","text":"- Combat mode can only be changed via scripting/waypoints - not by player radio commands for an AI group.\n\n- \"Engage at will\" means AI can form subgroups and break off to engage known or assigned enemies. These AI will then act largely on their own.\n- As player one can use the \"engage at will\" radio command to achieve the same/similar behavior. However this will not change the unit's combat mode. Yet one can override the \"keep/loose formation\" status of combat mode with radio commands.\n\n- \"Never fire\" means AI will actually never fire. Whereas under \"Hold fire\", AI will shoot back if getting fired upon, hostiles get too close, or they get a target explicitly assigned by the (sub)group leader.\n- As player, one can override the fire status with radio commands (\"Hold fire\", \"Open fire\", \"Fire\"). However this will not change the unit's combat mode.\n- \"Never fire\"/combat mode blue cannot be overridden by group leader target assignment. One needs to command \"Open fire\" or switch to a different combat mode (with \"Hold fire\") to be able to do so.\n\n- Applying combat mode blue, clears the attack target commands from AI subgroups. Might be useful in combination with doFollow/commandFollow. Note: It will not affect assignedTargets."}]}