Advanced Custom Overrides

Deep dive into the custom override system for advanced MZ customization.

Override System Architecture

RPGReact Plugin (RPGReact.js)

Loads overrides.manifest.json

Evaluates each override file in order

Promotes exported functions to global scope

Injects helpers (event, createEventData, etc.)

Overrides execute and modify RMMZ prototypes

Manifest Structure

File: js/plugins/rpgreact/overrides.manifest.json

{
  "entries": [
    { "file": "override_common.js", "export": "overrideCommon" },
    { "file": "override_game_actor.js", "export": "overrideGameActor" },
    { "file": "override_scene_battle.js", "export": "overrideSceneBattle" },
    { "file": "custom/my_override.js", "export": "myCustomOverride" }
  ]
}

Requirements:

  • entries array must be present and non-empty

  • Order matters - earlier overrides execute first

  • Each entry must have file and export properties

  • file path is relative to js/plugins/rpgreact/

  • export must match the function name exported by the file

Creating Custom Overrides

Step 1: Create Override File

Create js/plugins/rpgreact/custom/my_override.js:

Step 2: Add to Manifest

Edit js/plugins/rpgreact/overrides.manifest.json:

Step 3: Test

  1. Playtest in RPG Maker MZ (development mode)

  2. Check console for errors

  3. Verify override behavior

Injected Helpers

Each override function receives these parameters:

event(eventType, eventSpecifier, data, trace)

Emit events to React UI with automatic platform context.

Parameters:

  • eventType - Event category (from RPGEventType enum)

  • eventSpecifier - Event subcategory (string or enum value)

  • data - Custom payload object

  • trace - Debug identifier (appears in console)

createEventData()

Rebuilds complete event data from current game state.

createExtraData(field?)

Retrieves specific extra data fields.

reactBridge

Access to the React bridge instance.

decorateData(object)

Wrap MZ objects with MobX observables for reactivity.

Common Override Patterns

Adding Custom Menu Command

Custom Battle Action

Intercepting Input

Production Bundling

Development vs Production

Development (playtest):

  • Individual files loaded

  • Can see which override failed in console

  • Fast iteration

Production (packaged):

  • All overrides concatenated and minified

  • Single file: RPGReact.overrides.min.js

  • Original files removed

  • Faster load time

Build Process

  1. Script reads overrides.manifest.json

  2. Concatenates files in order

  3. Wraps each in IIFE

  4. Promotes exports to global scope

  5. Minifies with esbuild

  6. Removes individual source files

Troubleshooting Production

Override doesn't execute:

  • Check export name matches manifest exactly (case-sensitive)

  • Verify file exists at specified path

  • Look for minification errors in console

Syntax error in minified bundle:

  • Test each override individually in development

  • Check for invalid JavaScript syntax

  • Ensure all functions are properly closed

Best Practices

1. Namespace Custom Methods

2. Store Original Methods

3. Guard Event Emissions

4. Handle Errors Gracefully

5. Document Override Purpose

Advanced Techniques

Conditional Overrides

Cross-Override Communication

Dynamic Event Types

See Also

Last updated