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 Continuous Behaviour Script

A ContinuousBehaviorScript is a module that defines recurring behavior logic for an AI agent. This logic is executed based on a specified frequency set when initializing the agent.

When the behavior runs, the aiAgent instance is passed as a parameter to allow access to its methods and data.


Requirements

The behavior module must implement the following structure:

local replicatedStorage = game:GetService("ReplicatedStorage") local aiCommandMap = require(replicatedStorage.AIAgentModule.AICommandMap)

local module = {}

-- Called before the behavior is run function module.InitializeBehavior() -- Perform any setup required before the behavior starts end

-- Called before each behavior execution cycle -- Return true to run the behavior, false to skip function module.BehaviorConditionsCheck(aiAgent: AIAgent): boolean -- Add logic to determine if behavior should run return true end

-- Called when conditions pass; executes behavior logic function module.RunContinuousBehavior(aiAgent: AIAgent) -- Add your custom behavior script here -- Sends current game state to the AI server -- Expects a response which may include a message or command local response, status = aiAgent.SendQueryToAgent({ aiAgent.GetGameState() }) if not response then return false end -- Executes command based on AI response if response.command then local commandResponse = aiCommandMap[response.command.functionName](response.command.parameters) end end return module

PreviousCreating a Smart NPC

Last updated 6 days ago