Zetu Mainhand Breaks Item Usage

So I picked up this script by Zetu a while back.  It allows you to set a weapon with a notetag that identifies the weapon as "Mainhand Only".  This is to prevent the useage of weapons as dual-wield that were not intended to be.

Example, a character can build a Tank role or a Damage role.  As a Tank, she uses a Polehammer and a Shield.  As a DPS role, she equips a Claw (which unlocks her Dual Wield 2nd Weapon Slot) and another Claw.  While the 1st Claw is equipped, she could equip a Polehammer in the 2nd Weapon Slot, resulting in a Claw+Polehammer combination that is not intended, as Polehammer+Claw would be an invalid equip loadout.  The Polehammer in this example is set to Mainhand Only.

Here is the script, it's extrememly short:

#There was no header for this so I'll write one. This script was written#by Zetu. Weapons can be notetagged with <mainhand> or <offhand> to prevent#unintentional weapon combinations when Dual Wield is active.class RPG::EquipItem < RPG::BaseItem def offhandrating self.note.scan(/<offhand\s*exaust[:]*\s*(\d*)>/){return $1.to_f} return 1.0 end def mainhand return true unless self.is_a?(RPG::Weapon) self.note.scan(/<mainhand>/){return true} self.note.scan(/<offhand>/){return false} return true end def offhand return true unless self.is_a?(RPG::Weapon) self.note.scan(/<offhand>/){return true} self.note.scan(/<mainhand>/){return false} return true endendclass Window_EquipItem < Window_ItemList alias :zsnipi :include? def include?(item) return false unless zsnipi item return true if item.nil? return false if !item.mainhand and @slot_id == 0 return false if !item.offhand and @slot_id == 1 return true endendclass Game_Actor < Game_Battler def param_plus(param_id) sum = 0 for i in 0...equips.size next if (equip=equips).nil? rating = (i==1 and equip.is_a? RPG::Weapon) ? equip.offhandrating : 1.0 sum += (equip.params[param_id]*rating).to_i end return sum endendclass NilClass def id 0 endendThe problem with this script, is that it breaks items and events that attempt to increase your parameters, even in a fresh project with no other scripts installed.  In a fresh project with only this script, the default item 9 "Life Up" which raises MaxHP by 50, does absolutely nothing.  The same goes for Events.  If an Event attempts to increase an actor's parameters, it does absolutely nothing.

What is it about this script that is breaking stuff?  Is there a way to fix this?
Its because the script overwrites param_plus, which is used for many stat gains. Honestly, I'd be surprised if states even work correctly due to that overwrite.
I can't believe this worked.  I just made up some alternate names for that stuff

class Game_Actor < Game_Battler def mainhand_plus(mainhand_id) sum = 0 for i in 0...equips.size next if (equip=equips).nil? rating = (i==1 and equip.is_a? RPG::Weapon) ? equip.offhandrating : 1.0 sum += (equip.params[mainhand_id]*rating).to_i end return sum endendIssue solved!  Thanks!
Nice idea, but what actually calls and uses that function? The param_plus code is so that the weapons properly update their stats, and changing the names means nothing is going to call it unless you change the name in everything in the entire game. Without that chances are your stats will not properly update when you equip things.
You simply put <mainhand> in the weapon notetag.  Now a mainhand weapon can't be equipped in the 2nd weapon slot.

There's still the issue of the second weapon slot not reverting back to a shield slot though.  I'm at the common phase of VXA development where I have to deal with the crappy dual wield mechanics of VXA not working the way I want them to.  I've tried Fomar's Free Hands, and that's almost good except that extra equipment slots added via class changes do not do anything; actors are stuck with whatever equip slots are assigned to them in Fomar's script.  So I'm looking for other solutions.  I'll probably just end up giving the tank dps option a 2 hand weapon instead, but I really wanted to use dual claws.
Got it.  She even gets access to all three types.  Claws will be divided into two types, R.Claw and L.Claw.  That makes sense, they're like gloves or something.

The 1-handed Polehammer, 2-handed Morningstar, and R.Claw will be notetagged with <mainhand>.  Additionally, the R.Claw will enable Dual Wield.  The L.Claw, now separate from R.Claw, will be notetagged with <offhand>, and no longer enables Dual Wield.

What this means is that the L.Claw can not be equipped without a R.Claw, which turns the Shield Slot into a second Weapon Slot which the L.Claw can fit into.  The Polehammer and Morningstar cannot go into the 2nd Weapon Slot.  If the R.Claw is replaced with a Polehammer or Morningstar, the L.Claw is automatically dropped as the slot reverts to a Shield Slot.

Finally, dual wielding the Polehammer in any combination is no longer possible, despite it being a 1-handed weapon.  It is only intended to be used with a Shield.

Character stats do go up upon equip, so don't worry about that.  Thread Close plz.

Original thread: https://forums.rpgmakerweb.com/threads/zetu-mainhand-breaks-item-usage.35441/