Sovrun Docs 2025
  • INTRO TO SOVRUN
    • Introduction to Sovrun
    • Autonomous Worlds
    • About Sovrun
      • Sovrun Genesis
      • Sovrun Labs
      • Sovrun Nexus
      • Case Study: Eve Frontier
      • Case Study: Plunder Quest
      • History of Sovrun (BreederDAO)
  • The SOVRN Token
    • About $SOVRN
    • Token Utility
    • $SOVRN Tokenomics
    • $SOVRN on EVM Chains
      • Ethereum
      • Hyperliquid
        • Network Info
          • Block Explorer
          • Acquiring test SOVRN
        • Sessionchains
      • Base
      • BREED to SOVRN Migration
  • Build with Sovrun
    • Chain Tactics
      • Who is Chain Tactics for?
      • Why Mod Chain Tactics?
      • Headless Client
      • Sovrun SDK
      • Game Phases
      • Game Mechanics
      • Game Architecture
      • Expanding Chain Tactics Across EVM-Compatible Chains
      • Chain Tactics Development Roadmap
      • Terminology
      • Getting Started Guides
        • Chain Tactics Local Development & Headless Client
        • Lightweight Unity Client
        • Chain Tactics Modding Tutorials
        • Troubleshooting Chain Tactics Local Development
    • ReadyGamer
      • Joint Venture
      • Services
      • Architecture
      • GAME Framework
      • ReadyGamer API
      • Integration Workflow
      • Roblox Integration
        • Roblox Demo Game - Carnival AI
        • AI Agent NPC's
        • Roblox AI Agent Module
          • Getting Started
          • Module Components
          • Creating a Smart NPC
          • Creating a Continuous Behaviour Script
  • More
    • Sovrun Website
Powered by GitBook
On this page
  1. Build with Sovrun
  2. ReadyGamer
  3. Roblox Integration
  4. Roblox AI Agent Module

Creating a Smart NPC

PreviousModule ComponentsNextCreating a Continuous Behaviour Script

Last updated 6 days ago

To create a smart NPC, use the AIAgentManager's CreateAgent method. This method initializes an AI agent and binds it to an NPC model, enabling it to act based on AI decisions.


Required Parameters

  • GetGameState(): A function that returns the current game state as a table when called. This is passed to the AI for contextual decision-making.

  • NPC Model: The NPC model instance in the game. It must contain a Humanoid, HumanoidRootPart, and a valid PrimaryPart.

  • PersonalityId: A string representing the selected personality profile for the AI agent (e.g., "clown", "fortune-teller", etc.).

  • ExecutableCommands: A table that lists the commands the agent is allowed to execute. Each command can optionally include context or conditions under which it should be used. This will be sent to the AI server so the AI can determine appropriate actions.

  • : An array of behavior modules to assign to the NPC. Each module defines recurring logic such as patrols, scanning, or idle checks.

  • Frequency: A number that determines how often the continuous behavior scripts should be executed.

Sample Usage:

local replicatedStorage = game:GetService("ReplicatedStorage") local aiAgentManager = require(replicatedStorage.AIAgentModule.AIAgentManager) local customBehaviorScript = require(replicatedStorage.CustomScript) local clownSmartNpc = aiAgentManager:CreateAgent( gameState, -- Function that returns the game state workspace.NPCs:WaitForChild("Clown"), -- NPC Model "clown", -- Personality ID { "MoveTo", "FollowTarget" }, -- Executable commands { customBehaviorScript }, -- Behavior scripts 100 -- Behavior execution frequency )

ContinuousBehaviorScripts[]