GetNpcDimension

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

getNpcDimension

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.

Reads the server-authoritative dimension of a human NPC.

Syntax

dimension = getNpcDimension(npcId)

Parameters

Name Type Required Description
npcId number yes Numeric NPC ID returned by spawnNpc; not a player ID.

Returns

The integer dimension, including 0, or false for an invalid/missing entity.

Examples

local dimension = getNpcDimension(npcId)
if dimension ~= false then
    outputDebugString("Dimension: " .. dimension)
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.
  • Getters do not grant mutation permission or change visibility. A valid dimension can be 0; test explicitly against false for missing entities.