Description
Handles friendly fire. This is the function of the Friendly Fire module (ModuleFriendlyFire_F): when the module is placed in the editor, it is called with the module logic and the units synchronised to the module are checked. It can also be called by scripts with one of the modes below. "Init" creates the global logic BIS_FriendlyFire and checks once per second whether the player committed friendly fire, which happens when:
- the player becomes a renegade (side sideEnemy),
- the player (or the player's vehicle or connected UAV) kills one of the checked men,
- the player hits one of the checked vehicles whose priority is above 0, or hits it so that it can no longer move (canMove).
The mission then ends for everyone with the failed ending "FriendlyFire" (see BIS_fnc_endMission). Every mode except "Init" returns false while the module is not initialised.
Syntax
Syntax 1
["Init", [units, activated]] call BIS_fnc_moduleFriendlyFire
Parameters:
"Init": String - initialises the moduleunits: Array of Objects - (Optional, default[]) units and vehicles to check; the crew of a given vehicle is checked as wellactivated: Boolean - (Optional, default true) not used
Returns: Boolean - false if the module was already initialised, otherwise true
Syntax 2
["Destroy"] call BIS_fnc_moduleFriendlyFire
Parameters:
"Destroy": String - deletes the module logic
Syntax 3
["AddUnits", [units]] call BIS_fnc_moduleFriendlyFire
Parameters:
"AddUnits": String - adds units to the checked unitsunits: Array of Objects - units and vehicles to add (vehicle crews are not added)
Syntax 4
["RemoveUnits", [units]] call BIS_fnc_moduleFriendlyFire
Parameters:
"RemoveUnits": String - removes units from the checked unitsunits: Array of Objects - units to remove
Syntax 5
["ChangePriority", [vehicle, priority]] call BIS_fnc_moduleFriendlyFire
Parameters:
"ChangePriority": String - changes the priority of a checked vehiclevehicle: Object - checked vehiclepriority: Number - (Optional, default 0) if above 0, a single hit by the player counts as friendly fire
Examples
Example 1
["Init", [[BIS_vip1, BIS_vip2, BIS_vipCar]]] call BIS_fnc_moduleFriendlyFire; // BIS_vip1, BIS_vip2, BIS_vipCar and its crew are checked
["AddUnits", [[BIS_vip3]]] call BIS_fnc_moduleFriendlyFire; // BIS_vip3 is checked too
["ChangePriority", [BIS_vipCar, 1]] call BIS_fnc_moduleFriendlyFire; // one hit on BIS_vipCar is friendly fire
["RemoveUnits", [[BIS_vip1]]] call BIS_fnc_moduleFriendlyFire; // BIS_vip1 is no longer checked
Example 2
["Init", []] call BIS_fnc_moduleFriendlyFire; // only the renegade state is checked