Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
484
Reaction score
264
First Language
English
Primarily Uses
RMMZ
I need a plugin that allows multiple accessories instead of just 1 by default. Not only does it need to allow multiple accessories but to be able to restrict multiple copies of the same accessory. The multiple accessory slots need to be considered as the same equipment type so that any accessory can be equipped into any slot. It also needs to allow 'Cursed' accessories that lock only their own slot & not all of them. If anyone can point me to a plugin that does this already or can provide a new one I would appreciate it.

Also, don't suggest Yanfly's Equip Core, because its flawed hence the reason I'm asking for a new one.
 

Levolpehh

Veteran
Veteran
Joined
Nov 17, 2018
Messages
86
Reaction score
81
First Language
English
Primarily Uses
RMMV
Why not just make 2 different equipment slots labelled Accessory 1 and 2?
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
168
Reaction score
197
First Language
Danish
Primarily Uses
RMMV
Made this for you. I even made it compatible with Yanfly's Equip Core in case someone wants to use it with that. However, it does not require it at all. It might not be the most polished plugin so if you encounter any bugs or flaws feel free to shoot me a message and I will fix it :)
You can set an item to be cursed by adding the note tag <cursed:true> to the item.

Code:
//=============================================================================
// Multiple Accessories
// MRP_MultipleAccessories.js
// By Magnus0808 || Magnus Rubin Peterson
// Version 1.0
//=============================================================================

/*:
 * @plugindesc Multiple Accessories including cursed items
 * @author Magnus0808
 *
 * @help If you use Yanfly Equip Core then put this after that one.
 * You can also make it so you cannot take an item of on normal means by
 * setting it as cursed. You do this by adding the note tag <cursed:true> to
 * the item.
 *
 * @param Default Equip Slots
 * @type Number[]
 * @desc This is the list of the default equip slots.
 * @default ["1","2","3","4","5"]
 *
 * @param Equip Multiple Of The Same Item
 * @type Boolean
 * @desc If false then you can only equip one of each item.
 * @default false
 *
 * @param Optimize With Cursed Items
 * @type Boolean
 * @desc If true then curesed items will also be used when optimizing.
 * @default false
 *
 * @param Ignore These Equipment Type When Optimizing
 * @type Number[]
 * @desc This is a list of Equipment Types that are not used when optimizing
 * @default ["5"]
 
 */
 
 
