New account registration is temporarily disabled.

[RMMV] CUSTOM EQUIP MENU

Posts

Pages: 1
Good morning,

I'd like to have some help with this one. I'm trying to replace the equip menu screen with something else (see screenshot below. Don't mind the background, it's something I already worked out beforehand :D). The twist is that only the hero can access this screen (and that this doesn't prompt one to select a party member, just go directly to the screen).
Each equipment would have its own parameters (changing the player's resistance on skills, among others), and provides them skills as they level up. Once all skills for that equipment has been learnt, the equipment would change color.
So my questions are:
1) Would the skill learning as they level up work on equipment, or should I classify them as a class?
2) How do I go about customizing the equipment screen to look and function like the screen below...?

Bunshin screen. Bascially, the bunshins are blank. The player has to collect them as they go around the game world.


Bunsin screen complete. Basically, the ones in full blue are all completely learned. Green is equipped. The purple is the cursor selection. The one in the middle is a secret one that appears only after finishing a quest where all of the rest has been collected.


Let me know if this is doable or too complex to work out. I'm open to a different implementation. Thank you so much!
It's doable, but it might need more work than you expect.

1) I may be wrong but it looks like your "equipment" doesn't just add skills and change resistances, but is also meant to affect the raw stats gained on level up. This is not something the engine allows by default. The character classes have a set stat curve - the stats for each level of each class are predetermined. If a Lv1 Mage has 12 DEF and a Lv1 Hero has 16 DEF, the actor's DEF will be 12 upon class changing to Mage and will shoot back to 16 on changing back to Hero, even without gaining/losing levels. Stats can be permanently modified by stuff like stat-increasing items, but the inbuilt level-up system doesn't really do that on level-up, it just checks the stat curve for the class and sets it at what it should be for the level.

Skills, on the other hand, work the other way. The skills are permanently added to the actor upon hitting the level specified. If the actor goes onto or past the learn-level before switching to the specified class, it will NOT be learned (i.e. if Mage is meant to learn Fire at Lv3 and a Warrior switches to Mage at Lv3+, he will have permanently missed the learn opportunity for Fire, unless he levels DOWN to Lv2 and then goes back up to Lv3 as a Mage ). He will also RETAIN all the skills from the previous class when he changes, because the skills are added to the actor and not read from the class, unlike with the stat curve.

This is clearly not what you want. If you were intending for the actor to be able to swap between skillsets just by switching between classes, it won't work that way by default. And obviously, equipment doesn't level up by default either. So you will need to make some modifications to the existing systems to get it to work the way you want. Whether it's by adding an equipment leveling system or changing the way classes work. Either way, you will need to edit the code or find an appropriate plugin for it.

The only other workaround I can think of is having separate entries in the database (with the same name but different stats/skills) for every "level" of each piece of your equipment and using some variable to store the equip EXP and then making the actor equip the appropriate one according that variable when changing equips and leveling it up. Of course, if this leveling system isn't done through code, you will likely be needing a ton of battle events to implement the equipment EXP gaining system or some common event set up to constantly monitor changes in the actor's EXP and add the appropriate amount to the equip EXP variable and it will be a bit messy.

2) You might as well make a whole new Scene_Equip for it. You can see how the default Scene_Equip is done from the rpg_scenes.js file and the windows where it draws the information and item lists in rpg_windows.js. The existing windows are, you know, vertical lists that do not look anything like your design and they don't leave blank spaces. Those will probably be useless for your purposes. You will probably need to make a custom window (likely built off Window_Selectable instead of Window_Command, since you need grid selection) or have the entire thing sprite-based (with custom input processing logic) or some hybrid between the two - like using an invisible or off-screen window to handle the button selection/processing logic but using sprites to display the visuals.

I don't know what the stat modifiers are supposed to represent, but they don't appear to be linked to the current stats of the actor, so existing stat display Window in the default equip scene will probably not be useful and you will likely end up needing a custom window to show that too.

Of course, before you get about making the display menu, you need to have the actual equipment leveling system ironed out and done first. Or there won't be anything to display.
Ah, it doesn't affect the actual growth, but just adds something to the current player (so on the picture, the bunshin will add +10 strength to the current stat, not +10 at every level. This is a temporary bonus, which changes based on bunshin equipped).

