SetNpcDimension

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 21:03, 11 October 2026 by QCherry (talk | contribs) (Release 0.1.8 / BUILD210 / Protocol 40: dimensions API availability, loading and UI fixes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

setNpcDimension

AVAILABLE FROM UPDATE 0.1.8
This function is available in G1R:MP 0.1.8 and later. The contract below includes the compatibility guarantees introduced in that update.

Changes the server-authoritative dimension of a human NPC.

Syntax

ok = setNpcDimension(npcId, dimension)

Parameters

Name Type Required Description
npcId number yes Numeric NPC ID returned by spawnNpc; not a player ID.
dimension number yes Integer 0..2147483647. Strings, negative/fractional/non-finite values are rejected.

Returns

true when accepted (also for an unchanged dimension); false when invalid, unavailable, busy or not permitted.

Examples

local ok = setNpcDimension(npcId, 100)
if not ok then
    outputDebugString("Dimension change rejected")
end

Notes

  • Available since 0.1.8 / Protocol 40. Both client and server must update together.
  • Server-side only. See Character dimensions for the complete scope, transition rules and character-creator example.
  • Dimension 0 is the default; the ordinary streaming distance still applies. World objects, doors, gates and items remain shared.
  • Use these exact lower-camel names; there is no client-side setter.
  • An unchanged dimension returns true without emitting a change event or rebuilding characters.
  • Server acceptance is not a client rendering acknowledgement. Re-entry/late join uses the existing complete character appearance/state replay.
  • Only the calling resource's own actors may be changed. Getters do not grant ownership.
  • Clears the previous combat target/attack while preserving stats, appearance, equipment and authored route/movement configuration.
  • For a new actor, pass options.dimension to spawnNpc to avoid a temporary dimension-0 spawn.