Skip to main content
Billable Resource
Register a new NPC spawn event in your instance. NPCs are non-agent characters in your game that can be used for various purposes such as background characters, quest givers, or merchants. You can specify the spawn type (natural, breeding, or manual) and provide a unique UUID and name for the NPC. The NPC will be tracked in your instance and can be referenced in future interactions.
// Generate a new UUID for the NPC
UUID npcUuid = UUID.randomUUID();

// Set the NPC's name and spawn type
String name = "Village Guard";
SpawnType spawnType = SpawnType.MANUAL;

// Register the NPC spawn event
NPCSpawnEvent spawnEvent = PixocracySDK.NPCManager().registerSpawnEvent(instance, npcUuid, name, spawnType);

// Access the spawned NPC
NPC npc = spawnEvent.getNpc();