Custom Menu option

I assume this is in response to removing:  Scene_Achievements.prototype.createCommandWindow ? In your code you have two methods called "createCommandWindow" - one in Scene_Menu which you override open the achievements scene, and the other one on Scene_Achievements - so you may have deleted the wrong one.


This is not required, it just makes it so the plugin classes can't be interacted with/overridden by the base code or other plugins with out explicit hooks put in place.


Also, some more redundant code:



Scene_Achievements.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this._achievementsWindow = new Window_Achievements(0,0);
this._achievementsWindow.x = 0;
this._achievementsWindow.y = 0;
this.addWindow(this._achievementsWindow);
};


The (0, 0) passed in to the window are the x and y positions for the window, setting them to 0 afterwards is pointless.



Window_Achievements.prototype.refresh = function() {
var x = this.textPadding();
var width = this.contents.width - this.textPadding() * 2;
this.contents.clear();
this.drawIcon(2,0,0);
};


The variables 'x' and 'width' aren't used in this function, so you can get rid of those.



Awesome that's good to know (about the function()).


About the drawIcon(2,0,0); they followed a code tutorial so that's why that is there. It was just something to test out how to add content into it that the seemed to have kept in.


Edit: Just tested the code I did in a new file called "Achievements Plugin.js" and can say that it does in fact work. You just need to fiddle with the position and size to make it fit right.
Thank you guys so much! I'll continue to play around and see if I can do some more with this! You're help is much appreciated!
Here's what I'm going for~ Eventually.


The List on the left is what Achievements are in the game,


The Blue Box is an Icon for the Achievement, and the name is next to it.


the box to the bottom right, is a description of whether or not you have unlocked the achievement and how to get it~


Achievement Window.png



I'd like the text and Icon to be customizable strings for the Person making the game, as this is a plug-in!
I know this seems a little big for a novice like myself, but I'm willing to try to get there,
Just don't give up. Javascript I find is soOOoo easy. And with RPG Maker MV it's essentially all done for you, you just need to put it together.


I use Javascript for Web Development so I guess I could just be bias. I know mostly HTML and PHP so I guess Javascript just comes naturally to me.


Once you learn it though, so many doors open up to you in the world.


Edit: Essentially by the looks of it, you want 3 windows. One SceneAchievement but three WindowSamples. I'm not sure entirely but I'd imagine something like duplicating WindowSample to make WindowAchievementLeft, WindowAchievementTop, and WindowAchivementBottomRight something along those lines.


Edit 2: Don't quote me, but with this: 


this.drawIcon(2,0,0);


I believe 2,0,0 means Icon 2, Position X 0, Position Y 0. So you'd want something like that for the achievement icon and find the numbers for the icons.
How exactly do I make 3 menu's in one Scene?
I can respond more in depth tomorrow if you want (1 am here). However examine your code and notice all the "WindowSample" it has. Basically you want to make more of those except name them something that makes sense. Like WindowAchievementsLeft (for the left part) and stuff like that. Pretty much think of the "Scene" as the page you are on you want one scene. Title scene, main menu scene, game scene, battle scene, etc. Now the window is each part in that scene, you'll notice how in the main menu there is three right now (I believe) one for all the options (save, quit, equip, items, status, etc) one for the gold (bottom left) and one for the group of characters (right with all your characters).


Thats pretty much it. I can tell you more tomorrow. Goodnight and good luck.
// dont touch this.


/*:
* @plugindesc This is the Achievements Plug-in!
*
*
* @author TagumonYatsuray
*
* @Param Achievements
* @Desc This is the Achievements Parameter
* @Default 0
* @help This is the help file!
*
*/

(function() { // Do not touch RMMV uses this to wrap the code
var parameters = PluginManager.parameters('Achievements Plugin');

var _Scene_Menu_createCustomMenuWindow = Scene_Menu.prototype.createCommandWindow;

Window_MenuCommand.prototype.addOriginalCommands = function() {
this.addCommand("Achievements", 'achievements', true);
};

Scene_Menu.prototype.createCommandWindow = function() {
_Scene_Menu_createCustomMenuWindow.call(this);
this._commandWindow.setHandler('achievements', this.commandAchievements.bind(this));
this.addWindow(this._commandWindow);
};

Scene_Menu.prototype.commandAchievements = function() {
SceneManager.push(Scene_Achievements);
};


//-----------------------------------------------------------------------------
// Window_Achievements
//
// The window for displaying achievements.

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

Window_Achievements_Left.prototype = Object.create(Window_Base.prototype);
Window_Achievements_Left.prototype.constructor = Window_Achievements_Left;

Window_Achievements_Left.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};

Window_Achievements_Left.prototype.windowWidth = function() {
return 200;
};

Window_Achievements_Left.prototype.windowHeight = function() {
return 620;
};

Window_Achievements_Left.prototype.refresh = function() {
var x = this.textPadding();
var width = this.contents.width - this.textPadding() * 2;
this.contents.clear();
this.drawIcon(5,0,0);
};

Window_Achievements_Left.prototype.open = function() {
this.refresh();
Window_Base.prototype.open.call(this);
};

Scene_Achievements_Left.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createAchievementsWindowLeft();
this.createStatusWindow();
};

