# staggeredAISpawn

<p class="callout info">An eventCall to spawn multiple idAI2 entities, with a delay between each spawn, in an idEncounterManager.</p>

## Usage

```
item[0] = {
    eventCall = {
        eventDef = "staggeredAISpawn";
        args = {
            num = 6;
            item[0] = {
                eEncounterSpawnType_t = ""; // spawnType
            }
            item[1] = {
                int = 5; // spawn_count
            }
            item[2] = {
                entity = ""; // spawnGroup
            }
            item[3] = {
                string = ""; // group_label
            }
            item[4] = {
                float = 1; // minSpawnStagger
            }
            item[5] = {
                float = 5; // maxSpawnStagger
            }
        }
    }
}
```

- `spawnType` is the ai type that you want to be spawned. Multiple types can be listed, and the spawned ai types will be randomly chosen from this list.
- `spawnCount` is the number of ai you want to be spawned. To avoid overlapping spawns, spawnCount should be &lt;= the number of [`idTarget_Spawns`](https://wiki.eternalmods.com/books/entities-custom-encounters/page/idtarget-spawn "idTarget_Spawn") listed under your `idTargetSpawnGroup`.
- `spawnGroup` is the `idTargetSpawnGroup` you want to use.
- `group_label` is what label you want to give to the ai spawned by this eventCall. This parameter is optional, and can be left blank.
- `minSpawnStagger` is the minimum delay between each spawn, in seconds. This value also affects how soon the first spawn in this eventCall occurs.
- `maxSpawnStagger` is the maximum delay between spawns, in seconds.

<p class="callout warning">`minSpawnStagger` must be &lt;= `maxSpawnStagger`</p>

## Example Usage

```
item[0] = {
    eventCall = {
        eventDef = "staggeredAISpawn";
        args = {
            num = 6;
            item[0] = {
                eEncounterSpawnType_t = "ENCOUNTER_SPAWN_ZOMBIE_TIER_1"; // spawnType
            }
            item[1] = {
                int = 5; // spawn_count
            }
            item[2] = {
                entity = "game_target_spawn_group_13"; // spawnGroup
            }
            item[3] = {
                string = ""; // group_label
            }
            item[4] = {
                float = 7.5; // minSpawnStagger
            }
            item[5] = {
                float = 10; // maxSpawnStagger
            }
        }
    }
}
```

In this example, 5 Zombies will be spawned, with a 7.5 - 10s delay between each one.

### See Also

- [waitStaggeredSpawnComplete](https://wiki.eternalmods.com/books/creating-custom-encounters/page/waitstaggeredspawncomplete)