(function(){
   
    MultipleAccessories = {};
    MultipleAccessories.Parameters = PluginManager.parameters('MRP_MultipleAccessories');
    MultipleAccessories.equipSlots = JSON.parse(MultipleAccessories.Parameters['Default Equip Slots']);
    for(var i = 0; i < MultipleAccessories.equipSlots.length; i++){
        MultipleAccessories.equipSlots[i] = Number(MultipleAccessories.equipSlots[i]);
    }
    MultipleAccessories.optCursed = (String(MultipleAccessories.Parameters['Optimize With Cursed Items']) == 'true');
    MultipleAccessories.mulitiItems = (String(MultipleAccessories.Parameters['Equip Multiple Of The Same Item']) == 'true');
    MultipleAccessories.ignoreItems = JSON.parse(MultipleAccessories.Parameters['Ignore These Equipment Type When Optimizing']);
    for(var i = 0; i < MultipleAccessories.equipSlots.length; i++){
        MultipleAccessories.ignoreItems[i] = Number(MultipleAccessories.ignoreItems[i]);
    }
   
    // Changes to DataManager
    // Compatibility with yanfly equipcore
    DataManager.setDefaultEquipSlots = function(obj) {
        obj.equipSlots = MultipleAccessories.equipSlots;
    };
   
    // Changes to Game_Actor
    Game_Actor.prototype.equipSlots = function() {
        var slots;
        if(this.currentClass().equipSlots) { // Compatibility with yanfly equipcore
            slots = this.currentClass().equipSlots.slice();
        } else {
            slots = MultipleAccessories.equipSlots;
        }
        if (slots.length >= 2 && this.isDualWield()) {
            slots[1] = 1;
        }
        return slots;
    };
   
    Game_Actor.prototype.clearOptimizeEquipments = function() {
        var maxSlots = this.equipSlots().length;
        for (var i = 0; i < maxSlots; i++) {
            if(MultipleAccessories.ignoreItems.contains(this.equipSlots()[i])) continue;
            if (this.isEquipChangeOk(i)) {
                this.changeEquip(i, null);
            }
        }
    };
   
    Game_Actor.prototype.optimizeEquipments = function() {
        var maxSlots = this.equipSlots().length;
        this.clearOptimizeEquipments();
        for (var i = 0; i < maxSlots; i++) {
            if(MultipleAccessories.ignoreItems.contains(this.equipSlots()[i])) continue;
            if (this.isEquipChangeOk(i)) {
                this.changeEquip(i, this.bestEquipItem(i));
            }
        }
    };
   
    Game_Actor.prototype.bestEquipItem = function(slotId) {
        var etypeId = this.equipSlots()[slotId];
        var items = $gameParty.equipItems().filter(function(item) {
            return item.etypeId === etypeId && this.canEquip(item);
        }, this);
        var bestItem = null;
        var bestPerformance = -1000;
        for (var i = 0; i < items.length; i++) {
            if(!MultipleAccessories.optCursed && items[i].meta.cursed) continue;
            var performance = this.calcEquipItemPerformance(items[i]);
            if (performance > bestPerformance) {
                bestPerformance = performance;
                bestItem = items[i];
            }
        }
        return bestItem;
    };
   
    var MRP_MA_GA_CANEQUIP = Game_Actor.prototype.canEquip;
    Game_Actor.prototype.canEquip = function(item) {
        if(!MultipleAccessories.mulitiItems && this.isEquipped(item)) {
            return false;
        }
        return MRP_MA_GA_CANEQUIP.call(this, item);

    };
   
    var MRP_MA_GA_EQUIPCHANGEOK = Game_Actor.prototype.isEquipChangeOk;
    Game_Actor.prototype.isEquipChangeOk = function(slotId) {      
        var item = this.equips()[slotId];
        if(item && item.meta.cursed) return false;
       
        return MRP_MA_GA_EQUIPCHANGEOK.call(this, slotId);
    };
   
    Game_Actor.prototype.releaseUnequippableItems = function(forcing) {
        for (;;) {
            var slots = this.equipSlots();
            var equips = this.equips();
            var changed = false;
            for (var i = 0; i < equips.length; i++) {
                var item = equips[i];
                if (item && (!MRP_MA_GA_CANEQUIP.call(this, item) || item.etypeId !== slots[i])) {
                    if (!forcing) {
                        this.tradeItemWithParty(null, item);
                    }
                    this._equips[i].setObject(null);
                    changed = true;
                }
            }
            if (!changed) {
                break;
            }
        }
    };
   
    // "Changes" to Window_EquipSlot
    // This is just the default isEnabled no changes. However, yanfly EquipCore f**** it up so I have to include
    // it ín order for them to be compatible.
    Window_EquipSlot.prototype.isEnabled = function(index) {
        return this._actor ? this._actor.isEquipChangeOk(index) : false;
    };
   
})();
 

Attachments

  • MRP_MultipleAccessories.js
    5.3 KB · Views: 55
Last edited:

Gigadragon78

Veteran
Veteran
Joined
Feb 2, 2019
Messages
57
Reaction score
20
First Language
Spanish
Primarily Uses
RMMV
You dont need a plugin for this...
Just create a new entry in types,in my case hands and foots.
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
484
Reaction score
264
First Language
English
Primarily Uses
RMMZ
Made this for you. I even made it compatible with Yanfly's Equip Core in case someone wants to use it with that. However, it does not require it at all. It might not be the most polished plugin so if you encounter any bugs or flaws feel free to shoot me a message and I will fix it :)
You can set an item to be cursed by adding the note tag <cursed:true> to the item.

Code:
//=============================================================================
// Multiple Accessories
// MRP_MultipleAccessories.js
// By Magnus0808 || Magnus Rubin Peterson
// Version 1.0
//=============================================================================

/*:
 * @plugindesc Multiple Accessories including cursed items
 * @author Magnus0808
 *
 * @help If you use Yanfly Equip Core then put this after that one.
 * You can also make it so you cannot take an item of on normal means byte
 * setting it as cursed. You do this by adding the note tag <cursed:true> to
 * the item.
 *
 * @param Default Equip Slots
 * @type Number[]
 * @desc This is the list of the default equip slots.
 * @default ["1","2","3","4","5"]
 *
 * @param Equip Multiple Of The Same Item
 * @type Boolean
 * @desc If false then you can only equip one of each item.
 * @default false
 *
 * @param Optimize With Cursed Items
 * @type Boolean
 * @desc If true then curesed items will also be used when optimizing.
 * @default false
 */
 
 
