Creating your mod: Scripting
Last updated
Last updated
Depending on what your mod aims to do, scripting will likely be required. You can see the entirety of the Bonds's codebase in the js/plugins/
folder. You will need to look at the base game's files to understand how to modify content.
Note: The following are details about the frameworks involved in the game, it is not very meaningful for people with little JavaScript experience
Bonds 2.0.0 was made with RPG Maker MZ. However, RPG Maker MZ is barely used by the game, and what matters are the frameworks RPG Maker MZ comes with.
RPG Maker MZ uses to make games run, is a framework built on top of Chromium that bundles into its fork of Chromium. It is a framework for building apps with web technologies, similar to the more well-known Electron framework (which powers Discord, amongst many other apps)
RPG Maker MZ also uses the framework for graphics rendering. Bonds tend to ignore RPG Maker's layer and interact directly with Pixi.
Making the game load your mod's scripts is straightforward: Simply put your .js
files in under a js
folder at the root of your mod. They will then be loaded after the base game's scripts (and after mods above yours in the load order).
If you need your scripts to be loaded in a specific order, use your mod descriptor's scriptsLoadOrder
property (see Creating your mod 1): The mod descriptor)
To modify Bonds's code, your mod needs to override it. You can see a live example with the example mod:
Here, the example mod does the following:
[line 1-14] It declares an ExampleModCore
static class to serve as namespaced global variable storage for the mod and to give utility functions to the mod
mod()
is such an utility function, it is a shortcut function that calls Bonds's BondsModManager
class in order to get the example mod's descriptor
[line 16] It initializes the ExampleModCore
class
[line 18-20] It overrides Bonds's BondsVersioning#version()
function by:
[line 18] Storing the original function within ExampleModCore#_overrides
's object variable.
[line 19-20] Replacing BondsVersioning#version()
with a new function that calls the original function in order to return the text returned by the original + the mod's version after it
On lines 19-20, you may notice the usage of ...args
, this is a , a potent JavaScript tool that we use here to transmit all arguments passed to our new function to the original function without having to know what they are.