Skip to main content
Chimera includes a powerful Lua scripting system that allows you to extend and customize Halo PC behavior with scripts.

Overview

The Lua scripting feature provides:
  • Event-driven system - Hook into game events
  • Game state access - Read and modify game data
  • File I/O - Persistent data storage
  • Custom commands - Create new console commands
  • Map-specific scripts - Different behavior per map
  • Global scripts - Always-loaded functionality
Lua scripting is ported from Chimera -572 and provides a comprehensive API for game modification.

Script Locations

Chimera loads scripts from specific directories:

Script Types

Location: chimera/lua/scripts/global/Behavior:
  • Loaded on game startup
  • Remain loaded until game closes or manual reload
  • Survive map changes
  • Ideal for persistent features
Use cases:
  • Custom HUD overlays
  • Chat enhancements
  • Statistics tracking
  • Quality of life features

Directory Structure Setup

Chimera automatically creates the directory structure:
If you have scripts in the old directory structure, Chimera will automatically migrate them to the new scripts/ subdirectories.

Basic Script Structure

Hello World Example

Event Callbacks

Scripts can register callbacks for game events:

API Categories

The Lua API provides access to various game systems:

Game State

Player Data

Object Manipulation

Console Output

File I/O

Location: Scripts access files relative to chimera/lua/

Custom Commands

Advanced Examples

Kill Counter

Map-Specific Welcome Message

Auto-Reload Script

Script Management

Reloading Scripts

Reload all scripts without restarting the game:
This is useful during script development - make changes and reload without restarting Halo.

Listing Scripts

List all loaded scripts:

Unloading Scripts

Scripts are automatically unloaded:
  • When the game closes
  • When manually reloaded
  • Map scripts when changing maps

Security Considerations

Embedded Scripts

Embedded Lua scripts are disabled by default for security reasons.Only enable if you trust the map author:
Why disabled?:
  • Scripts can execute arbitrary code
  • Potential for malicious behavior
  • Can access file system
  • Can modify game state

Script Sandboxing

Chimera Lua scripts have access to:
  • ✅ Game data (read/write)
  • ✅ File I/O (within chimera/lua/ directory)
  • ✅ Console commands
  • ❌ System-level operations (blocked)
  • ❌ Network access (blocked)

Performance Considerations

Best practices for performant scripts:
  1. Avoid heavy operations in on_tick() - runs 30 times per second
  2. Cache frequently accessed data
  3. Use on_frame() only for rendering
  4. Minimize file I/O operations
  5. Unload scripts you’re not using

Callback Performance

Technical Implementation

Location: src/chimera/lua/

Initialization

Commands

Lua-related console commands

File System

Understanding file paths

Custom Commands

Creating custom commands

Hotkeys

Bind Lua scripts to keys

Example Scripts Collection

Common script patterns:

Getting Help

For Lua scripting support:
  • Check existing scripts in the community
  • Refer to the Chimera Lua API documentation
  • Ask on the Discord server
  • Review example scripts in the repository