AphoticAmaranth

An Ordinary Human
Veteran
Joined
Mar 29, 2020
Messages
286
Reaction score
377
First Language
English
Primarily Uses
RMMV
Introduction
By default, 'optimize' will select equipment with the highest total stats. This might not be ideal if some of the better equipment provide non-stat related benefits, and that's where this plugin comes in.

Features
  • Allows optimize to utilize a grading system defined by the developer.
  • Can optionally change the optimize command to use item price.
  • Can set equipment as unique, preventing optimize from selecting the same item twice. (Ideal for equipment with effects that can't be stacked)
How to use
Save it as APHO_EquipOptimizeGrade.js and put it in your plugin folder.
Set grades with the notetag <grade:n>
'n' must be a number greater than -1000. Decimals may be used.

If you have multiple slots for the same equip type (added via plugins like YEP_EquipCore), and you do not want the same item to be equipped twice, use the notetag <unique>

If a grade is not specified, optimize will follow the ruling set by the plugin parameter 'ungraded equip ruling'.
  • 0 - Use the value set in the 'default grade' parameter.
  • 1 - Use stat totals, just like vanilla RMMV.
  • 2 - Use the item's price.
If using anything other than default grade, it is highly recommended to either grade all equips of a specific equipment type, or none.

Script
JavaScript:
//==========================================
// APHO_EquipOptimizeGrade.js
//==========================================
/*:
* @title Equip Optimize Grade
* @author Apho
* @plugindesc v1.1 Allows the 'Optimize' command in the equip menu to utilize a grading system defined by the developer.
*
* @param Ungraded equip ruling
* @type select
* @option Use default grade
* @value 0
* @option Use stat totals (Default RMMV rules)
* @value 1
* @option Use item price
* @value 2
* @desc Ruling for optimizing equips when no grade is defined.
* @default 0
*
* @param Default grade
* @type number
* @min -999
* @desc If 'use default grade' ruling is selected, ungraded equips will have this grade.
* @default 0
*
* @help
* This plugin changes the way optimize works, by allowing the developer to set
* grades for equipment.
* Higher grades will be prioritized over lower ones when optimizing equipment.
* If multiple equips have the same grade, the one with a lower ID will be
* prioritized.
* 
* Set grades with the notetag <grade:n>
* 'n' must be a number greater than -1000. Decimals may be used.
* 
* If you have multiple slots for the same equip type (added via plugins like
* YEP_EquipCore), and you do not want the same item to be equipped twice, use
* the notetag <unique>
* (This will still equip twice if you have nothing else to equip.)
*
* If a grade is not specified, optimize will follow the ruling set by the plugin
* parameter 'ungraded equip ruling'.
* 0 - Use the value set in the 'default grade' parameter.
* 1 - Use stat totals, just like vanilla RMMV.
* 2 - Use the item's price.
*
* If using anything other than default grade, it is highly recommended to
* either grade all equips of a specific equipment type, or none.
*
* TERMS OF USE
* - Free for commercial and non-commercial use, as long as I get a free copy
*   of the game.
* - Edits allowed for personal use.
* - Do not repost or claim as your own, even if edited.
* 
* VERSION HISTORY
* v1.1 - 2022/8/2 - Optimize code
* v1.0 - 2022/8/1 - Initial release.
*/
var parameters = PluginManager.parameters('APHO_EquipOptimizeGrade');
var UngradedRuling = parseInt(parameters['Ungraded equip ruling']);
var DefaultGrade = parseFloat(parameters['Default grade']);
Game_Actor.prototype.calcEquipItemPerformance = function(item)
{
    if(item.meta.unique)
    {
        var who = this.actorId();
        var what = item.id;
        if(item.wtypeId && $gameActors.actor(who).hasWeapon($dataWeapons[what]))
        {
            return -1000;
        }
        else if(item.atypeId && $gameActors.actor(who).hasArmor($dataArmors[what]))
        {
            return -1000;
        }
    }
    if(item.meta.grade)
    {
        return parseFloat(item.meta.grade);
    }
    else
    {
        switch(UngradedRuling)
        {
            case 0:
                return DefaultGrade;
                break;
            case 1:
                return item.params.reduce(function(a, b){return a + b;});
                break;
            case 2:
                return item.price;
                break;
        }
    }    
}

FAQ

Terms of use

  • Free for commercial and non-commercial use, as long as I get a free copy of the game.
  • Edits allowed for personal use.
  • Do not repost or claim as your own, even if edited.
Version history
  • v1.1 - 2022/8/1 - Optimized code.
  • v1.0 - 2022/8/1 - Initial release.
 

Attachments

  • APHO_EquipOptimizeGrade.js
    2.8 KB · Views: 7
Last edited:

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,288
Reaction score
2,461
First Language
Dutch
Primarily Uses
RMMV
it looks nice, but on your code, there is 2 function double, specially
the last 2 on "switch(upgradeRuling)" in the else branch, why 2 times?

is 1 time not enough.
but cool idea otherwise, not exactly sure what ruling would take place
if you took higher number, but even optimize part isn't always perfect,
if they want to build their own strategy, so optimize isn't always the
desire equipment.
 

AphoticAmaranth

An Ordinary Human
Veteran
Joined
Mar 29, 2020
Messages
286
Reaction score
377
First Language
English
Primarily Uses
RMMV
it looks nice, but on your code, there is 2 function double, specially
the last 2 on "switch(upgradeRuling)" in the else branch, why 2 times?

is 1 time not enough.
but cool idea otherwise, not exactly sure what ruling would take place
if you took higher number, but even optimize part isn't always perfect,
if they want to build their own strategy, so optimize isn't always the
desire equipment.
They're in different else branches, the first one for "if item is unique, does not have a specified grade, and user does not already have it equipped", the second one for "if item is not unique and does not have a specified grade"... but yeah come to think of it in hindsight I could probably have put them both in the same branch. I am not a smart person.

Edit: optimized code, updated original post to v1.1
 
Last edited:

ShadowDragon

Realist
Veteran
Joined
Oct 8, 2018
Messages
6,288
Reaction score
2,461
First Language
Dutch
Primarily Uses
RMMV
it looks alot cleaner, nice job =)

