Custom Database

The “Custom Database” is an extended database that is stored with your save file. It stores any additional objects created during the game, and any changes to the “Game Database” which contains the default data when a game is initialized.

The purpose of this custom database is to provide a way to modify the database on the fly without affecting any other instance of the game as the data files are supposed to be read-only.

This script handles all save/load issues that you might encounter with custom data, so any changes you make to the database persist across the same save file, but do not affect other games.


Script: download here


The database files are, by default, stored in the Data folder in your project. In the scripts, they are global variables prefixed with the word “data_”, such as “$data_actors” or “$data_skills”. Most of them with the exception of System and MapInfos are arrays, indexed by object ID.

Each array can be treated as a table, such as the Actors table or the Weapons table.
This script builds on the default design and supports the following operations

  • Read – get objects from the database
  • Create – add new objects to the database
  • Update – update existing objects in the database

Deleting objects is not supported.


You will be working with the CustomData module provided in the script most of the time. You are encouraged to use the methods provided in case the internal workings of the script change.

The database holds RPG objects, not Game objects. If you are unsure what attributes are available, you can refer to them in the Help Manual.

Reading objects

Nothing new is provided here. Simply access the data arrays as usual. The important thing to note here is that you should only access the database through the data files.

$data_actors[1]   # get actor 1
$data_skills[32]  # get skill 32
$data_weapons[94] # get weapon 94

Creating objects

You can create new RPG objects and add them to the database. The CustomData module provides a set of “add” methods for each table. Each “add” method takes your object and assigns an ID to it, returning the ID to you. It is up to you what to do with the ID.

The process for creating a new object is as follows:

  1. Instantiate a new RPG object
  2. Set the attributes
  3. Add it to the database

Example: create a weapon called “Moon Blade” with wtype_id 1, icon 147, and +20 atk bonus. Add it to the database, and then add one to your party.

w = = "Moon Blade"
w.icon_index = 147
w.wtype_id = 1
w.params = [0, 0, 20, 0, 0, 0, 0, 0]

id = CustomData.add_weapon(w)
$game_party.gain_item($data_weapons[id], 1)

If successful, you should see the new weapon in your inventory when the script is called.

Updating objects

You can update existing RPG objects in the database. The CustomData module provides a set of “update” methods for each table. Each “update” method takes your object and updates the appropriate record in the database using the object ID as the key.

The process for updating an object is as follows:

  • Get a reference to your object
  • Make changes to your object as needed
  • Tell the database to update it

Example: Given that the “Moon Blade” from above was assigned ID 61, we would like to upgrade it by changing its name to “Moon Blade +1”, increase its atk power by 50, and giving it a new icon 389.

w = $data_weapons[61] = "Moon Blade +1"
w.params[2] += 50
w.icon_index = 389

If successful, the moon blade from before should now have the updated data

The Custom Database provides support for the following objects

  • Actors
  • Classes
  • Skills
  • Items
  • Weapons
  • Armors
  • Enemies
  • States
  • Troops

You may also like...

21 Responses

  1. David says:

    About Monster Hunter Script, how can I call rename screen or other cmands that require an acotr of database with one of the monsters captures? Sorry if here’s not the correct place to comment this. :/

    • Hime says:

      I am not sure what you mean. Can you clarify what you want to do?

      • David says:

        I need to rename a captured monster. How can I call the rename scene for it if it’s not in the default database? And I have a second question, can I put an existent class to the monster captured?

        • Hime says:

          The monster hunter script basically doesn’t support those things. It was mostly a test script to show that it can be done.

      • David says:

        Actually, I am making a game that will use this. I need that the captured enemies come to the party with the same level of the enemy (using your script Enemy Levels) and with his class (again with your script, Enemy Class). I can’t make progress with the project withought that things.

  2. Nadim Mouawad says:

    I get this line 130 NameError occurred
    undefined method load_database for class Module

  3. Jason says:

    ** Actor Creation System
    Author: Tsukihime
    Date: Apr 25, 2013
    I don’t see this listed here on your site are you still developing this? There’s a couple things not working with it. It doesn’t bring up the name generator for the new character and the script to add in the bonus points doesn’t seem to do anything. Though it’s quite possible I am just using it wrong. Sorry to post about it here.

    • Tsukihime says:

      Consider posting it on the forums. Scripts that currently do not have blog posts are not officially supported since I haven’t gone through and validated them.

  4. I am having multiple issues with this script one of them is when ever I add an actor in the moster hunter script I get the error undefined method << for hash. Also is that when I try to load a save file I can't load it.

    • Tsukihime says:

      Monster Hunter is a broken script it has not been updated to the latest API for Custom Database. For loading, what kind of things have you saved to the save file?

      • Just a custom actor. It seems to be just the the loading of the custom database that does it. My custom database in Basic Module prevents loading, too. It somehow fails to read the file during the custom load.

        • Tsukihime says:

          I have done some simple tests (creating actor, adding to custom DB, adding new actor to party, saving/loading), and they seem to work fine. Remove the “rescue” statement in the load methods to see what’s going on.

  5. Hey there Hime, Just wanted to know if this could be used to add new content to a game like DLC in many other game’s from game companies? If it could then I could deffinately use this =) probably best to be use for a blacksmith event ect. though which I would also have use for to be honest =)

    • xtsukihime says:

      I have been thinking about how to implement DLC’s using this, because this allows you to combine data at run-time, but there is one problem: how would you manage this content in the editor? It would not be possible to simply assign “Custom Sword 1” to ID 200 and expect it to be the same on everyone’s games because they may have additional custom data. I will think about a solution that will make it possible to manage DLC’s

Leave a Reply

Your email address will not be published. Required fields are marked *