{"name":"fleeing","title":"fleeing","type":"command","url":"https://community.bistudio.com/wiki/fleeing","revid":349082,"updated":"2023-11-08T14:47:23Z","groups":["Object Manipulation"],"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":"global"},"description":"Checks if a unit is fleeing.\n\nNotes:\n\n- Fleeing only affects AI led groups.\n- Only the group as a whole can flee (or not).\n- The courage of the AI group is based on the group's leader courage subskill.\n- Each group has a max strength (summed \"armor\" of all infantry units - plus armor when inside vehicles).\n- If the group losses by injury/damage or death/destruction are higher than the max strength, multiplied by leader's courage or allowFleeing level , then the group will start fleeing.\n- As result primarily the AI flees to a nearby \"supply point\" (some friendly units - preferably with medic or engineer, or a vehicle with repair/ammo/fuel cargo). Alternatively it will try to find a safe position within a 600m radius from the initial waypoint (danger, distance, amount of cover positions are taken into account).\n- After the fleeing has been finished the group's initial strength is reset.\n- Fleeing units in combatMode red, will be set to yellow when fleeing to avoid engaging enemies while doing so.\n- While fleeing, the group leader will be set to green, to avoid giving engage or fire orders, unless in combatMode blue already. Also speedMode is set to full.\n- When reaching their flee point/destination, they will change to combatMode yellow and speedMode normal.\n- With allowFleeing one can make unit's flee earlier (or essentially never flee). Apply it, overrides the courage subskill influence.","syntaxes":[{"syntax":"fleeing unit","params":[{"name":"unit","type":"Object","type_expr":"Object"}],"returns":{"type":"Boolean","type_expr":"Boolean","description":"returns true if a unit is fleeing, false if not. Dead or empty units return false.","text":"Boolean - returns true if a unit is fleeing, false if not. **Dead** or **empty** units return false."},"form":"unary","right":{"text":"unit"}}],"examples":[{"code":["if (fleeing soldier_1) then {player sideChat \"We have won!\"} else {player sideChat \"Keep fighting!\"};"]}],"see_also":["allowFleeing"]}