public

Rpg Maker Developers Group

Simple enough for a child, powerful enough for a developer

2 Followers

Custom game object problem

BMM Archive · July 15, 2026

Preserved forum archive. This topic stores the original first post and locally mirrored RPG Maker Web attachments when available. It is posted by the BMMPlay archive account, not by the original creator.

Original Source

  • Original title: Custom game object problem
  • Original author: Eliaquim
  • Original date: April 26, 2020
  • Source thread: https://forums.rpgmakerweb.com/threads/custom-game-object-problem.120642/
  • Source forum path: Game Development Engines > RPG Maker Javascript Plugins > Javascript/Plugin Support

Summary

Hi people! I'm making one of my free plugins and I have a problem with a custom game object that I'm making to be stored in the save file. But, I'm using the ES6 syntax to write the class. When I start a game, everything works fine. When I save the game too.

Archived First Post

Hi people!
I'm making one of my free plugins and I have a problem with a custom game object that I'm making to be stored in the save file. But, I'm using the ES6 syntax to write the class.

When I start a game, everything works fine.
When I save the game too.
But after I load a game, it only recognizes the objects inside him, but not the functions of the class(return undefined).

But, if I change the syntax to ES5(like rm mv use) everything works fine.
The case is that I really want to use ES6 syntax

Here is a screenshot of the situation in the console:
YjJc6IN.png

And here is the code in case anyone wants to test it:
master.js
pupil.js

And here is the code, in case you don't want to download:
JavaScript:
//==============================================================\\
//                          ES6                                \\
//==============================================================\\

class Game_Eli{
    constructor (){
        this.initialize();
    };

    initialize(){
        this.setObj();

    };

    setObj(){ // To be overwrited by plugin 2

    };

};

//==============================================================\\
//                          ES5                                 \\
//==============================================================\\

// function Game_Eli() {
//     this.initialize.apply(this, arguments);
// }

// Game_Eli.prototype.initialize = function(){
//     this.setObj();
// };

// Game_Eli.prototype.setObj = function(){ // To be overwrited by plugin 2
  
// };


//==============================================================\\
//                      DATA MANAGER                            \\
//==============================================================\\

var $gameEli = null;

var DataManager_createGameObjects = DataManager.createGameObjects;
DataManager.createGameObjects = function() {
    DataManager_createGameObjects.call(this);
    $gameEli = new Game_Eli();
};

var DataManager_makeSaveContents = DataManager.makeSaveContents;
DataManager.makeSaveContents = function() {
    let alias = DataManager_makeSaveContents.call(this);
    alias.eli = $gameEli;
    return alias;
};

var DataManager_extractSaveContents = DataManager.extractSaveContents;
DataManager.extractSaveContents = function(contents) {
    DataManager_extractSaveContents.call(this, contents);
    $gameEli = contents.eli;
};
JavaScript:
Game_Eli.prototype.setObj = function (){
    this._book = "Amazing!"
};

Game_Eli.prototype.getObj = function(){
    return this._book;
};


What I'm missing?
I'm thinking that maybe it has to do with a load function in DataManager, but I've searched and can't find a clue.
Also, I'm taking a look at this, in case it is a javascript error and not a "don't understand the mv code properly".
Still, I can't find the light =/

Downloads / Referenced Files

Log in to download

Log in, then follow the RPG Maker Developers Group to see these download links.

Log in to download
Creator Claims / Removal

If you are the original creator and want this listing reassigned, edited, or removed, join BMMPlay and contact the moderators with proof that matches the original RPG Maker Web profile, linked GitHub, itch.io page, or another public creator identity.

#039#rpg-maker-archive#js-support

Replies (0)

No replies yet.

0 replies 1 view

Log in to reply.

User Avatar