---
name: "BIS_fnc_respect"
type: function
status: ok
groups: ["Sides"]
arma3_since: "0.50"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_respect
revid: 379570
updated: 2026-10-31T13:59:21Z
---

# BIS_fnc_respect

*Function · Sides · Arma 3 v0.50 · introduced in Arma 2 v1.00*

## Description

RESpect - The Effective Calculation Process. Manages "respect" values: an [Array](../topics/Array.md) of [Numbers](../topics/Number.md) in range -1..1, one per [faction](../commands/faction.md) in the order returned by [BIS_fnc_getFactions](../functions/BIS_fnc_getFactions.md), stored in the public "respect" variable of a unit or of a town logic.
"ADD" and "KILLED" work with town logics as used by Ambient Civilians (the unit's "ALICE_twn" variable, the town's "neighbors" variable). No Arma 3 script calls this function.

An unknown mode shows an error with [hintC](../commands/hintC.md) and returns -1.

## Syntax

### Syntax 1

```sqf
["SET", unit] call BIS_fnc_respect
```

**Parameters:**

- `"SET"`: [String](../topics/String.md) - creates default respect values (**case-sensitive**)
- `unit`: [Object](../topics/Object.md) - (Optional) unit whose faction gets respect 1; the result is also stored in its "respect" variable

**Returns:** [Array](../topics/Array.md) of [Numbers](../topics/Number.md) - 0 for every faction, 1 for the faction of *unit*

### Syntax 2

```sqf
["ADD", unit, range] call BIS_fnc_respect
```

**Parameters:**

- `"ADD"`: [String](../topics/String.md) - gives a unit the respect values of its town (**case-sensitive**)
- `unit`: [Object](../topics/Object.md) - unit whose "ALICE_twn" variable holds its town logic
- `range`: [Number](../topics/Number.md) - each town value is changed by a random amount between -range/2 and +range/2

**Returns:** [Array](../topics/Array.md) of [Numbers](../topics/Number.md) - unit's new respect values

### Syntax 3

```sqf
["MODIFY", unit, faction, formula] call BIS_fnc_respect
```

**Parameters:**

- `"MODIFY"`: [String](../topics/String.md) - changes one respect value (**case-sensitive**)
- `unit`: [Object](../topics/Object.md) - unit or town logic whose respect is changed; if it has no respect yet, "SET" is applied first
- `faction`: [String](../topics/String.md), [Number](../topics/Number.md) or [Object](../topics/Object.md) - [faction](../commands/faction.md) class name, faction index, or any object to use *unit*'s own faction
- `formula`: [String](../topics/String.md) or [Number](../topics/Number.md) - code computing the new value, the current value being available as *_r* (e.g. "_r / 2"); a [Number](../topics/Number.md) sets the value directly

**Returns:** [Number](../topics/Number.md) - new respect value, clamped to -1..1. If *unit* has [Code](../topics/Code.md) in its "respect_handler" variable, it is [spawned](../commands/spawn.md) with [unit, factionIndex, oldValue, newValue].

### Syntax 4

```sqf
["KILLED", killer, town, changeNeighbors, coefficient] call BIS_fnc_respect
```

**Parameters:**

- `"KILLED"`: [String](../topics/String.md) - lowers a town's respect after a civilian was killed (**case-sensitive**)
- `killer`: [Object](../topics/Object.md) - the killer; for every faction, the town value is lowered by the killer's respect for that faction multiplied by *coefficient*
- `town`: [Object](../topics/Object.md) - town logic
- `changeNeighbors`: [Boolean](../topics/Boolean.md) - (Optional, default [false](../commands/false.md)) if [true](../commands/true.md) and the town has a "neighbors" variable, the killer's respect for its own faction is multiplied by 0.9 and every neighbouring town is processed with half the coefficient
- `coefficient`: [Number](../topics/Number.md) - (Optional, default `2 + random 4`) change coefficient

**Returns:** [Array](../topics/Array.md) of [Numbers](../topics/Number.md) - town's new respect values

## Examples

### Example 1

```sqf
["SET", player] call BIS_fnc_respect;                    // the player respects their own faction only
["MODIFY", player, "OPF_F", "_r - 0.5"] call BIS_fnc_respect;    // lowers the player's respect for CSAT by 0.5
["MODIFY", player, "IND_F", 0.25] call BIS_fnc_respect;        // sets the player's respect for AAF to 0.25
```

## See also

[BIS_fnc_getFactions](../functions/BIS_fnc_getFactions.md) · [addRating](../commands/addRating.md) · Ambient Civilians

<sub>Source: [BI Community Wiki — BIS fnc respect](https://community.bistudio.com/wiki/BIS_fnc_respect) (revision 379570).</sub>
