Custom Database

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Custom Database

Author: Tsukihime

Overview

This script provides a set of methods that allow you to add new objects to the database and update existing objects in database.

It abstracts all of the details for you and provides a set of simple-to-use methods for interacting with the database.

The script uses a custom database to record any changes to the database in your current game, and is stored with the savefile so that any changes in one game does not affect any other game.

The custom database only supports adding and updating at the moment.

Download

Get it at Hime Works

Usage

Creating objects

A set of "add" methods have been provided for you in the script.

Suppose you wanted to make a new weapon. It would look something like

# create your weaponw = RPG::Weapon.neww.wtype_id = 1 w.params = [999] * 8 # make it overpowered# now add it to the databaseid = CustomData.add_weapon(w)# you can do something with the IDThe general process is to create the RPG object, add it to the database, and then use that ID somewhere.

Updating objects

To update an object, you would call the appropriate `update` method provided by the script.

For example, if you wanted to update a skill's MP cost, you might do something like

Code:
# Updating skill 51s = $data_skills[51]# change its mp costs.mp_cost = 20# now update the databaseCustomData.update_skill(s)
 
Last edited by a moderator:

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You don't have to credit me for this :)
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I copied it over from the other forums didn't really check the post thoroughly lol
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Several updates have been made recently.

A set of API methods have been provided so that you don't need to know anything about how the script works. And it would be better to use them since I can change the internal workings at any time.

You can now add new objects to the database, as well as update existing objects in the database using the standnardized methods.

The methods of interest can be found in the script under the CustomData module

add_weapon(obj)update_weapon(obj)add_actor(obj)update_actor(obj)add_class(obj)update_class(obj)...Notice that all methods take an object, which is an appropriate RPG object. The only thing you need to interact with the custom database is a reference to the object you wish to add or update; this is because every object has an ID, and this ID is the one you use, the one every script uses, and the ones the custom database also uses.

All custom data is stored with the save file as usual, and is merged when you load the save file.

Custom data replaces any of the original game data.

If you have custom data files, you can easily extend this script as well to account for those.
 
Last edited by a moderator:

SweetMeltyLove

Veteran
Veteran
Joined
May 4, 2015
Messages
113
Reaction score
155
First Language
English
Primarily Uses
RMVXA
hmm I'm lost, where do I put the code to update the object? i.e. where do I put this
Code:
w = $data_weapons[4]
w.params[2] += 50
CustomData.update_weapon(w)
Edit:
I made a new script, made a "module CustomDatabase" and I'm putting the code in a "self.init" method in there, then calling "CustomDatabase" in SceneManager's "self.run", after it loads the database. Seems to work ;)
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.
Do you Find Tilesetting or Looking for Tilesets/Plugins more fun? Personally I like making my tileset for my Game (Cretaceous Park TM) xD

Forum statistics

Threads
105,868
Messages
1,017,072
Members
137,578
Latest member
JamesLightning
Top