(function(){
  
    MultipleAccessories = {};
    MultipleAccessories.Parameters = PluginManager.parameters('MRP_MultipleAccessories');
    MultipleAccessories.equipSlots = JSON.parse(MultipleAccessories.Parameters['Default Equip Slots']);
    for(var i = 0; i < MultipleAccessories.equipSlots.length; i++){
        MultipleAccessories.equipSlots[i] = Number(MultipleAccessories.equipSlots[i]);
    }
    MultipleAccessories.optCursed = (String(MultipleAccessories.Parameters['Optimize With Cursed Items']) == 'true');
    MultipleAccessories.mulitiItems = (String(MultipleAccessories.Parameters['Equip Multiple Of The Same Item']) == 'true');

    Game_Actor.prototype.equipSlots = function() {
        var slots;
        if(this.currentClass().equipSlots) { // Compatibility with yanfly equipcore
            slots = this.currentClass().equipSlots.slice();
        } else {
            slots = MultipleAccessories.equipSlots;
        }
        if (slots.length >= 2 && this.isDualWield()) {
            slots[1] = 1;
        }
        return slots;
    };
  
    Game_Actor.prototype.bestEquipItem = function(slotId) {
        var etypeId = this.equipSlots()[slotId];
        var items = $gameParty.equipItems().filter(function(item) {
            return item.etypeId === etypeId && this.canEquip(item);
        }, this);
        var bestItem = null;
        var bestPerformance = -1000;
        for (var i = 0; i < items.length; i++) {
            if(!MultipleAccessories.optCursed && items[i].meta.cursed) continue;
            var performance = this.calcEquipItemPerformance(items[i]);
            if (performance > bestPerformance) {
                bestPerformance = performance;
                bestItem = items[i];
            }
        }
        return bestItem;
    };
  
    // Compatibility with yanfly equipcore
    DataManager.setDefaultEquipSlots = function(obj) {
        obj.equipSlots = MultipleAccessories.equipSlots;
    };
  
    var MRP_MA_GA_CANEQUIP = Game_Actor.prototype.canEquip;
    Game_Actor.prototype.canEquip = function(item) {
        if(!MultipleAccessories.mulitiItems && this.isEquipped(item)) {
            return false;
        }
        return MRP_MA_GA_CANEQUIP.call(this, item);

    };
  
    // This is just the default isEnabled no changes. However, yanfly EquipCore f**** it up so I have to include
    // it ín order for them to be compatible.
    Window_EquipSlot.prototype.isEnabled = function(index) {
        return this._actor ? this._actor.isEquipChangeOk(index) : false;
    };
  
    var MRP_MA_GA_EQUIPCHANGEOK = Game_Actor.prototype.isEquipChangeOk;
    Game_Actor.prototype.isEquipChangeOk = function(slotId) {
        var item = this.equips()[slotId];
        if(item && item.meta.cursed) return false;
      
        return MRP_MA_GA_EQUIPCHANGEOK.call(this, slotId);
    };
  
    Game_Actor.prototype.releaseUnequippableItems = function(forcing) {
        for (;;) {
            var slots = this.equipSlots();
            var equips = this.equips();
            var changed = false;
            for (var i = 0; i < equips.length; i++) {
                var item = equips[i];
                if (item && (!MRP_MA_GA_CANEQUIP.call(this, item) || item.etypeId !== slots[i])) {
                    if (!forcing) {
                        this.tradeItemWithParty(null, item);
                    }
                    this._equips[i].setObject(null);
                    changed = true;
                }
            }
            if (!changed) {
                break;
            }
        }
    };
  
})();
It definitely works once I figured out setting the slot numbers, but the curse effect still locks all the accessory slots. Also, it doesn't exclude accessories from the Optimize function (which it should).

Why not just make 2 different equipment slots labelled Accessory 1 and 2?
You don't need a plugin for this...
Just create a new entry in types,in my case hands and foots.
By default, if you make additional accessory slots the editor still considers them to be separate slots. When you set up accessories, you have to set which equip slot they go to. That means that each accessory would have to go into a specific slot which means you would have to pick & choose between multiple accessories that go into the same slot. The propose of Yanfly's Equip Core & Magnus' plugin is that any additional accessory slots are all considered as the same type, allowing you to equip any accessory into any slot.
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
168
Reaction score
197
First Language
Danish
Primarily Uses
RMMV
That sounds odd. I just tested it again and it worked just fine. What did you set the parameters to?
Do you use any other plugins that might make it not work?
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
484
Reaction score
264
First Language
English
Primarily Uses
RMMZ
You can see for yourself:
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
168
Reaction score
197
First Language
Danish
Primarily Uses
RMMV
Hmm that really is weird. I dont have any programs to take a video on my computer so I just embedded an image showing it working.
OxmbWDo.png
You could probably make a fresh project, where the only plugin you use is mine, to test it out for yourself :)