honestly, I cannot use it, but I hope people can make good use of it.
 

recoculous

Veteran
Veteran
Joined
Jul 20, 2021
Messages
76
Reaction score
21
First Language
English
Primarily Uses
RMMV
@AphoticAmaranth

I have an MV game that is basically finished, but a friend who prefers to use the optimize option noticed how bad the default option is for that. I see almost nothing useful for this situation other than your plugin.

I am trying your plugin, and it is not equipping accessories to the actors.

I am using Ramza's Dual Wielding plugin, and YEP's Equip Core plugin. The dual wielding works well with this plugin. I have Scrolls and Accessories that can be equipped to actors. Everything is working other than accessories.

Edit 8-13-2022: Never mind! YEP Equip Core has a plugin setting for non-optimized equipment groups, and I was using that for some reason on accident. Maybe it was the default setting.

Edit 8-14-2022: One issue with the plugin is that it seems to equip the weapon/main hand without any concern for the points of the shield/off hand. This can matter when the weapon is two handed (with seal shield). Not sure if there is a way to compare the two-handed option with equipping two items of greater total grade value.
 
Last edited:

AphoticAmaranth

An Ordinary Human
Veteran
Joined
Mar 29, 2020
Messages
286
Reaction score
377
First Language
English
Primarily Uses
RMMV
Edit 8-14-2022: One issue with the plugin is that it seems to equip the weapon/main hand without any concern for the points of the shield/off hand. This can matter when the weapon is two handed (with seal shield). Not sure if there is a way to compare the two-handed option with equipping two items of greater total grade value.
That's actually the default RMMV behaviour. All the plugin really does is change the value that is returned when calculating each equippable item's total stats.

If you're using the grading system for weapons, perhaps two-handed weapons could be given a slightly lower grade, to account for the fact that they seal the off-hand?
 

Latest Posts

Latest Profile Posts

There was a tutorial on how to draw anime eyes. Just draw Among Us. So I tried.
Screenshot_107.jpg
DamageActor3_7.png added!
index.php

Making a "characters first appearance" drawing for my game. Now I just have to finish the sprite art animation for her grand entrance.​
ScreenShot_9_24_2022_7_56_24.png
New area being started today. It leads to one of the games 2 optional bosses.
A secret desire of mine: I want to make a horror game based on Celtic mythology. I've seen plenty of Greek, Japanese and Norse mythology-based horror games, but I don't think I've ever seen a Celtic-based horror game anywhere...

Forum statistics

Threads
125,537
Messages
1,171,792
Members
164,607
Latest member
DemiDevil
Top