Skip to main content
Files in scripts/globals/ are loaded automatically at server start. They define shared constants, helper functions, and server-lifecycle hooks that all zone, quest, mob, and item scripts can use.
scripts/globals/server.lua defines the xi.server hooks called by the C++ core at key moments.
xi.server.setExplorerMoogles(moogleId) hides or shows explorer moogle NPCs based on the EXPLORER_MOOGLE_LV server setting.
scripts/globals/player.lua handles character creation (xi.player.charCreate) and the login event. It gives new characters their starting equipment, job gear, key items, and nation ring based on their chosen race, nation, and job.
npcUtil is a globally available table of utility functions for NPC scripts. Its functions handle the most common NPC tasks.Item giving
Key items and currency
Trade checking
Quest and mission completion
Mob spawning from question marks
Movement and animation
Crates
scripts/globals/shop.lua provides functions for sending shop menus to players.
xi.shop.generalGuildStock contains the pre-defined stock tables for all crafting guilds, keyed by xi.skill.*.
scripts/globals/treasure.lua manages the treasure chest and coffer system. It handles key type resolution, loot tables per zone, trap/mimic chances, and respawn timers. Zone-specific loot is defined inside the file indexed by xi.zone.*.
scripts/globals/mobs.lua provides the global mob death hook and the lottery/placeholder NM spawning system.
params for phOnDespawn supports: immediate, dayOnly, nightOnly, noPosUpdate, doNotEnablePhSpawn, and spawnPoints.
scripts/globals/magic.lua provides shared functions for cure calculations, hit-rate helpers, and final magic damage adjustments.

Other notable globals