I didn't catch that you wanted Accessories not to be included in the optimization at all. I'll add a parameter where you can choose which Equipment types not to use in the optimization. :) I'll add it when I figure out why the heck you're having issues with the plugin.

The way I handle only to lock the slot with the cursed item is by looking directly at the item in the slot during isEquipChangeOk and returning false if it is cursed, so it really shouldn't lock anything else. You have quite a few other plugins and while it doesn't seem like they should interfere with my plugin you never know :/ If you could send me zip with the plugins I'll check them for issues.

I have to sleep now as it is almost 4am here and I have to get up in about 4 hours. However, I will contuine working on this later today.
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
168
Reaction score
197
First Language
Danish
Primarily Uses
RMMV
Since it turned out that the issue was not with my plugin. Just that you forgot to remove the Lock Equipment trait from your item. I have updated the plugin to include the option to not use specific Equipment types when using the optimizing function. I set the default parameter to exclude Accessories :)
My original reply is updated with the plugin changes.
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
484
Reaction score
264
First Language
English
Primarily Uses
RMMZ
The locking effect is working now but I'm having another problem, one that I was having with Yanfly's Equip Core. If I equip some accessories & choose Optimize, it strips off all my accessories! Its one thing to not equip accessories when using Optimize but to have it strip off all accessories is absurd too! Do you think you can figure what causes it?
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
168
Reaction score
197
First Language
Danish
Primarily Uses
RMMV
Oh yeah I forgot about that! The optimize function calls clearEquipments. I have fixed it now so when optimizing it does not clear the Equipment which you have told not to be optimized :)
I have updated the plugin in my original response
 

Animebryan

Need more resources!
Veteran
Joined
Jul 31, 2012
Messages
484
Reaction score
264
First Language
English
Primarily Uses
RMMZ
Thanks! It works perfectly now.
 

Jathan

Veteran
Veteran
Joined
Jun 10, 2020
Messages
46
Reaction score
22
First Language
English
Primarily Uses
RMMV
Hey, @Magnus0808 what are the ToU on that plug-in? It's perfect for a commercial project I'm developing.
 

Magnus0808

Software Developer
Veteran
Joined
Feb 2, 2019
Messages
168
Reaction score
197
First Language
Danish
Primarily Uses
RMMV
Hey, @Magnus0808 what are the ToU on that plug-in? It's perfect for a commercial project I'm developing.
TERMS OF USE Copyright (c) 2019-2021 Magnus0808 || Magnus Rubin Peterson || Magnusrp0808
  • You are free to use it in commercial or non commercial RPG Maker MV projects if you credit me unless other is stated.
  • Please do not change the header of the plugin
    • Other than that you are allowed to make edits to the plugin
  • You are NOT allowed to sell the plugin itself even if you edited it.
  • You can share the plugins, however it is preferable if you link to this github.
 

Jathan

Veteran
Veteran
Joined
Jun 10, 2020
Messages
46
Reaction score
22
First Language
English
Primarily Uses
RMMV
TERMS OF USE Copyright (c) 2019-2021 Magnus0808 || Magnus Rubin Peterson || Magnusrp0808
  • You are free to use it in commercial or non commercial RPG Maker MV projects if you credit me unless other is stated.
  • Please do not change the header of the plugin
    • Other than that you are allowed to make edits to the plugin
  • You are NOT allowed to sell the plugin itself even if you edited it.
  • You can share the plugins, however it is preferable if you link to this github.
Thanks Magnus, great job making it by the way.
 

Latest Threads

Latest Posts

Latest Profile Posts

 …I think I might need to switch from standard ATK/DEF up/down buffs to parameter altering states. I just had an actor whose usual attack against an enemy does ~25 do a buffed attack against a debuffed enemy for ~600…
just saw that titan quest is free on steam until the 23rd
Zombie status is now complete. I didn't have to do much in the way of changing how healing is applied to undead targets, was just a simple 3 line code. I thought I had to overhaul Game_Action lol. Everything else was doable by events. So.. Zombie: You turn undead. Your element changes to darkness. You're weak to light, you're strong to physical attacks and healing hurts you and revival items will kill you.
My Overworld might be a mix of inspiration from 2D Final Fantasy games, Breath of Fire, Battlechasers: Nightwar, Super Mario World, and Pillars of Eternity. If I can make it more in-depth than just walking from point A to point B, that might do a lot for the gameplay experience. Hmm...

Forum statistics

Threads
115,225
Messages
1,088,218
Members
149,816
Latest member
RiyuDayo
Top