Regarding the skills, so as long as the player is equal or more to the level required to learn that skill, he will learn it once he levels up when he has the bunshin equipped. For example, he's currently level 12, and has switched to a bunshin that has a skill you can learn at level 10. You need to level up once to learn that skill.
The main actor cannot be switched out, so he's always in the party. The rest of the party members, on the other hand, don't need to equip bunshins and can be swapped, dismissed, or whichever. :D
I'm not sure if I have to make the equipment level up. The bunshin will 'max out' once all skills have been learned... so I think it only needs to have a function that checks whether all skills have been learned by the player.

I think it might be simpler to modify the markup that I have (so I don't have to do that much calculations on the placement and all). I've experimented on the main menu and status menu screens, so I just have to modify the equipment screen at the moment.

Also, I'm thinking that it would be much simpler to do this as classes rather than equipment (so add them on the database as actors, but code them as if they're equipment), which I think has been done before...?

Edit:
I think I'll stick with the default layout of the equip menu, with minor adjustments maybe, so it would be simpler to code. Now the only thing I'm curious about is if it's possible to go with the skill learning thing I mentioned about using weapons? If so, how would I go about that (JavaScript or scenes?)

author=shiningriver
Regarding the skills, so as long as the player is equal or more to the level required to learn that skill, he will learn it once he levels up when he has the bunshin equipped. For example, he's currently level 12, and has switched to a bunshin that has a skill you can learn at level 10. You need to level up once to learn that skill.
Yeah, like I said, it doesn't work that way with the default class system. If the actor is already at or above the level where you learn the skill when you switch classes, he won't learn it.

If you want to make it so that the skill is "learned at or above the level" you will have to modify how classes work, if you want to use classes for it. IMO it would probably be simpler just to attach the skills to the equipment (using notetags or something) and then modify the level up process to read the notetag on level-up and give the actor the corresponding skill. It's up to you, of course.

author=shiningriver
I think I'll stick with the default layout of the equip menu, with minor adjustments maybe, so it would be simpler to code. Now the only thing I'm curious about is if it's possible to go with the skill learning thing I mentioned about using weapons? If so, how would I go about that (JavaScript or scenes?)
The rpg_xx.js files ARE JavaScript files. They're the ones that get loaded before any plugins in your game. They're the "default plugins" if that makes any sense, the other plugins are just supposed to modify or extend the code included in the rpg_xx.js files. "Scene_XX" or "Window_XX" are just names for the JavaScript objects in them.

By default, weapons/armor can be set in the database to give you skills, but it's independent of level. The actor just gets the skill upon equipping the gear and loses it on unequipping; having an equip with an "Add Skill" Trait equipped will merely change the Game_Actor's "addedSkills" property, which is just a list of Add Skill Traits. And Traits have absolutely nothing to do with level.

If you want to make it check for actor levels, you would be better off doing something with notetags and modifying the level-up (try looking at the function "Game_Actor.prototype.levelUp") to check for equipped weapon and read its notetags rather than messing around with Traits.

Or you could make a common event that runs after every battle and checks the actor level and what the equipped weapon is and then adds the appropriate skills. It would need to be running nearly all of the time depending on how random your battles are, but that could be done without coding.

And I suppose if all you're doing is checking for the actor's learned skills in order to determine the weapon's "level", you could feasibly code the menu separately from the actual skill learning system/modifications.
author=Traverse
author=shiningriver
Regarding the skills, so as long as the player is equal or more to the level required to learn that skill, he will learn it once he levels up when he has the bunshin equipped. For example, he's currently level 12, and has switched to a bunshin that has a skill you can learn at level 10. You need to level up once to learn that skill.
Yeah, like I said, it doesn't work that way with the default class system. If the actor is already at or above the level where you learn the skill when you switch classes, he won't learn it.

If you want to make it so that the skill is "learned at or above the level" you will have to modify how classes work, if you want to use classes for it. IMO it would probably be simpler just to attach the skills to the equipment (using notetags or something) and then modify the level up process to read the notetag on level-up and give the actor the corresponding skill. It's up to you, of course.

