# spawnSpirit

<p class="callout info">An eventCall to spawn a spirit in an idEncounterManager.</p>

## Usage

```
item[0] = {
	eventCall = {
		eventDef = "spawnSpirit";
		args = {
			num = 4;
			item[0] = {
				entity = ""; // spawnTarget
			}
			item[1] = {
				eEncounterSpawnType_t = ""; // allowedAITypes
			}
			item[2] = {
				string = ""; // allowed_group_label
			}
			item[3] = {
				bool = true; // aiTypeExplicitFiltering
			}
		}
	}
}
```

- `spawnTarget` is the spawn target that the spirit is to be spawned with.
- `allowedAITypes` are the [`eEncounterSpawnType_t`](https://wiki.eternalmods.com/books/entities-custom-encounters/page/eencounterspawntype-t "eEncounterSpawnType_t") that the spirit is allowed to possess.
- `allowed_group_label` is the label that the spirit is allowed to possess.
- `aiTypeExplicitFiltering` is whether the spirit will only possess the exact specified ai types/group label.

## Example Usage

```
item[0] = {
	eventCall = {
		eventDef = "spawnSingleAI";
		args = {
			num = 3;
			item[0] = {
				eEncounterSpawnType_t = "ENCOUNTER_SPAWN_ARACHNOTRON";
			}
			item[1] = {
				entity = "ai_target_spawn_17";
			}
			item[2] = {
				string = "spider";
			}
		}
	}
}
item[1] = {
	eventCall = {
		eventDef = "spawnSingleAI";
		args = {
			num = 3;
			item[0] = {
				eEncounterSpawnType_t = "ENCOUNTER_SPAWN_ARACHNOTRON";
			}
			item[1] = {
				entity = "ai_target_spawn_21";
			}
			item[2] = {
				string = "possess me";
			}
		}
	}
}
item[2] = {
	eventCall = {
		eventDef = "spawnSpirit";
		args = {
			num = 4;
			item[0] = {
				entity = "ai_target_spawn_26"; // spawnTarget
			}
			item[1] = {
				eEncounterSpawnType_t = "ENCOUNTER_SPAWN_ARACHNOTRON"; // allowedAITypes
			}
			item[2] = {
				string = "possess me"; // allowed_group_label
			}
			item[3] = {
				bool = true; // aiTypeExplicitFiltering
			}
		}
	}
}
```

In this example, two Arachnotrons are spawned, one with a `spider` label, and the other with the `possess me` label. `spawnSpirit` is then used for `ENCOUNTER_SPAWN_ARACHNOTRON` with the possess me label, that way only the latter Arachnotron will be possessed.

## See Also

- [spawnPossessedAI](https://wiki.eternalmods.com/books/entities-custom-encounters/page/spawnpossessedai)