Side Relations

From Bohemia Interactive Community
Revision as of 09:58, 7 September 2019 by R3vo (talk | contribs) (Removed side and faction description and linked to corresponding pages instead)
Jump to navigation Jump to search

Sides

See side command page and Side data type page for a detailed explaination.

Factions

See faction command page for a detailed explaination.

Change relations

1) You can set which sides Resistance is friendly to in the mission editor (click on the Intel box).

2) Everyone is friendly toward Civilians. This means an armed Civilian will be able to slaughter unfriendly AI troops with impunity.

3) You can use the setFriend command at the initialization of a mission to set relations. It is even possible to make OPFOR and BLUFOR troops friendly and greet one another.

EAST setFriend [WEST, 1]; WEST setFriend [EAST, 1];

Sides Friendship

The default way how engine determines friendliness. If setFriend command is used, the relationship tables could be different.

IsFriendly

Helper function: BIS_fnc_sideIsFriendly

Is Friendly To east west independent civilian sideUnknown sideEnemy sideFriendly sideLogic
east YES NO NO YES NO NO YES NO
west NO YES YES YES NO NO YES NO
independent NO YES YES YES NO NO YES NO
civilian NO YES YES YES NO NO YES NO
sideUnknown NO NO NO NO NO NO YES NO
sideEnemy NO NO NO NO NO NO YES NO
sideFriendly NO NO NO NO NO NO YES NO
sideLogic YES YES YES YES NO NO YES NO

IsEnemy

Helper function: BIS_fnc_sideIsEnemy

Is Enemy To east west independent civilian sideUnknown sideEnemy sideFriendly sideLogic
east NO YES YES NO NO YES NO NO
west YES NO NO NO NO YES NO NO
independent YES NO NO NO NO YES NO NO
civilian YES NO NO NO NO YES NO NO
sideUnknown YES YES YES YES NO YES NO NO
sideEnemy YES YES YES YES NO YES NO NO
sideFriendly YES YES YES YES NO YES NO NO
sideLogic NO NO NO NO NO YES NO NO

Arming Civilians

You can arm Civilians by inserting code like the following in their initialization field:

this addWeapon "Colt1911"; this addMagazine "7Rnd_45ACP_1911";

NOTE: By default no side will shoot units on the civilian side, even when fired upon by them (same as for captives).

One way hostility

1) Using the setCaptive command allows you to stop enemy units to fire on the target unit. soldier1 setCaptive true; // soldier1 unit can shoot at enemy, but enemy will not return fire

You can re-activate hostility by canceling captive status. soldier1 setCaptive false; // soldier1 will be shoot at again by enemy units

2) Armed civilians will automatically shoot at anybody who is not friendly to Resistance. Or alternatively, you can make Civilians hostile to other sides by using the setFriend command:

civilianUnit setFriend [west, 0]; // Will cause civilians to shoot at West, but not West and Civilians

Civilians will not be attacked back. No setCaptive command is needed.

Two way hostility to civilians

1) You can make other sides hostile to a civilian by making the civilian renegade, but this will mean other civilians too will attack the unit. Run this code on the unit: this addRating -10000; // Will cause sides to shoot civilian, but not civilian to shoot back

When the rating gets below -2000, the unit's side switches to "ENEMY" and the unit is attacked by everyone.

2) To enable hostility both ways - civilians shooting at a side and the side shooting back, you need to move the civilian unit to a hostile side.

Example:

To shoot at West, you can make Resistance unfriendly to West and group the civilian unit with Resistance, or you could group them to East side.

Set in the editor

  1. Group your civilians with an East officer of higher rank than the civilians.
  2. put: deleteVehicle this in the officer’s initialization field (this will cause the officer not to appear)
  3. an alternative is to set the probability of presence slider of the officer to Zero.
  4. When you start the mission, the officer won't be there as he is deleted, but the civvies think they are East, will take over command and follow all waypoints, and fire on anyone on the opposite side

Scripted approach

Causing a civilian unit to change sides during a mission by using the joinSilent command and joining them to a living officer (using an officer with deleteVehicle this in their init field will not work), will cause the civilian to attack the other side, but the other side will not attack the civilian.

The side command will return the correct side for units grouped with a side officer at the start of a mission, but not for units joined during a mission by means of the joinSilent command.

The trick to make it work is to do first: [_unit] joinSilent grpNull;

and as second step: [_unit] joinSilent _targetGroup;

The important part is not to join them into the target group directly. So for new units use:

_eastCenter = createCenter east;// if no other east unit exists in the mission _dummyGroupEast = createGroup east; _newUnit = _dummyGroupEast createUnit ["TK_Soldier_EP1",position player, [], 0, "FORM"]; [_newUnit] joinSilent _targetGroup;//_targetGroup could be 'group player' for example deleteGroup _dummyGroupEast;// if you no longer need the dummy group