---
name: "BIS_fnc_stalk"
type: function
status: ok
groups: ["Object Manipulation", "Combat"]
arma3_since: "1.00"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_stalk
revid: 327438
updated: 2022-07-12T22:12:09Z
---

# BIS_fnc_stalk

*Function · Object Manipulation, Combat · Arma 3 v1.00*

Locality: executed with **spawn**

## Description

Continuously set WP of one group to a different group to hunt it. It does not change the group's behaviour.

Script terminates if one of the groups is eliminated or if the optional condition is activated.

## Syntax

```sqf
[stalker, stalked, refresh, radius, endCondition, endDestination] spawn BIS_fnc_stalk
```

**Parameters:**

- `stalker`: [Group](../topics/Group.md) - the group that will move towards the other
- `stalked`: [Group](../topics/Group.md) - the group that will be followed
- `refresh`: [Number](../topics/Number.md) - (Optional, default 10, minimum 5) time between waypoint updates
- `radius`: [Number](../topics/Number.md) - (Optional, default 0, minimum 0) waypoint "precision"
- `endCondition`: [Code](../topics/Code.md) - (Optional, default {[false](../commands/false.md)}) condition that if true stops *stalker* to follow *stalked*
- `endDestination`: [String](../topics/String.md) or [Position](../topics/Position.md) or [Object](../topics/Object.md) or [Number](../topics/Number.md) - (Optional, default 0) destination *stalker* will go after *endCondition* is met (or *stalked* is killed)
  - [String](../topics/String.md) - destination marker name
  - [Position](../topics/Position.md) - destination
  - [Object](../topics/Object.md) - destination
  - [Number](../topics/Number.md)
    - 0: return to original group waypoints
    - 1: search around their current stalking position, in a 50m radius
    - 2: return to the original position before stalking

**Returns:** [Boolean](../topics/Boolean.md) - [true](../commands/true.md) when done

## Examples

### Example 1

```sqf
private _stalking = [BIS_grpStalkers, BIS_grpPlayer] spawn BIS_fnc_stalk;
```

### Example 2

```sqf
private _stalking = [grp1, group player, nil, nil, { player distance BIS_Heli < 100 }, "BIS_mrkRetreatMarker"] spawn BIS_fnc_stalk;
```

### Example 3

```sqf
private _stalking = [BIS_grpStalkers, BIS_grpPlayer, 20, 10, { BIS_Return }, 1] spawn BIS_fnc_stalk;
```

### Example 4

```sqf
private _stalking = [BIS_grpStalkers, BIS_grpPlayer, 5, 0, { dayTime > 20 }, [3600,600,0]] spawn BIS_fnc_stalk;
```

## See also

[BIS_fnc_spawnGroup](../functions/BIS_fnc_spawnGroup.md)

<sub>Source: [BI Community Wiki — BIS fnc stalk](https://community.bistudio.com/wiki/BIS_fnc_stalk) (revision 327438).</sub>
