How to add a custom class/data type to the database

Dear all,

I am doing a project which will need several different objects/classes to exist in the database.

How does one do so? I am aware that I'll need to manipulate them with scripts, and that they will not show in the database manager window.

What I need to know:

  1. Is it sufficient to just create a class in a script or do I have to do anything special for RPGMVXA to recognize my class as part of the project?
  2. What is the best way to convert from YAML to rvdata2 so I can make the DataManager load it?
  3. Do I need to do anything to make RPG maker load the data besides adding a line in DataManager's load_normal_database method?

Thank you very much!
1) Just create them in the script editor and you can use them

2) IDK

3 Depends on how you built the data. If ypu managed to do number 2, then loading it would be enough probably
I've moved this thread to RGSSx Script Support. Please be sure to post your threads in the correct forum next time. Thank you.


I don't know what YAML is. When I want to add my own data files, I have two scripts. One defines the layout and looks like the RPG::... classes you can find in the help file for each of the database tabs. The other is the script to build the data and create the .rvdata2 file. So you would make a script that reads the YAML data, converts it to your new class, adds it to an array, and after they're all added to the array, write it out to the .rvdata2 file.
YAML means Yet Another Markup Language, and it's description can be found on http://yaml.org

2) You do not need to convert YAML to .rvdata2 in order to make DataManager read it.

You can simply alias the DataManager.load_database and then add

$data_your_yaml_data = YourModuleForLoadingYamlData.load_yaml_data(yaml_filename)

or such.

OR

You can do Marshal.dump and Marshal.load

Marshal.dump can dump nearly EVERY object to a file (it can't dump File, MatchData, Sprite etc.)

Marshal.load can load those files.

For more details about Marshal, please refer to the RPGMVXA help

KockaAdmiralac

EDIT :

You can also see YAML readers on the YAML's official site. For Ruby I think there are RbYaml, psych and yaml4r

Original thread: https://forums.rpgmakerweb.com/threads/how-to-add-a-custom-class-data-type-to-the-database.42566/