Spawn
int Spawn (str classname, fixed x, fixed y, fixed z [, int tid [, int angle]])
Usage
Spawns an actor at the given X, Y and Z coordinates. Optionally a TID and a byte angle can be specified.
The coordinates are specified in fixed point, which are not the same as grid units in your map editor. To convert a grid unit to a fixed point, you multiply the coordinate by 65536, or use fixed point literals.
The Z coordinate is also absolute, i.e. not relative to the floor height of the sector. So if you want something to spawn 128 units above a floor that is at a height of 64, then the Z coordinate needs to be 192.
Note that, unlike Thing_Spawn, Spawn does not create teleport fog. If you want teleport fog to appear, use the function again to spawn it manually.
To spawn something at the location of a MapSpot, use SpawnSpot instead.
To get a list of the things you can spawn in the game, visit the Classes page.
The return value is the number of things spawned.
Examples
This script spawns a Cacodemon above the player about three seconds after he enters the map. There is a 25% chance to instead spawn a Pain Elemental with a TID of 50.
#include "zcommon.acs" script 1 ENTER { Delay(100); switch(random(1,4)) { case 1: case 2: case 3: Spawn("Cacodemon",GetActorX(0),GetActorY(0),GetActorFloorZ(0) + 128); break; case 4: Spawn("PainElemental",GetActorX(0),GetActorY(0),GetActorFloorZ(0) + 128,50); break; } }
| ACS spawn functions | |
|---|---|
| Spawn | SpawnForced |
| SpawnSpot | SpawnSpotForced |
| SpawnSpotFacing | SpawnSpotFacingForced |
| SpawnProjectile | |