To replace an existing entity use
spawn npc <script> <target>
|Script path (without file extension) of the entity to add, relative to
|Existing entity from which to copy the position and rotation for the new entity
The entity class script is loaded from
The initial mesh of the entity will be
graph/obj3d/interactive/npc/<script>.teo with the cooked mesh loaded from
game/graph/obj3d/interactive/npc/<script>.ftl. Either the raw mesh, cooked mesh or entity class script file must exist or the entity will not be created and the old entity will not be destroyed.
The ID of the created entity can be retrieved via the
^last_spawned system variable. It will be made up of the filename component of the script path (the entity class) followed by
_ and a previously unused four-digit instance number - meaning one that does not have an instance directory in the game resources under the script path and does not have an existing entity in the current area or save file.
This also means that it is not possible to create entities with instance scripts using this command (or any other script command).
If the created entity is destroyed before this command returns (because the init events destroyed it) then then
^last_spawned will be
none. If the init events spawn additional items then
^last_spawned will contain the ID of the last spawned item.