A_SpawnItemEx
From ZDoom Wiki
A_SpawnItemEx (string type, float xoffset, float yoffset, float zoffset, float xmomentum, float ymomentum, float zmomentum, float angle, int flags, int chance)
Spawns an item at the specified offset away from the calling actor, facing the given angle, and with the indicated momentum.
This function can be used with monsters, weapons and inventory items.
- type: The name of the actor to spawn.
- x/y/zoffset: The offset from the calling actor at which to spawn the new actor. If Absolute Position is set (see flags), this is in absolute map coordinates, otherwise it is based on the calling actor's facing.
- x/y/zmomentum: The initial momentum to give to the spawned actor, useful for projectiles. If Absolute Momentum is set (see flags), this is the exact momentum that will be given, otherwise the initial momentum is based on the calling actor's momentum.
- angle: The angle the new actor will face. If Absolute Angle is set, this exact angle will be used. Otherwise, this defines the offset from the calling actor's current angle to use.
- flags: The following flags can be used alone, combined as needed by adding the numbers together, or by listing their keywords (separated by the | character):
- 1 (SXF_TRANSFERTRANSLATION) - Transfer Translation: The spawned actor will use the same translation as the parent.
- 2 (SXF_ABSOLUTEPOSITION) - Absolute Position: Spawn the actor at an absolute position.
- 4 (SXF_ABSOLUTEANGLE) - Absolute Angle: Use angle as an absolute angle, and ignore the parent's angle.
- 8 (SXF_ABSOLUTEMOMENTUM) - Absolute Momentum: Use an absolute momentum.
- 16 (SXF_SETMASTER) - Set Master: This places the new actor in a master/minion relationship with the parent. Master/minions will not attack each other and this allows for the use of A_KillMaster and A_KillChildren.
- 32 (SXF_NOCHECKPOSITION) - No Check Position: Don't check the destination for room before spawning.
- 64 (SXF_TELEFRAG) - Telefrag: Kills any actor that would prevent the new actor from spawning.
- 128 (SXF_CLIENTSIDE) - Client-side spawning only.
(Skulltag only: not supported by ZDoom)
- 256 (SXF_TRANSFERAMBUSHFLAG) - Transfer Ambush Flag: If the spawning actor's Ambush flag is set, then the spawned actor's will be set as well. (development version only)
- chance: This is the chance (out of 255) that the actor has of not spawning. If this is 0 or omited, the actor will always spawn. If it is 255, it will never spawn.
Note: The ZDoom-based port Skulltag uses flag 128 for client-side spawning only, preventing the waste of bandwidth to synchronize purely decorative spawns.
Examples
| Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contibutions are greatly appreciated. |

