Skip to content

sc_actors_v1.spawn_npc

Spawns an NPC of archetype_class (an entity class name, as in sc-offline’s npcs.txt) at pos in zone zone_id’s local frame, facing the zone’s axes. *out_id = the new entity id, 0 on failure. The id is final at once; the NPC streams in a few seconds later. The NPC is yours (see Ownership above). SCO_BAD_ARG: a null or released self, a null class, pos or out_id, zone 0, or a position that isn’t finite. SCO_NOT_FOUND: the zone isn’t streamed in, or the class doesn’t exist on this game build. SCO_TOO_MANY: SC_ACTORS_MAX_NPCS are alive. SCO_FAILED: the game refused or faulted.

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

Service index

Property Value
Symbol sc_actors_v1.spawn_npc
Record ID sc-actors-v1-spawn-npc
Service game.actors
Table sc_actors_v1
Version macro SC_ACTORS_VERSION_1_1
Packed table version 65537
Since / availability size >= 24; 1.0
Complete member extent (x64 bytes) 24
Table size (x64 bytes) 56

Header source

sco_result (*spawn_npc)(sco_plugin* self, const char* archetype_class, uint64_t zone_id, const double pos[3], uint64_t* out_id);
Spawns an NPC of archetype_class (an entity class name, as in sc-offline’s npcs.txt) at pos in zone zone_id’s local frame, facing the zone’s axes. *out_id = the new entity id, 0 on failure. The id is final at once; the NPC streams in a few seconds later. The NPC is yours (see Ownership above). SCO_BAD_ARG: a null or released self, a null class, pos or out_id, zone 0, or a position that isn’t finite. SCO_NOT_FOUND: the zone isn’t streamed in, or the class doesn’t exist on this game build. SCO_TOO_MANY: SC_ACTORS_MAX_NPCS are alive. SCO_FAILED: the game refused or faulted.

Absent table: query_service NOT_FOUND; missing operation capability: UNAVAILABLE; invalid/released self: BAD_ARG. See method detail for game failures. 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 NPC tracking; entity IDs are session values. Internal allocation unspecified.

Game thread only (WRONG_THREAD elsewhere); last_error any thread. Recursive reentrancy unspecified.

unspecified

unspecified

No in-flight cancellation entrypoint; owned NPCs removed on ordinary unload/non-retained crash cleanup; despawn starts deferred removal. 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_actors.h
(*spawn_npc)
cpp typed-wrapper include/scosdk/game/actors.hpp
return t_ && Covers(t_->size, offsetof(sc_actors_v1, spawn_npc)) && t_->spawn_npc ? t_->spawn_npc(self_, archetypeClass, zoneId, pos, &id) : SCO_UNAVAILABLE;
csharp typed-wrapper sdk/csharp/Sco.Sdk/Game/Actors.cs
r = _t->spawn_npc(Self, c, zoneId, p, &n);
lua unsupported sdk/docs/lua.md
Lua gets the game services read-only: queries, never a function that changes the game, so a script owns no NPCs.

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

spawn NPC This is a search phrase for the existing contract, not an additional API alias.

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