Yeah, I think it would be best to go with using notetags on equipment instead of modifying the classes. I think the complex part of this one would be actually checking the bunshin equipped, cross-checking it with the player's level, and actually including the skill after a level up (instead of upon equip). I'll try to figure this out in the weekend, when I have more time to experiment. Thanks!

author=Traverse
The rpg_xx.js files ARE JavaScript files. They're the ones that get loaded before any plugins in your game. They're the "default plugins" if that makes any sense, the other plugins are just supposed to modify or extend the code included in the rpg_xx.js files. "Scene_XX" or "Window_XX" are just names for the JavaScript objects in them.

By default, weapons/armor can be set in the database to give you skills, but it's independent of level. The actor just gets the skill upon equipping the gear and loses it on unequipping; having an equip with an "Add Skill" Trait equipped will merely change the Game_Actor's "addedSkills" property, which is just a list of Add Skill Traits. And Traits have absolutely nothing to do with level.

If you want to make it check for actor levels, you would be better off doing something with notetags and modifying the level-up (try looking at the function "Game_Actor.prototype.levelUp") to check for equipped weapon and read its notetags rather than messing around with Traits.

Or you could make a common event that runs after every battle and checks the actor level and what the equipped weapon is and then adds the appropriate skills. It would need to be running nearly all of the time depending on how random your battles are, but that could be done without coding.

And I suppose if all you're doing is checking for the actor's learned skills in order to determine the weapon's "level", you could feasibly code the menu separately from the actual skill learning system/modifications.


I was meant to say events, not scenes, sorry about that (i get them confused sometimes). I think I'll go with coding it instead of making a common event. For the equipment, there won't be 'levels' per se, but states (not mastered or mastered), so unless the player has learned all of its skills, it would stay not mastered.
I'll try to experiment this over the weekend when I have more time. Thanks so much for the help!
Game_Actor.prototype.levelUp is the function called when a character would level up - you can override this in a plugin to do something different (or do something extra and call the standard function as well)

The notetag approach you're proposing seems solid.
Calling learnSkill() when the character already knows a skill is safely ignored.
So I got started with the first steps on this one, which is working on displaying the levels and skills... sadly I'm not sure if I'm doing the reading correctly...
So I have these in the notes for weapons. They're formatted as level.skillID

EDIT: I reformatted them as <level:XX>, <skillID:XX>. I couldn't upload a new screenshot.
On the game, they're showing up like this:

(Sidenote, I'm also going to format them like a table of some sort)

I'm certain that a loop would be needed to display all notetags with the appropriate information... but the primary thing I'm stuck at is the actual reading of information from the notetags. Here's part of my code:

//**************************************************
// Help Window
// Handles the display for the equipment's help window
//**************************************************

Scene_MenuBase.prototype.createHelpWindow = function() {
    this._helpWindow = new equipWindow_Help();
    this.addWindow(this._helpWindow);
};

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

equipWindow_Help.prototype = Object.create(Window_Base.prototype);
equipWindow_Help.prototype.constructor = Window_Help;

equipWindow_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
    //var height = this.fittingHeight(numLines || 1);
    var height = this.contentsHeight();
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
equipWindow_Help.prototype.contentsHeight = function() {
    //return this.height - this.standardPadding() * 2;
    return 200;
};

equipWindow_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text;
        this.refresh();
    }
};

equipWindow_Help.prototype.clear = function() {
    this.setText('');
};

equipWindow_Help.prototype.setItem = function(weapon) {
    this.drawText(weapon ? weapon.description : '', 0, 0);
    var wID = weapon ? weapon.id : 0;
    var lvl = weapon ? $dataWeapons[wID].meta.level.split(/\s*,\s*/) : 0;
    var skill = weapon ? $dataWeapons[wID].meta.skillID.split(/\s*,\s*/) : 0;
    for (i = 0; i < 2; i++){
    	this.drawText(weapon ? 'LV: '+lvl[i]+'  '+$dataSkills[skill[i]].name: '', 0, 20*(i+1));
    }
};

