why i can't overwrite rpg_scene function?

● ARCHIVED · READ-ONLY
Started by Isabella Ava 8 posts View original ↗
  1. Hi there : )
    I tried to make a simple plugin that overwrite a function from rpg_scene.js
    but it doesn't seem to work = |
    for example:
    Scene_Title.prototype.update = function() {
    };
    i put this plugin at bottom of my plugin list,
    it should ruin the title scene but nothing happen = |
    so ... why is that, can someone tell me please?
  2. You'll need to do this:

    Code:
    this.Scene_Title.prototype.update = function(){
    
    };

    Adding the word "this." tells the interpreter to use this function instead of the one in rpg_scene.
  3. AceOfAces_Mod said:
    You'll need to do this:

    Code:
    this.Scene_Title.prototype.update = function(){
    
    };

    Adding the word "this." tells the interpreter to use this function instead of the one in rpg_scene.

    Thank you for the answer,
    but it still doesn't work = |
    i tried this but nothing happen
    this.Scene_Title.prototype.update = function() {
    };
  4. AceOfAces_Mod said:
    Adding the word "this." tells the interpreter to use this function instead of the one in rpg_scene.
    Wrong. Whenever there is a new definition of an already defined function, it overwrites the previous one, therefore the keyword this has no use. Also, the keyword this has a completely different meaning, it's related to object oriented programming.

    It should be working if everything is alright, So, is the plugin on?
    Are there no syntax errors in the plugin? (most probable reason. Could you share the function?)
    Is it in the correct folder?
  5. Hi @Poryg =)
    Poryg said:
    It should be working if everything is alright, So, is the plugin on?
    Are there no syntax errors in the plugin? (most probable reason. Could you share the function?)
    Is it in the correct folder?
    Yes, this is all of the plugin:
    //=============================================================================
    // master2015hp_delaytitlecommand.js
    // by master2015hp
    // 2018.08.31
    //=============================================================================
    /*:
    * @plugindesc delay title command
    * @author master2015hp@gmail.com
    *
    * @param wait_time
    * @desc waiting time in frames
    * @type number
    * @min 0
    * @max 9999
    * @default 20
    *
    * @help
    * delay appearance of Title Commands/ modify parameters as you will/ min = 0
    *
    * -----------------
    *
    */
    var parameters = PluginManager.parameters("master2015hp_delaytitlecommand");
    var cke.wait_time = parameters["wait_time"];

    Scene_Title.prototype.update = function() {
    this.ckex = this.ckex || 0;
    this.ckex++;
    if (!this.isBusy() && this.ckex > cke.wait_time) {
    this._commandWindow.open();
    }
    Scene_Base.prototype.update.call(this);
    };
    I am sure that i put it inside plugins folder & turned ON + put it at very last of plugins list =|
    But it just doesn't work =(
  6. var cke.wait_time

    that line is wrong (contains a syntax error). By var you define a variable, not an object property.
    Transform the code to
    Code:
    var cke = cke || {}; // checks if cke object is defined and if not, it defines it
    cke.wait_time = parameters["wait_time"]; // defines the cke's property "wait_time"
    it should work afterwards.

    You would have seen the error if you had opened the dev console with f8 in game btw.
  7. ah yesss! the bad habit of naming variables randomly! (∥ ̄■ ̄∥)
    Thanks @Poryg
    You're right, the error right there in console.
    I just didn't think about open console to check since the game wasn't crashed or anything.
  8. Whenever there's spmething wrong, console should be the first thing to check :p