---
name: "BIN_fnc_setTargetWeight"
type: function
status: ok
groups: ["Behavior"]
arma3_since: "1.94"
locality: {"argument": null, "effect": "local", "server_exec": false}
source: https://community.bistudio.com/wiki/BIN_fnc_setTargetWeight
revid: 379543
updated: 2026-10-31T13:38:55Z
---

# BIN_fnc_setTargetWeight

*Function · Behavior · Arma 3 v1.94*

Locality: effect **local**

## Description

Sets the target priority (weight) of a unit, vehicle, group or side for the weapons of the alien drone. The weight is stored in the object variable "#bTargetPrio" (default 1 when not set) and is later read by:

- [BIN_fnc_findTargetWeight](../functions/BIN_fnc_findTargetWeight.md), which picks the drone's target among nearby entities with [selectRandomWeighted](../commands/selectRandomWeighted.md); entities with weight 0 are excluded
- [BIN_fnc_missileSwarm](../functions/BIN_fnc_missileSwarm.md), which picks missile targets among [allUnits](../commands/allUnits.md) within 200 m; units with weight 0 or lower are excluded

The higher the weight, the more likely the target is to be selected. Objects initialised with [BIN_fnc_behaviorInit](../functions/BIN_fnc_behaviorInit.md) and the drone module ([BIN_fnc_initDroneModule](../functions/BIN_fnc_initDroneModule.md)) get weight 0.

Nothing in the Contact functions calls this function; it is meant to be used in mission scripts.

> [!IMPORTANT]
> - A vehicle passed as *target* gets the weight on the vehicle object only, not on its crew. [BIN_fnc_findTargetWeight](../functions/BIN_fnc_findTargetWeight.md) uses this value for the vehicle, but [BIN_fnc_missileSwarm](../functions/BIN_fnc_missileSwarm.md) reads the weight of the units.
> - For a unit that is inside a vehicle, the code runs `crew _x` where `_x` is not defined by the function, so the weight is not set on that unit.
> - A [Side](../topics/Side.md) only affects units that exist at the moment of the call.

> [!NOTE]
> This content is exclusive to the Arma 3 Contact Expansion.

## Syntax

```sqf
[target, weight] call BIN_fnc_setTargetWeight
```

**Parameters:**

- `target`: [Object](../topics/Object.md), [Group](../topics/Group.md) or [Side](../topics/Side.md) - (Optional, default [objNull](../commands/objNull.md))

  - [Object](../topics/Object.md) - a unit on foot or a vehicle; the weight is set on that object
  - [Group](../topics/Group.md) - the weight is set on every unit of the group
  - [Side](../topics/Side.md) - the weight is set on every unit of [allUnits](../commands/allUnits.md) that belongs to this side
- `weight`: [Number](../topics/Number.md) - (Optional, default 1) target weight; 0 excludes the target from selection

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
[west, 0] call BIN_fnc_setTargetWeight; // all current BLUFOR units are ignored by the drone's weapons
```

### Example 2

```sqf
[player, 10] call BIN_fnc_setTargetWeight; // the player is much more likely to be targeted
```

### Example 3

```sqf
[group player, 0] call BIN_fnc_setTargetWeight; // the player's group is ignored
```

## See also

[BIN_fnc_findTargetWeight](../functions/BIN_fnc_findTargetWeight.md) · [selectRandomWeighted](../commands/selectRandomWeighted.md)

<sub>Source: [BI Community Wiki — BIN fnc setTargetWeight](https://community.bistudio.com/wiki/BIN_fnc_setTargetWeight) (revision 379543).</sub>