equipWindow_Help.prototype.refresh = function() {
    this.contents.clear();
    this.drawTextEx(this._text, this.textPadding(), 0);
};


Edit:
I was able to have the skills listed on the equip menu. Now I'm going to attempt to have the character learn the actual skill upon level up.
I managed to have the player learn skills based on equipment and level, however the game crashes when I go inside the skills menu and select a skill... I am unsure why.

//**************************************************
// Scene Equip
// Makes it so that only the hero has this, not anyone else
//**************************************************

Scene_Equip.prototype.create = function() {
    Scene_MenuBase.prototype.create.call(this);
    this.createHelpWindow();
    this.createStatusWindow();
    this.createCommandWindow();
    this.createSlotWindow();
    this.createItemWindow();
    this.refreshActor();
};

Scene_Equip.prototype.createStatusWindow = function() {
    this._statusWindow = new Window_EquipStatus(0, 60);
    this.addWindow(this._statusWindow);
};

Scene_Equip.prototype.createCommandWindow = function() {
    var wx = this._statusWindow.width;
    //var wy = this._helpWindow.height;
    var wy = 60;
    var ww = Graphics.boxWidth - this._statusWindow.width;
    this._commandWindow = new Window_EquipCommand(wx, wy, ww);
    this._commandWindow.setHelpWindow(this._helpWindow);
    this._commandWindow.setHandler('equip',    this.commandEquip.bind(this));
    this._commandWindow.setHandler('optimize', this.commandOptimize.bind(this));
    this._commandWindow.setHandler('clear',    this.commandClear.bind(this));
    this._commandWindow.setHandler('cancel',   this.popScene.bind(this));
    this.addWindow(this._commandWindow);
};

Scene_Equip.prototype.createSlotWindow = function() {
    var wx = this._statusWindow.width;
    var wy = this._commandWindow.y + this._commandWindow.height;
    var ww = Graphics.boxWidth - this._statusWindow.width;
    var wh = this._statusWindow.height - this._commandWindow.height;
    this._slotWindow = new Window_EquipSlot(wx, wy, ww, wh);
    this._slotWindow.setHelpWindow(this._helpWindow);
    this._slotWindow.setStatusWindow(this._statusWindow);
    this._slotWindow.setHandler('ok',       this.onSlotOk.bind(this));
    this._slotWindow.setHandler('cancel',   this.onSlotCancel.bind(this));
    this.addWindow(this._slotWindow);
};

Scene_Equip.prototype.createItemWindow = function() {
    var wx = 0;
    var wy = this._statusWindow.y + this._statusWindow.height;
    var ww = Graphics.boxWidth/2;
    var wh = Graphics.boxHeight - wy;
    this._itemWindow = new Window_EquipItem(wx, wy, ww, wh);
    this._itemWindow.setHelpWindow(this._helpWindow);
    this._helpWindow.width = ww;
    this._helpWindow.height = wh;
    this._helpWindow.x = wx+ww;
    this._helpWindow.y = wy;
    this._helpWindow.contents.fontSize = 18;
    this._itemWindow.setStatusWindow(this._statusWindow);
    this._itemWindow.setHandler('ok',     this.onItemOk.bind(this));
    this._itemWindow.setHandler('cancel', this.onItemCancel.bind(this));
    this._slotWindow.setItemWindow(this._itemWindow);
    this._itemWindow.maxCols();
    this.addWindow(this._itemWindow);
};


Window_ItemList.prototype.maxCols = function() {
    return 1;
};

Window_EquipCommand.prototype.makeCommandList = function() {
    this.addCommand(TextManager.equip2,   'equip');
    //this.addCommand(TextManager.optimize, 'optimize');
    //this.addCommand(TextManager.clear,    'clear');
};

//**************************************************
// Game Actor
// This part handles the level up function, including learning skills
//**************************************************

