Skip to main content
Billable Resource
Register a new Agent NPC spawn event in your instance. Agent NPCs are AI-powered characters that can interact with each other and with the game world, creating dynamic and emergent gameplay experiences. You can specify the spawn type (natural, breeding, or manual) and provide parent identifiers for breeding events. Each Agent NPC is assigned to an AI agent that determines their behavior and personality.
// Generate a new UUID for the Agent NPC
UUID agentNpcUuid = UUID.randomUUID();

// Set the spawn type (NATURAL, BREEDING, or MANUAL)
SpawnType spawnType = SpawnType.NATURAL;

// Register the Agent NPC spawn event
AgentNPCSpawnEvent spawnEvent = PixocracySDK.AgentNPCManager().registerSpawnEvent(
    instance,
    agentNpcUuid,
    spawnType
);

// Access the spawned Agent NPC
AgentNPC agentNpc = spawnEvent.getAgentNpc();