Scene_Achievements.prototype.createAchievementsWindowLeft = function() {
this._achievementsWindowLeft = new Window_Achievements_Left(0, 0);
this._achievementsWindowLeft.y = Graphics.boxHeight - this._achievementsWindowLeft.height;
this.addWindow(this._achievementsWindowLeft);
//-----------------------------------------------------------------------------
// Window_Achievements
//
// The window for displaying achievements.

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

Window_Achievements_Top.prototype = Object.create(Window_Base.prototype);
Window_Achievements_Top.prototype.constructor = Window_Achievements_Top;

Window_Achievements_Top.prototype.initialize = function(x, y) {
var width = this.windowWidth();
var height = this.windowHeight();
Window_Base.prototype.initialize.call(this, x, y, width, height);
this.refresh();
};

Window_Achievements_Top.prototype.windowWidth = function() {
return 600;
};

Window_Achievements_Top.prototype.windowHeight = function() {
return 200;
};

Window_Achievements_Top.prototype.refresh = function() {
var x = this.textPadding();
var width = this.contents.width - this.textPadding() * 2;
this.contents.clear();
this.drawIcon(5,0,0);
};

Window_Achievements_Top.prototype.open = function() {
this.refresh();
Window_Base.prototype.open.call(this);
};

Scene_Achievements_Top.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this.createCommandWindow();
this.createAchievementsWindowTop();
this.createStatusWindow();
};

Scene_Achievements.prototype.createAchievementsWindowLeft = function() {
this._achievementsWindowTop = new Window_Achievements_Top(0, 0);
this._achievementsWindowTop.y = Graphics.boxHeight - this._achievementsWindowTop.height;
this.addWindow(this._achievementsWindowTop);
};

//-----------------------------------------------------------------------------
// Scene_Achievements
//
// The scene class of the menu screen.

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

Scene_Achievements.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Achievements.prototype.constructor = Scene_Achievements;

Scene_Achievements.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};

Scene_Achievements.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this._achievementsWindowLeft = new Window_Achievements_Left(0,0);
this._achievementsWindowLeft.x = 0;
this._achievementsWindowLeft.y = 0;
this.addWindow(this._achievementsWindowLeft);
this._achievementsWindowTop = new Window_Achievements_Top(0,0);
this._achievementsWindowTop.x = 400;
this._achievementsWindowTop.y = 0;
this.addWindow(this._achievementsWindowTop);
this._achievementsWindowBottom = new Window_Achievements_Bottom(0,0);
this._achievementsWindowBottom.x = 610;
this._achievementsWindowBottom.y = 0;
this.addWindow(this._achievementsWindowBottom);
};

Scene_Achievements.prototype.start = function() {
Scene_MenuBase.prototype.start.call(this);
};

Scene_Achievements.prototype.update = function() {
Scene_MenuBase.prototype.update.call(this);

if(Input.isTriggered('cancel')) {
SoundManager.playCancel();
SceneManager.goto(Scene_Menu);
}
}





})();


I edit it and added the second option, but now the command has dissapeared again...
There was some mistakes with it. This will work. Other than some formatting, you forgot to end a part with } which code gets very upset with.


You forgot to add the bottom though. Look through the code and see what I changed.


Edit: As I enjoy coding I fixed it and added the bottom too. Except their positions/sizes are not right.


Working Code:

