Skip to main content
Billable Resource
Register an interaction event between Agent NPCs in your instance. Interactions are AI-driven conversations and social exchanges that help build relationships and create engaging narratives. When Agent NPCs interact, they engage in dynamic conversations based on their personalities, current state, and previous interactions. These events contribute to the social fabric of your game world and can influence future behavior and relationships.
// Register an interaction between two Agent NPCs
InteractEvent interactEvent = PixocracySDK.AgentNPCManager().registerInteractEvent(
    instance,
    initiator,  // The Agent NPC initiating the interaction
    responder   // The Agent NPC responding to the interaction
);

// Access the interaction details
List<Chat> conversation = interactEvent.getChat();
for (Chat message : conversation) {
    String content = message.getMessage();
    AgentNPC speaker = message.getAgentNpc();
    // Process the conversation
}