Skip to content

Spawn Entity

Spawn Entity

Spawns an entity from the database at a specified position on the current map.

Properties

System

Name Explanation Type
Direction The cardinal direction the spawned entity should face. Variable or Value
Entity The entity definition from the database to spawn. Variable or Value
Persist Whether the spawned entity should be saved in persistence data so it survives scene transitions. Toggle
Result The variable to store the spawned entity's unique ID in. Variable or Value
Specify Direction Whether to set a specific facing direction for the spawned entity. Toggle
Store ID Whether to store the unique ID of the spawned entity in a variable. Toggle
X The X coordinate to spawn the entity at. Variable or Value
Y The Y coordinate to spawn the entity at. Variable or Value
Z The Z coordinate to spawn the entity at. Variable or Value

Examples

Spawn Entity Definition 1 at Position (10, 5, 0)

This spawns an entity from database definition 1 at coordinates (10, 5, 0) on the current map.

spawn_entity(1, 10, 5, 0);
{"Data":{"EntityDefinitionID":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"IsDirectionSpecified":false,"Direction":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Persist":false,"Result":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreID":false,"X":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"10","VariableIndex":0,"Metadata":null},"Y":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"5","VariableIndex":0,"Metadata":null},"Z":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Entity.EntitySpawnEntityCommand"}

Spawn Entity with Direction and Persistence

This spawns an entity from database definition 1 at coordinates (10, 5, 0), facing direction 2, and persists the entity across map reloads.

spawn_entity(1, 10, 5, 0, direction: 2, persist);
{"Data":{"EntityDefinitionID":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"1","VariableIndex":0,"Metadata":null},"IsDirectionSpecified":true,"Direction":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"2","VariableIndex":0,"Metadata":null},"Persist":true,"Result":{"IsGlobalVariable":true,"IsLocalVariable":false,"IsValue":false,"Value":"","VariableIndex":0,"Metadata":null},"StoreID":false,"X":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"10","VariableIndex":0,"Metadata":null},"Y":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"5","VariableIndex":0,"Metadata":null},"Z":{"IsGlobalVariable":false,"IsLocalVariable":false,"IsValue":true,"Value":"0","VariableIndex":0,"Metadata":null},"Metadata":null},"TypeName":"MAR.Game.RPGCore.Models.Scripts.Commands.Entity.EntitySpawnEntityCommand"}