GetNpcs

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 09:52, 15 August 2026 by QCherry (talk | contribs) (Complete Lua function catalog)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

getNpcs

Returns the identifiers of all active server-owned scripted NPCs.

Syntax

table getNpcs()

Parameters

This function does not accept parameters.

Returns

Returns a one-based array of numeric NPC identifiers.

Examples

Inspect every scripted NPC:

for _, npcId in ipairs(getNpcs()) do
    local npc = getNpcData(npcId)
    if npc then
        outputDebugString(npc.name .. " uses " .. npc.skin)
    end
end

Notes

  • Available only in server-side resource scripts.
  • NPC identifiers are allocated by the server and are distinct from connected player identifiers.