Skip to content

sc_actors_v1.despawn

Removes an NPC you spawned with spawn_npc. SCO_OK starts the removal: the NPC leaves the world within a few seconds (one that hasn’t streamed in yet goes once it has), and the id is no longer yours. SCO_NOT_FOUND: not an NPC you spawned here, or despawned already.

sco_result (*)(sco_plugin *, uint64_t)

Service index

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

Header source

sco_result (*despawn)(sco_plugin* self, uint64_t entity_id);
Removes an NPC you spawned with spawn_npc. SCO_OK starts the removal: the NPC leaves the world within a few seconds (one that hasn’t streamed in yet goes once it has), and the id is no longer yours. SCO_NOT_FOUND: not an NPC you spawned here, or despawned already.

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
(*despawn)
cpp typed-wrapper include/scosdk/game/actors.hpp
sco_result Despawn(uint64_t id) const noexcept { return t_ && Covers(t_->size, offsetof(sc_actors_v1, despawn)) && t_->despawn ? t_->despawn(self_, id) : SCO_UNAVAILABLE; }
csharp typed-wrapper sdk/csharp/Sco.Sdk/Game/Actors.cs
public ScoResult Despawn(ulong id) => !Covers(24) || _t->despawn == null ? ScoResult.Unavailable : _t->despawn(Self, id);
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.

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