Code:
/*:
 * @plugindesc This is the Achievements Plug-in!
 *
 *
 * @author TagumonYatsuray
 *
 * @Param Achievements
 * @Desc This is the Achievements Parameter
 * @Default 0
 * @help This is the help file!
 * 
 */
 
 (function() {
	 
    var parameters = PluginManager.parameters('Achievements Plugin');
    
    var _Scene_Menu_createCustomMenuWindow = Scene_Menu.prototype.createCommandWindow;
  
    Window_MenuCommand.prototype.addOriginalCommands = function() {
        this.addCommand("Achievements", 'achievements', true);
    };
    
    Scene_Menu.prototype.createCommandWindow = function() {
        _Scene_Menu_createCustomMenuWindow.call(this);
        this._commandWindow.setHandler('achievements',      this.commandAchievements.bind(this));
        this.addWindow(this._commandWindow);
    };
    
    Scene_Menu.prototype.commandAchievements = function() {
        SceneManager.push(Scene_Achievements);
    };
    
    
    //-----------------------------------------------------------------------------
    // Window_Achievements_Left
    //
    // The window for displaying achievements.

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

    Window_Achievements_Left.prototype = Object.create(Window_Base.prototype);
    Window_Achievements_Left.prototype.constructor = Window_Achievements_Left;

    Window_Achievements_Left.prototype.initialize = function(x, y) {
        var width = this.windowWidth();
        var height = this.windowHeight();
        Window_Base.prototype.initialize.call(this, x, y, width, height);
        this.refresh();
    };

    Window_Achievements_Left.prototype.windowWidth = function() {
        return 200;
    };

    Window_Achievements_Left.prototype.windowHeight = function() {
        return 620;
    };

    Window_Achievements_Left.prototype.refresh = function() {
        var x = this.textPadding();
        var width = this.contents.width - this.textPadding() * 2;
        this.contents.clear();
        this.drawIcon(5,0,0);
    };

    Window_Achievements_Left.prototype.open = function() {
        this.refresh();
        Window_Base.prototype.open.call(this);
    };
	
    //-----------------------------------------------------------------------------
    // Window_Achievements_Top
    //
    // The window for displaying achievements.

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

    Window_Achievements_Top.prototype = Object.create(Window_Base.prototype);
    Window_Achievements_Top.prototype.constructor = Window_Achievements_Top;

    Window_Achievements_Top.prototype.initialize = function(x, y) {
        var width = this.windowWidth();
        var height = this.windowHeight();
        Window_Base.prototype.initialize.call(this, x, y, width, height);
        this.refresh();
    };

    Window_Achievements_Top.prototype.windowWidth = function() {
        return 600;
    };

    Window_Achievements_Top.prototype.windowHeight = function() {
        return 200;
    };

    Window_Achievements_Top.prototype.refresh = function() {
        var x = this.textPadding();
        var width = this.contents.width - this.textPadding() * 2;
        this.contents.clear();
        this.drawIcon(5,0,0);
    };

    Window_Achievements_Top.prototype.open = function() {
        this.refresh();
        Window_Base.prototype.open.call(this);
    };
	
	//-----------------------------------------------------------------------------
    // Window_Achievements_Bottom
    //
    // The window for displaying achievements.

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

    Window_Achievements_Bottom.prototype = Object.create(Window_Base.prototype);
    Window_Achievements_Bottom.prototype.constructor = Window_Achievements_Bottom;

    Window_Achievements_Bottom.prototype.initialize = function(x, y) {
        var width = this.windowWidth();
        var height = this.windowHeight();
        Window_Base.prototype.initialize.call(this, x, y, width, height);
        this.refresh();
    };

    Window_Achievements_Bottom.prototype.windowWidth = function() {
        return 600;
    };

    Window_Achievements_Bottom.prototype.windowHeight = function() {
        return 600;
    };

    Window_Achievements_Bottom.prototype.refresh = function() {
        var x = this.textPadding();
        var width = this.contents.width - this.textPadding() * 2;
        this.contents.clear();
        this.drawIcon(5,0,0);
    };

    Window_Achievements_Bottom.prototype.open = function() {
        this.refresh();
        Window_Base.prototype.open.call(this);
    };
    
    //-----------------------------------------------------------------------------
    // Scene_Achievements
    //
    // The scene class of the menu screen.

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

    Scene_Achievements.prototype = Object.create(Scene_MenuBase.prototype);
    Scene_Achievements.prototype.constructor = Scene_Achievements;

    Scene_Achievements.prototype.initialize = function() {
        Scene_MenuBase.prototype.initialize.call(this);
    };

    Scene_Achievements.prototype.create = function() {
        Scene_MenuBase.prototype.create.call(this);
        this.createAchievementsWindowLeft();
        this.createAchievementsWindowTop();
		this.createAchievementsWindowBottom();
    };
	
	Scene_Achievements.prototype.create = function() {
        Scene_MenuBase.prototype.create.call(this);
        this._achievementsWindowLeft = new Window_Achievements_Left(0,0);
        this._achievementsWindowLeft.x = 0;
        this._achievementsWindowLeft.y = 0;
        this.addWindow(this._achievementsWindowLeft);
        this._achievementsWindowTop = new Window_Achievements_Top(0,0);
        this._achievementsWindowTop.x = 400;
        this._achievementsWindowTop.y = 0;
        this.addWindow(this._achievementsWindowTop);
        this._achievementsWindowBottom = new Window_Achievements_Bottom(0,0);
        this._achievementsWindowBottom.x = 610;
        this._achievementsWindowBottom.y = 0;
        this.addWindow(this._achievementsWindowBottom);
    };
	
	Scene_Achievements.prototype.start = function() {
        Scene_MenuBase.prototype.start.call(this);
    };
    
    Scene_Achievements.prototype.update = function() {
        Scene_MenuBase.prototype.update.call(this);
        
        if(Input.isTriggered('cancel')) {
            SoundManager.playCancel();
            SceneManager.goto(Scene_Menu);
        }
    }
	
  })();
