Custom Overrides
Custom Overrides
RPGReact supports project‑specific override files so you can hook into RPG Maker MZ scenes and emit events to the React app without modifying core plugin code.
What are overrides?
JavaScript files that patch/extend MZ classes (e.g., scenes, windows) and use the same internal facilities as the built‑in overrides.
They have access to the
event(eventType, eventSpecifier, data?, trace?)helper used throughout the stock overrides to send messages to the React app. This helper is injected into overrides and automatically decoratesdatawith platform/app context so your React handlers receive game state along with your payload.
Single source of truth: overrides manifest
Path:
js/plugins/rpgreact/overrides.manifest.jsonPurpose: Defines the ordered list of override files and the exported function name each file provides. Both development and production use this manifest; there is no auto‑discovery.
Schema:
{
"entries": [
{ "file": "override_scene_map.js", "export": "overrideSceneMap" },
{ "file": "custom/override_myfeature.js", "export": "overrideMyFeature" }
]
}Rules:
fileis relative tojs/plugins/rpgreact/(custom files go undercustom/).exportis the exact function name defined by that file. Order in the array is execution order.
Where to place files
STOCK overrides live under
js/plugins/rpgreact/and are provided by the plugin.CUSTOM overrides live under
js/plugins/rpgreact/custom/.To include any file in dev/prod, add an entry to
overrides.manifest.json.
Execution order
Exactly the order listed in
overrides.manifest.json.If one override depends on another, list the dependency first.
Authoring an override
Each file should define a function whose name matches the
exportin the manifest. The build/dev loader prepares the code so symbols align and then invokes your function.
Examples that mirror real events emitted by stock overrides
Example: overlay the Message window when a message/choice appears (like stock overrides)
Guidelines
Keep overrides small and focused; avoid deep engine rewrites when a simple event will do.
Prefer emitting the same semantic events the stock overrides use (
SCREEN_OPEN,OVERLAY_WINDOW,SHOW_TOAST,WINDOW_EVENT,BATTLE_EVENT).Use the optional
traceparameter to make debugging easier (debug.log/DevTools).Namespacing: prefix your file names/functions to avoid collisions with stock overrides.
Place custom files under
js/plugins/rpgreact/custom/and add them tooverrides.manifest.json.See the Event Reference for a list of existing event types/specifiers and example payloads.
Dev vs. Prod behavior (how overrides run)
Development (test mode): the plugin reads
overrides.manifest.json, prepares each file by wrapping and promoting yourexportfunction, then immediately invokes each override with standard args:(event, createEventData, createExtraData, reactBridge, decorateData).Production (packaging): the build script reads the same manifest, concatenates/wraps each file, minifies with esbuild to
js/plugins/rpgreact/RPGReact.overrides.min.js, and removes unminified sources from the package. At runtime the overrides are invoked in manifest order with the same args. The manifest remains in the output and is required for invocation order.Fail‑fast: missing manifest entries/files or minification errors stop the build with clear messages.
Troubleshooting
If your override doesn’t seem to run, open DevTools (desktop: enable
chromium-argslogging) and look for syntax errors.Verify the file is listed correctly in
js/plugins/rpgreact/overrides.manifest.jsonwith the rightexportname.In production, confirm
RPGReact.overrides.min.jsandoverrides.manifest.jsonexist underjs/plugins/rpgreact/, and that your file wasn’t removed due to a build error.Build failures will mention the exact missing file or esbuild error; fix and re‑run the packager.
Last updated