{"name":"setCombatMode","operator":null,"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","replaced_by":[],"games":[{"game":"ofp","name":"Operation Flashpoint","version":"1.00"},{"game":"ofpe","name":"Operation Flashpoint: Elite","version":"1.00"},{"game":"arma1","name":"Armed Assault","version":"1.00"},{"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":"ofp","name":"Operation Flashpoint","version":"1.00"},"arma3_since":"0.50","branch":null,"locality":{"argument":"local","effect":"global","server_exec":false},"exec":null,"description":"Sets AI group combat mode (engagement rules). For individual unit's combat mode see setUnitCombatMode. Mode may be one of the following:\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\nSee Combat Modes for more information on combat modes.","syntaxes":[{"syntax":"group setCombatMode mode","since":null,"effect":null,"exec":null,"params":[{"name":"group","type":"Group or Object","optional":false,"default":null,"description":"if the argument is unit Object, unit's current group is used.","types":["Group","Object"],"since":null,"text":"group: Group or Object - if the argument is unit Object, unit's current group is used."},{"name":"mode","type":"String","optional":false,"default":null,"description":"see description","types":["String"],"since":null,"text":"mode: String - see description"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"},"form":"binary","operator":null,"left":{"text":"group","types":["Group","Object"]},"right":{"text":"mode","types":["String"]}}],"examples":[{"text":"```sqf\n_group1 setCombatMode \"BLUE\";\n```","code":["_group1 setCombatMode \"BLUE\";"]}],"multiplayer":null,"problems":null,"aliases":[],"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."}],"categories":["ArmA: Armed Assault: Scripting Commands","Arma 2: Operation Arrowhead: Scripting Commands","Arma 2: Scripting Commands","Arma 3: Scripting Commands","Command Group: AI Behaviour","Command Group: Groups","Introduced with Operation Flashpoint version 1.00","Operation Flashpoint: Elite: Scripting Commands","Operation Flashpoint: New Scripting Commands","Operation Flashpoint: Scripting Commands","Scripting Commands","Scripting Commands: Global Effect","Take On Helicopters: Scripting Commands"]}