Game_Actor.prototype.levelUp = function() {
    this._level++;
    actorId = this._actorId;
    console.log('actor ID: '+actorId);
    //If it's the hero's that levels up
    if (actorId = 1){
    	var name = this._name;
    	console.log('Selected Party Member: '+ name);
    	var weapon = $gameParty.members()[0]._equips[0]._itemId;
    	console.log('equipped weapon: '+ $dataWeapons[weapon].name);
    	var wID = weapon ? weapon : 0;
	    console.log('weapon ID: '+wID);
	    var lvl = weapon ? $dataWeapons[wID].meta.level.split(/\s*,\s*/) : 0;
	    console.log('meta lvl: '+ lvl);
	    console.log('lvl a: '+ lvl[0]);
	    console.log('lvl b: '+ lvl[1]);
	    var skill = weapon ? $dataWeapons[wID].meta.skillID.split(/\s*,\s*/) : 0;
	    console.log('meta skill: '+ skill);
	    console.log('skill a: '+ skill[0]);
	    console.log('skill b: '+ skill[1]);
	    
	    // learn the skill based on the meta tag level and skill ID on the equipped Bunshin(weapon)
	    for (i = 0; i < 3; i++){
	    	if (lvl[i] <= this._level) {
	    		console.log('current level is: '+ lvl[i]);
	            this.learnSkill(skill[i]);
	            console.log('learned: '+skill[i]);
	        }
	    }
    }
    //Anyone else
    else{
    	this.currentClass().learnings.forEach(function(learning) {
	        if (learning.level === this._level) {
	            this.learnSkill(learning.skillId);
	        }
	    }, this);
    }
};

Game_Actor.prototype.skills = function() {
    var list = [];
    this._skills.concat(this.addedSkills()).forEach(function(id) {
        if (!list.contains($dataSkills[id])) {
            list.push($dataSkills[id]);
        }
    });
    return list;
};

Game_Actor.prototype.learnSkill = function(skillId) {
    if (!this.isLearnedSkill(skillId)) {
        this._skills.push(skillId);
        this._skills.sort(function(a, b) {
            return a - b;
        });
    }
};

Game_Actor.prototype.isLearnedSkill = function(skillId) {
    return this._skills.contains(skillId);
};


Game_Actor.prototype.equips = function() {
    return this._equips.map(function(item) {
        return item.object();
    });
};



//**************************************************
// Help Window
// Handles the display for the equipment's help window
// This part is DONE
//**************************************************

Scene_MenuBase.prototype.createHelpWindow = function() {
    this._helpWindow = new equipWindow_Help();
    this.addWindow(this._helpWindow);
};

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

equipWindow_Help.prototype = Object.create(Window_Base.prototype);
equipWindow_Help.prototype.constructor = Window_Help;

equipWindow_Help.prototype.initialize = function(numLines) {
    var width = Graphics.boxWidth;
    //var height = this.fittingHeight(numLines || 1);
    var height = this.contentsHeight();
    Window_Base.prototype.initialize.call(this, 0, 0, width, height);
    this._text = '';
};
equipWindow_Help.prototype.contentsHeight = function() {
    //return this.height - this.standardPadding() * 2;
    return 200;
};

equipWindow_Help.prototype.setText = function(text) {
    if (this._text !== text) {
        this._text = text;
        this.refresh();
    }
};

equipWindow_Help.prototype.clear = function() {
    this.setText('');
};

equipWindow_Help.prototype.setItem = function(weapon) {
	this.contents.clear();
    this.drawText(weapon ? weapon.description : '', 0, 0);
    var wID1 = weapon ? weapon.id : 0;
    var lvl1 = weapon ? $dataWeapons[wID1].meta.level.split(/\s*,\s*/) : 0;
    var skill1 = weapon ? $dataWeapons[wID1].meta.skillID.split(/\s*,\s*/) : 0;
    //var skill2 = weapon ? $dataSkills[$dataWeapons[wID].meta.skillID.split(/\s*,\s*/)].name : 0;
    for (i = 0; i < 2; i++){
    	this.drawText(weapon ? 'LV: '+lvl1[i]+'  '+$dataSkills[skill1[i]].name: '', 0, 20*(i+1));
    }
};

equipWindow_Help.prototype.refresh = function() {
    this.contents.clear();
    this.drawTextEx(this._text, this.textPadding(), 0);
};

Pages: 1