SetNpcIdVisible: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Document Lua functions planned for G1R:MP update 0.1.2
 
Document Lua APIs available or improved from G1R:MP 0.1.2
 
Line 1: Line 1:
= setNpcIdVisible =
= setNpcIdVisible =
<div style="background:#0b0b0b; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#f1f1f1; padding:0.85rem 1rem; margin:0.75rem 0 1rem;">
<div style="background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;">
<div style="color:#ff5a5a; font-weight:bold; letter-spacing:0.04em;">COMING IN UPDATE 0.1.2</div>
<div style="color:#111111; font-weight:bold; letter-spacing:0.04em;">AVAILABLE FROM UPDATE 0.1.2</div>
<div style="color:#f1f1f1; margin-top:0.25rem;">This function is documented in advance and is not yet available in the current public release.</div>
<div style="color:#111111; margin-top:0.25rem;">This function is available in G1R:MP 0.1.2 and later. The contract below includes the compatibility guarantees introduced in that update.</div>
</div>
</div>



Latest revision as of 18:39, 3 September 2026

setNpcIdVisible

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

Shows or hides the numeric identifier in a resource-owned NPC's nameplate.

Syntax

bool setNpcIdVisible(int npcId, bool visible)

Parameters

Name Type Required Description
npcId int yes The server-assigned NPC identifier returned by spawnNpc or getNpcs.
visible bool yes True to show the numeric NPC ID or false to hide it.

Returns

Returns true when the visibility change is accepted and replicated; otherwise returns false.

Examples

Hide an NPC's technical identifier while keeping its display name:

if setNpcIdVisible(npcId, false) then
    outputDebugString("NPC ID hidden")
end

Notes

  • Available only in server-side resource scripts.
  • Only the resource that created the NPC may change this field.
  • The state is exposed as getNpcData(npcId).nameplateIdVisible and is replayed during relevance entry and late join.
  • When the value changes, the server emits onNpcIdVisibilityChange(npcId, previousVisible, visible, sourceResource). Repeating the current value remains a successful no-op and does not emit the event.
  • setNpcNameplateIdVisible is a compatibility alias for this function; use setNpcIdVisible in new resources.