---
name: "BIS_fnc_animalSiteSpawn"
type: function
status: ok
groups: ["Ambient"]
arma3_since: "1.00"
locality: {"argument": null, "effect": null, "server_exec": true}
source: https://community.bistudio.com/wiki/BIS_fnc_animalSiteSpawn
revid: 364276
updated: 2024-05-06T09:38:32Z
---

# BIS_fnc_animalSiteSpawn

*Function · Ambient · Arma 3 v1.00*

Locality: **server execution only**

## Description

Create an area that spawns animals. The animals will be created or deleted if a player is inside or outside the area's radius.

## Syntax

```sqf
[animalSite, classnamesToSpawn, radius] call BIS_fnc_animalSiteSpawn
```

**Parameters:**

- `animalSite`: [Object](../topics/Object.md) - the object to create the site around.
- `classnamesToSpawn`: [Array](../topics/Array.md) of [String](../topics/String.md)s - animals that can be spawned.
- `radius`: [Number](../topics/Number.md) - the radius by which animals are created or deleted.

**Returns:** [Script Handle](../topics/Script_Handle.md)

## Examples

### Example 1

```sqf
[player, ["rabbit_f", "turtle_f", "hen_random_f"], 200] call BIS_fnc_animalSiteSpawn;
```

## See also

Arma 3: CfgVehicles Animals

## Community notes

**DreadedEntity** — 2014-12-07

The only way to stop the animals from spawning is to delete the object. When using this function, I recommend creating a non-solid object (almost anything from the "Objects (Helpers)" list in the editor, and using [hideObjectGlobal](../commands/hideObjectGlobal.md) on it. Using [setVariable](../commands/setVariable.md) you can add the animal site to a reference object to find it easily when you want to delete it.

```sqf
private _obj = createVehicle ["Sign_Sphere10cm_F", getPos player, [], 0, "CAN_COLLIDE"];
hideObjectGlobal _obj;
player setVariable ["animalSite", _obj];
_obj = nil;
```

There are two hidden variables, "animalCount" and "radius". Use [setVariable](../commands/setVariable.md) on the object to change these.

animalCount is supposed to limit the amount of animals that can spawn. In the code, the algorithm for this is hard to understand.

radius refers to how far away from the object the animals can spawn.

Both are numbers.

The "area" is imaginary. It is not a tangible area defined by trigger or marker radius, the area is only saved as an integer within the function.

---

**Strangepete** — 2014-12-07

Using the [Script Handle](../topics/Script_Handle.md) returned, the function can be checked using [scriptDone](../commands/scriptDone.md) or killed with [terminate](../commands/terminate.md); Existing generated animals will *not* be cleaned up when terminated.

```sqf
_handle = [params] call BIS_fnc_animalSiteSpawn;

if !(scriptDone _handle) then {
    terminate _handle;
};
```

<sub>Source: [BI Community Wiki — BIS fnc animalSiteSpawn](https://community.bistudio.com/wiki/BIS_fnc_animalSiteSpawn) (revision 364276).</sub>