Thanks so much! I edit the windows sizes and got them to work~ Do you know how to make text in them instead of the Icons?
Scene_Achievements.prototype.create = function() {
Scene_MenuBase.prototype.create.call(this);
this._achievementsWindowLeft = new Window_Achievements_Left(0,0);
this._achievementsWindowLeft.x = 0;
this._achievementsWindowLeft.y = 0;
this._achievementsWindowLeft.setHandler('Achievement 1', this.commandAchievement1.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 2', this.commandAchievement2.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 3', this.commandAchievement3.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 4', this.commandAchievement4.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 5', this.commandAchievement5.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 6', this.commandAchievement6.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 7', this.commandAchievement7.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 8', this.commandAchievement8.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 9', this.commandAchievement9.bind(this));
this._achievementsWindowLeft.setHandler('Achievement 10', this.commandAchievement10.bind(this));
this.addWindow(this._achievementsWindowLeft);

this._achievementsWindowTop = new Window_Achievements_Top(0,0);
this._achievementsWindowTop.x = 200;
this._achievementsWindowTop.y = 0;
this.addWindow(this._achievementsWindowTop);

this._achievementsWindowBottom = new Window_Achievements_Bottom(0,0);
this._achievementsWindowBottom.x = 200;
this._achievementsWindowBottom.y = 91;
this.addWindow(this._achievementsWindowBottom);
};

Scene_Achievements.prototype.commandAchievement1 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement2 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement3 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement4 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement5 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement6 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement7 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement8 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement9 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};

Scene_Achievements.prototype.commandAchievement10 = function() {
this._achievementsWindowLeft.close();
this.fadeOutAll();
SceneManager.goto(Scene_Map);
};


I added this to the Scene, but when I open the Achievements window I get the error, "Undefined Is not a function"
Instead of this: 


this.drawIcon(5,0,0);


It's this:


this.drawTextEx("Text here!", 0, 0);




It will take you some learning however for how to do each "Achievement" as a button or whatever but unfortunately even I don't know how to do that *yet*.


Best thing you can do is examine the code and learn from it.


Glad I could help! Hope this goes well for you, and achievement plugin sounds like a great thing.
AHHHH I forgot the (0,0); after ("Text here!",); I'm so stupid!
Haha no you're not. You made it this far. You're doing good.


Edit: A common mistake is forgetting the } or even a ;
Do you know about the "Function undefined error" I posted above?
Do you know about the "Function undefined error" I posted above?

If you open the js console (F8 while the game window is running) then it'll tell you exactly what line in the code it fails on, you should be able to easily debug most problems this way.
Right, but I don't know what Function Undefined means, so i'm not sure how to fix it,
Right, but I don't know what Function Undefined means, so i'm not sure how to fix it,

For one, none of this is defined or needed.

Code:
Scene_Achievements.prototype.commandAchievement1 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement2 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement3 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement4 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement5 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement6 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement7 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement8 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement9 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };

    Scene_Achievements.prototype.commandAchievement10 = function() {
    this._achievementsWindowLeft.close();
    this.fadeOutAll();
    SceneManager.goto(Scene_Map);
    };
Hm... I'm examing the code of the regular menu trying to figure out what I'm missing... I even tried taking the code directly from there, but it doesn't seem to work,
Hm... I'm examing the code of the regular menu trying to figure out what I'm missing... I even tried taking the code directly from there, but it doesn't seem to work,

Taking it from where? Also function undefined essentially means that something that code is not "defined" or explained what it is. In this case it's all of the commandAchievement1-9's there are. You use them but never define them. It doesn't know what those are.

Original thread: https://forums.rpgmakerweb.com/threads/custom-menu-option.56215/