Skip to content

sc_entities_v1.spawn

Spawns an entity of entity_class (a class name, as in sc-offline’s npcs.txt or spawn.entities) at pos, facing rot, in zone zone_id’s local frame: anywhere, not only near the player. *out_id = the new entity id, 0 on failure. The id is final at once; the entity streams in a few seconds later. It is yours (see Ownership above). SCO_BAD_ARG: a null or released self, a null class, pos, rot or out_id, zone 0, or a position that isn’t finite or a zero rotation. SCO_NOT_FOUND: the zone isn’t streamed in, or the class doesn’t exist on this game build. SCO_TOO_MANY: SC_ENTITIES_MAX_OWNED are alive. SCO_UNAVAILABLE: no “game.entities.spawn”, or the host couldn’t remove your entities when you unload. SCO_FAILED: the game refused or faulted.

sco_result (*)(sco_plugin *, const char *, uint64_t, const double *, const double *, uint64_t *)

Service index

Property Value
Symbol sc_entities_v1.spawn
Record ID sc-entities-v1-spawn
Service game.entities
Table sc_entities_v1
Version macro SC_ENTITIES_VERSION_1_1
Packed table version 65537
Since / availability size >= 48; 1.0
Complete member extent (x64 bytes) 48
Table size (x64 bytes) 96

Header source

sco_result (*spawn)(sco_plugin* self, const char* entity_class, uint64_t zone_id, const double pos[3], const double rot_xyzw[4], uint64_t* out_id);
Spawns an entity of entity_class (a class name, as in sc-offline’s npcs.txt or spawn.entities) at pos, facing rot, in zone zone_id’s local frame: anywhere, not only near the player. *out_id = the new entity id, 0 on failure. The id is final at once; the entity streams in a few seconds later. It is yours (see Ownership above). SCO_BAD_ARG: a null or released self, a null class, pos, rot or out_id, zone 0, or a position that isn’t finite or a zero rotation. SCO_NOT_FOUND: the zone isn’t streamed in, or the class doesn’t exist on this game build. SCO_TOO_MANY: SC_ENTITIES_MAX_OWNED are alive. SCO_UNAVAILABLE: no “game.entities.spawn”, or the host couldn’t remove your entities when you unload. SCO_FAILED: the game refused or faulted.

Absent table: query_service NOT_FOUND; missing operation capability: UNAVAILABLE (alive: 0); invalid/released self: BAD_ARG. Additional failures/output state unspecified unless described in the buffer contract.

Absent table: query_service NOT_FOUND

Caller buffers; no allocation crosses boundary. Host owns entity/watch tracking; IDs are session values. Internal allocation unspecified.

Game thread only (WRONG_THREAD elsewhere, alive returns 0); last_error any thread. Recursive reentrancy unspecified except unwatch in callback.

unspecified

unspecified

No in-flight cancellation entrypoint; owned entities removed and watches ended on ordinary unload/non-retained crash cleanup, except kept entities. Retained-provider faults skip owner resource-release hooks and require restart; backing resources remain retained, not safe for cached calls.

Status labels are copied verbatim from the catalogue: direct is native access; typed-wrapper is wrapper-backed; restricted is a subset/adaptation; unsupported means no supported route is established. No status implies universal safety.

Language Catalogue status Source evidence / wrapper tokens
c direct include/sc_entities.h
(*spawn)
cpp typed-wrapper include/scosdk/game/entities.hpp
return t_ && Covers(t_->size, offsetof(sc_entities_v1, spawn)) && t_->spawn ? t_->spawn(self_, entityClass, zoneId, pos, rot, &id) : SCO_UNAVAILABLE;
csharp typed-wrapper sdk/csharp/Sco.Sdk/Game/Entities.cs
r = _t->spawn(Self, c, zoneId, p, q, &n);
lua unsupported sdk/docs/lua.md
Read-only: a Lua plugin owns no entities, so there is no spawn, despawn, move or watch.
plugins/lua/sco_lua_game.c
{ “alive”, L_ent_alive }, { “class_of”, L_ent_class_of }, { “get_transform”, L_ent_get_transform },

None identified in the catalogue; this is not proof none can exist.

ABI pins prove layout, not semantic behavior or a live game session.