Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Guillaume777's Multi-Slot Equipment Script

within the equip window.
But I resolved it, because with about 14 different pieces of equipment on it doesn't show up very well in the status menu.
 
Hello Guys, i wondered how do i allow for example Bronze Sword Equipable to ANY slots available instead of only one.

In the default one it tells you Bronze Sword is only equipable to the 'Weapon' Slot, but what i need is it, to be equipable in any slots you got.

Can anyone help? Thanks.

----------

Like you created Bronze Shield, you can equip it in only the Shield slot, but is there some lines to make it equipable to all available slots?
You can even equip it to the Weapon slot, armor slot, arm pad slot, or whatever slot you got.
 
A weapon slot is a weapon slot, though you could have multiple weapon slots with this script. Likewise, shield slots are only shield slots. There aren't any allowances for a weapon to be equipped in an armor slot, nor helmets to be equipped in an armor or weapon slot.

You can establish multiple slots of whatever... but they can only hold their specifically denoted armor or shield. -_-

I understand where you're coming from. :-/ It would be nice if you could equip a sword in the 'shield' slot, and have it immediately change into a second 'sword' slot for your dual-wielding hero. It just won't happen THAT way.
 
So I've been using this script and I'm very impressed.

There's just one problem - There's no shop scripts that support this!

The basic shop, and several downloaded shop scripts I've tried, all seem to treat each piece of armor likw it belongs in it's regular slot, and ignores the (number) you put at the end of it to force it into a different slot. This is obviously because the shop scripts haven't been altered to comply with the multislot setup. I've tried several things in my shop scripts to make it work with this, failing each time.

Can somebody help out and tell me what needs to be altered?

Here's my current shop window code (courtesy of advo from phylomortis.com)

Code:
class Window_ShopStatus < Window_Base
  # ---------------------------------------
  def initialize
    super(368, 128, 272, 352)
    self.contents = Bitmap.new(width - 32, height - 32)
    self.contents.font.name = "Arial"
    self.contents.font.size = 24
    @item = nil
    @sprite1 = nil
    @sprite2 = nil
    @sprite3 = nil
    @sprite4 = nil
    @walk = [false, false, false, false]
    @count = 0
    refresh
  end
  # ---------------------------------------
  def refresh
    self.contents.clear
    if @sprite1 != nil
      @sprite1.dispose
      @sprite1 = nil
    end
    if @sprite2 != nil
      @sprite2.dispose
      @sprite2 = nil
    end
    if @sprite3 != nil
      @sprite3.dispose
      @sprite3 = nil
    end
    if @sprite4 != nil
      @sprite4.dispose
      @sprite4 = nil
    end
    self.contents.font.name = "Arial"
    self.contents.font.size = 24
    if @item == nil
      return
    end
    case @item
    when RPG::Item
      number = $game_party.item_number(@item.id)
    when RPG::Weapon
      number = $game_party.weapon_number(@item.id)
    when RPG::Armor
      number = $game_party.armor_number(@item.id)
    end
    self.contents.font.color = system_color
    self.contents.draw_text(4, 0, 200, 32, "Possessed:")
    self.contents.font.color = normal_color
    self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
    if @item.is_a?(RPG::Item)
      @walk = [false, false, false, false]
      return
    end
    for i in 0...$game_party.actors.size
      actor = $game_party.actors[i]
      if @item.is_a?(RPG::Weapon)
        item1 = $data_weapons[actor.weapon_id]
      elsif @item.kind == 0
        item1 = $data_armors[actor.armor1_id]
      elsif @item.kind == 1
        item1 = $data_armors[actor.armor2_id]
      elsif @item.kind == 2
        item1 = $data_armors[actor.armor3_id]
      else
        item1 = $data_armors[actor.armor4_id]
      end
      if not actor.equippable?(@item)
        @walk[i] = false
        draw_actor_graphic(actor, 380, 194 + 64 * i, i, 0)
        self.contents.font.name = "Arial"
        self.contents.font.size = 24
        self.contents.font.color = normal_color
        self.contents.draw_text(32, 54 + 64 * i, 150, 32, "Cannot Equip")
      end
      if actor.equippable?(@item)
        @walk[i] = true
        draw_actor_graphic(actor, 380, 194 + 64 * i, i, 1)
          atk1 = 0
          atk2 = 0
          eva1 = 0
          eva2 = 0
          str1 = 0
          str2 = 0
          dex1 = 0
          dex2 = 0
          agi1 = 0
          agi2 = 0
          int1 = 0
          int2 = 0
          pdf1 = 0
          pdf2 = 0
          mdf1 = 0
          mdf2 = 0
          eva1 = 0
          eva2 = 0
          str1 = item1 != nil ? item1.str_plus : 0
          str2 = @item != nil ? @item.str_plus : 0
          dex1 = item1 != nil ? item1.dex_plus : 0
          dex2 = @item != nil ? @item.dex_plus : 0
          agi1 = item1 != nil ? item1.agi_plus : 0
          agi2 = @item != nil ? @item.agi_plus : 0
          int1 = item1 != nil ? item1.int_plus : 0
          int2 = @item != nil ? @item.int_plus : 0
          pdf1 = item1 != nil ? item1.pdef : 0
          pdf2 = @item != nil ? @item.pdef : 0
          mdf1 = item1 != nil ? item1.mdef : 0
          mdf2 = @item != nil ? @item.mdef : 0
        if @item.is_a?(RPG::Weapon)
          atk1 = item1 != nil ? item1.atk : 0
          atk2 = @item != nil ? @item.atk : 0
        end
        if @item.is_a?(RPG::Armor)
          eva1 = item1 != nil ? item1.eva : 0
          eva2 = @item != nil ? @item.eva : 0
        end
        str_change = str2 - str1
        dex_change = dex2 - dex1
        agi_change = agi2 - agi1
        int_change = int2 - int1
        pdf_change = pdf2 - pdf1
        mdf_change = mdf2 - mdf1
        atk_change = atk2 - atk1
        eva_change = eva2 - eva1
        if item1 == nil
          name1 = ""
        else
          name1 = item1.name
        end
        if @item == nil
          name2 = ""
        else
          name2 = @item.name
        end
        if str_change == 0 && dex_change == 0 && agi_change == 0 && 
        pdf_change == 0 && mdf_change == 0 && atk_change == 0 &&
        eva_change == 0 && name1 != name2
          self.contents.draw_text(32, 54 + 64 * i, 150, 32, "No Change")
        end
        if name1 == name2
          self.contents.draw_text(32, 54 + 64 * i, 200, 32, "Currently Equipped")
        end
        self.contents.font.name = "Arial"
        self.contents.font.size = 16
        self.contents.font.color = normal_color
        if @item.is_a?(RPG::Weapon) && atk_change != 0
          self.contents.draw_text(32, 42 + 64 * i, 32, 32, "ATK")
        end
        if @item.is_a?(RPG::Armor) && eva_change != 0
          self.contents.draw_text(32, 42 + 64 * i, 32, 32, "EVA")
        end
        if pdf_change != 0
          self.contents.draw_text(32, 58 + 64 * i, 32, 32, "PDF")
        end
        if mdf_change != 0
          self.contents.draw_text(32, 74 + 64 * i, 32, 32, "MDF")
        end
        if str_change != 0
          self.contents.draw_text(112, 42 + 64 * i, 32, 32, "STR")
        end
        if dex_change != 0
          self.contents.draw_text(112, 58 + 64 * i, 32, 32, "DEX")
        end
        if agi_change != 0
          self.contents.draw_text(112, 74 + 64 * i, 32, 32, "AGI")
        end
        if str_change != 0
          self.contents.draw_text(192, 42 + 64 * i, 32, 32, "INT")
        end
        if @item.is_a?(RPG::Weapon) && atk_change > 0
          self.contents.font.color = up_color
          s = atk_change.abs.to_s
          self.contents.draw_text(60, 42 + 64 * i, 4, 32, "+")
          self.contents.draw_text(62, 42 + 64 * i, 24, 32, s, 2)
        end
        if @item.is_a?(RPG::Weapon) && atk_change < 0
          self.contents.font.color = down_color
          s = atk_change.abs.to_s
          self.contents.draw_text(60, 42 + 64 * i, 4, 32, "-")
          self.contents.draw_text(62, 42 + 64 * i, 24, 32, s, 2)
        end
        if @item.is_a?(RPG::Armor) && eva_change > 0
          self.contents.font.color = up_color
          s = eva_change.abs.to_s
          self.contents.draw_text(60, 42 + 64 * i, 4, 32, "+")
          self.contents.draw_text(62, 42 + 64 * i, 24, 32, s, 2)
        end
        if @item.is_a?(RPG::Armor) && eva_change < 0
          self.contents.font.color = down_color
          s = eva_change.abs.to_s
          self.contents.draw_text(60, 42 + 64 * i, 4, 32, "-")
          self.contents.draw_text(62, 42 + 64 * i, 24, 32, s, 2)
        end
        if pdf_change > 0
          self.contents.font.color = up_color
          s = pdf_change.abs.to_s
          self.contents.draw_text(60, 58 + 64 * i, 4, 32, "+")
          self.contents.draw_text(62, 58 + 64 * i, 24, 32, s, 2)
        end
        if pdf_change < 0
          self.contents.font.color = down_color
          s = pdf_change.abs.to_s
          self.contents.draw_text(60, 58 + 64 * i, 4, 32, "-")
          self.contents.draw_text(62, 58 + 64 * i, 24, 32, s, 2)
        end
        if mdf_change > 0
          self.contents.font.color = up_color
          s = mdf_change.abs.to_s
          self.contents.draw_text(60, 74 + 64 * i, 4, 32, "+")
          self.contents.draw_text(62, 74 + 64 * i, 24, 32, s, 2)
        end
        if mdf_change < 0
          self.contents.font.color = down_color
          s = mdf_change.abs.to_s
          self.contents.draw_text(60, 74 + 64 * i, 4, 32, "-")
          self.contents.draw_text(62, 74 + 64 * i, 24, 32, s, 2)
        end
        if str_change > 0
          self.contents.font.color = up_color
          s = str_change.abs.to_s
          self.contents.draw_text(140, 42 + 64 * i, 4, 32, "+")
          self.contents.draw_text(142, 42 + 64 * i, 24, 32, s, 2)
        end
        if str_change < 0
          self.contents.font.color = down_color
          s = str_change.abs.to_s
          self.contents.draw_text(140, 42 + 64 * i, 4, 32, "-")
          self.contents.draw_text(142, 42 + 64 * i, 24, 32, s, 2)
        end
        if dex_change > 0
          self.contents.font.color = up_color
          s = dex_change.abs.to_s
          self.contents.draw_text(140, 58 + 64 * i, 4, 32, "+")
          self.contents.draw_text(142, 58 + 64 * i, 24, 32, s, 2)
        end
        if dex_change < 0
          self.contents.font.color = down_color
          s = dex_change.abs.to_s
          self.contents.draw_text(140, 58 + 64 * i, 4, 32, "-")
          self.contents.draw_text(142, 58 + 64 * i, 24, 32, s, 2)
        end
        if agi_change > 0
          self.contents.font.color = up_color
          s = agi_change.abs.to_s
          self.contents.draw_text(140, 74 + 64 * i, 4, 32, "+")
          self.contents.draw_text(142, 74 + 64 * i, 24, 32, s, 2)
        end
        if agi_change < 0
          self.contents.font.color = down_color
          s = agi_change.abs.to_s
          self.contents.draw_text(140, 74 + 64 * i, 4, 32, "-")
          self.contents.draw_text(142, 74 + 64 * i, 24, 32, s, 2)
        end
        if int_change > 0
          self.contents.font.color = up_color
          s = int_change.abs.to_s
          self.contents.draw_text(214, 42 + 64 * i, 4, 32, "+")
          self.contents.draw_text(216, 42 + 64 * i, 24, 32, s, 2)
        end
        if int_change < 0
          self.contents.font.color = down_color
          s = int_change.abs.to_s
          self.contents.draw_text(214, 42 + 64 * i, 4, 32, "-")
          self.contents.draw_text(216, 42 + 64 * i, 24, 32, s, 2)
        end
      end
    end
  end
  # ---------------------------------------
  def item=(item)
    if @item != item
      @item = item
      refresh
    end
  end
  # ---------------------------------------
  def draw_actor_graphic(actor, x, y, id, tone_id)
    if id == 0
      @v1 = Viewport.new(380, 194, 32, 48)
      @v1.z = 9998
      @sprite1 = Sprite.new(@v1)
      @sprite1.bitmap = RPG::Cache.character(actor.character_name, 
      actor.character_hue)
      if tone_id == 0
        @sprite1.tone = Tone.new(0, 0, 0, 255)
      else
        @sprite1.tone = Tone.new(0, 0, 0, 0)
      end
      @sprite1.visible = true
    end
     if id == 1
      @v2 = Viewport.new(380, 258, 32, 48)
      @v2.z = 9999
      @sprite2 = Sprite.new(@v2)
      @sprite2.bitmap = RPG::Cache.character(actor.character_name, 
      actor.character_hue)
      if tone_id == 0
        @sprite2.tone = Tone.new(0, 0, 0, 255)
      else
        @sprite2.tone = Tone.new(0, 0, 0, 0)
      end
      @sprite2.visible = true
    end
     if id == 2
      @v3 = Viewport.new(380, 322, 32, 48)
      @v3.z = 9999
      @sprite3 = Sprite.new(@v3)
      @sprite3.bitmap = RPG::Cache.character(actor.character_name, 
      actor.character_hue)
      if tone_id == 0
        @sprite3.tone = Tone.new(0, 0, 0, 255)
      else
        @sprite3.tone = Tone.new(0, 0, 0, 0)
      end
      @sprite3.visible = true
    end
    if id == 3
      @v4 = Viewport.new(380, 386, 32, 48)
      @v4.z = 9999
      @sprite4 = Sprite.new(@v4)
      @sprite4.bitmap = RPG::Cache.character(actor.character_name, 
      actor.character_hue)
      if tone_id == 0
        @sprite4.tone = Tone.new(0, 0, 0, 255)
      else
        @sprite4.tone = Tone.new(0, 0, 0, 0)
      end
      @sprite4.visible = true
    end
  end
  # ---------------------------------------
  def update
    super
    @count += 1
    for i in 0..@walk.size
        if @walk[i] == false
        case i
          when 0
            if @sprite1 != nil
            @sprite1.ox = 0
            end
          when 1
            if @sprite2 != nil
            @sprite2.ox = 0
            end
          when 2
            if @sprite3 != nil
            @sprite3.ox = 0
            end
          when 3
            if @sprite4 != nil
            @sprite4.ox = 0
            end
          end
        end
      end
    if @count == 0
      for i in 0..@walk.size
        if @walk[i] == true
        case i
        when 0
          if @sprite1 != nil
          @sprite1.ox = 0
          end
        when 1
          if @sprite2 != nil
          @sprite2.ox = 0
          end
        when 2
          if @sprite3 != nil
          @sprite3.ox = 0
          end
        when 3
          if @sprite4 != nil
          @sprite4.ox = 0
            end
          end
        end
      end
    end
    if @count == 5
      for i in 0..@walk.size
        if @walk[i] == true
        case i
        when 0
          if @sprite1 != nil
          @sprite1.ox = 32
          end
        when 1
          if @sprite2 != nil
          @sprite2.ox = 32
          end
        when 2
          if @sprite3 != nil
          @sprite3.ox = 32
          end
        when 3
          if @sprite4 != nil
          @sprite4.ox = 32
            end
          end
        end
      end
    end
    if @count == 10
      for i in 0..@walk.size
        if @walk[i] == true
          case i
        when 0
          if @sprite1 != nil
          @sprite1.ox = 64
          end
        when 1
          if @sprite2 != nil
          @sprite2.ox = 64
          end
        when 2
          if @sprite3 != nil
          @sprite3.ox = 64
          end
        when 3
          if @sprite4 != nil
          @sprite4.ox = 64
            end
          end
        end
      end
    end
    if @count == 15
      @count = 0
    end
  end
end

Also, you have to add these to Window_Base for this to work:

Code:
def up_color
    return Color.new(74, 210, 74)
  end
  # --------------------------------
  def down_color
    return Color.new(170, 170, 170)
  end

Thanks in advance to anybody who attempts this!
 
Um... Is there any way that you could combine this with Mr Mos ABS? As in, if you have a bow equiped in the left hand and a sword in the right, then you can use both attacks?
 
To Dissonance:
Dunno if anyone thought about it... If... I figure it out... though I didn't write this crazy thing... Posted it, sure. figured out how it works... heck no.

*cracks open book*

To Jonathan:
Was made more for the battlesystem that came with RMXP. Sorry. Now, if someone codes in a Mr.Mo patch for dual-wielding...
 

Z-Man

Member

Could anyone direct me to where in the script I define which characters can use which types of equipment slots.

I set up the slots themselves just fine, but let's say I have:

weapon, weapon, shield, helmet, armor, accessory, ring

Now I want a typical swordsman to only have:

weapon, shield, helmet, armor, accessory

a mage to have:

weapon, ring, helmet, armor, accessory

and a fist fighter to have:

weapon, weapon, helmet, armor, accessory

Where exactly would I go to define these things? I don't want every single character having the double weapon abilities or all of the slots.

Oh, and I almost forgot... I have an archer and want his primary weapon to be a bow and then require him to have an arrow as an off-hand. How do I setup arrows so that they're off-hand weapons only and can only be used with bows. I set the bows to require off-hands, but I don't know how to define a weapon as being off-hand.
 
The DEMO in the 1st page actually shows map event coding on how to accomplish this task. It's no biggie, but one of the characters actually gives Aluxes TWO heads for two different helmet slots. (Yeeeeesh!)

As far as requiring ARROWS for a bow, lemme suggest looking for Taryn's Weapon Ammunition System which was designed for just such a thing (that and guns!). And when you run out of ammo, to select a new weapon, try Eladia's Battle Equipment Menu
 

Z-Man

Member

Well, I saw the ammunition system, but that seemed more targetted to bullets/guns. I don't like the whole idea of having to load a clip of so many bullets to the gun. That doesn't work well for bow and arrow.

I don't really even care if the number of arrows are limited/run out. I want the arrows to just be an auxillary weapon that works with the bow and you need both parts to actually make your attack.
 

Z-Man

Member

Okay, I have another problem now. I ran the demo to get an idea of how to call script in an event to define what a character can and can't use, but upon running the game now, I get this error:

"ArgumentError occurred while running script.

wrong number of arguments(4 for 2)"

Any idea why it gives me that?
 
Not without knowing what statement was called, and how it was called... and what line is in error.

Getting late on my end, and I'm due for another 12-hour shift tomorrow.

-G'night
 

Z-Man

Member

I gave you all the information it gave me. There was no line specified in the error message.

All I can tell you is the script I inserted:

$game_actors[1].weapon_slots[0]
$game_actors[1].armor_slots[1,2,3,4]
 
Almost had it...
Code:
$game_actors[1].weapon_slots = [0]
$game_actors[1].armor_slots = [1,2,3,4]

Good thing I popped in to say 'Good Job to Trickster, eh?' Talk about timing!!!

Hope this helps.

-G'night.
 

Z-Man

Member

Oh wow... what a silly mistake. I probably just did that because it was late.

Thanks a lot. This is a really great script and will be very helpful to my game. I just had one question/thought...

I noticed that the script was setup so that you could actually make weapon attributes (elements) for 2handed weapons and multiple-attacking weapons and assign the weapons to that. I thought that was a very good idea so that you don't have to script in every item or alter the attack names. I just would like to see that expanded a bit.

How would I go about making it so that you could create a "Cursed" element and have that recognized as being cursed (I don't want to put it in the name)?

Also, I'd like to be able to create elements for the additional equipment slots (like elements named "5", "6", etc...) and when assigning equipment to those slots, the game would categorize them appropriately. This way the number doesn't have to show in the weapon's name (because I think that would be confusing to the player).
 
Well, this is pretty much a final version as Guillaume777 hasn't worked on any more versions of it. He's not a member her, and hasn't updated his script beyond version 4 over in Creation Asylum. Pretty much dropped off the face of the RMXP earth since RMXP.net went down.

As far as element tagging 'cursed' items... nope. But, you can add "(cursed)) into the Weapon's/Armor's name, like Short Sword(cursed) or you can enter their IDs into either the CURSED_WEAPONS or CURSED_ARMORS array.

As far as the additional equipment slots... 'fraid you have to put in the (5), (6), or whatever into the armor names as well... There is no way to get around that.

BUT, the number doesn't SHOW in the item's name either. Look at the guys in the demo when it starts off. They already have the extra slots for Boots and such, and the numbers don't show in the item names. It's already taken care of for you. Weapons don't need numbers in their names as they just use the weapon slots.
 

Z-Man

Member

Like I said, I don't want to put stuff in parenthesis in the item's name. I know for cursed items, I can just do a swap so they don't see "(cursed)" until after it's equiped, so I guess that takes care of that.

My only concern was the (5) and (6) showing. But if you say it doesn't, I guess everything is fine.

I'm sure I CAN get it so that I can make a cursed element tag, I just have to pick apart the code to make the tag actually mean something. When I have more time, I might look into that and share it if anyone else is interested. I was just hoping that someone else already knew or could point me in the right direction to get started.

I know I'd add:

CURSED_ELEMENT = 'cursed'

to the first part of the script below the CURSED_STRING definition, but I'd have to go through one of the other parts to actually have that mean something to the game.
 
Eh... you won't see (cursed) in the item's name either... so even if you don't swap 'em... it's covered. All the (whatevers) in the script are covered. Just wanted to point that out. ;)

Good luck with the 'edit' you're thinking about. If you do create a script to allow for element-tagging of cursed items... and make it available plug'n'play (like pasting it below this script)... lemme know. :D
 

Z-Man

Member

I'm kinda lazy, so I probably won't do it if it doesn't show anyway... but if I'm bored I'll look into it.

I'm not good at making plug'n'play scripts, though. I generally just modify scripts to my needs. At the most, I'd only be able to tell you what to modify to do it.

Besides, it's not really significant enough to make a whole new script over and pretend that I did something special. All I'm doing is making a minor modification to a system that's really fine as is already.
 
DerVVulfman;187888 said:
Well, this is pretty much a final version as Guillaume777 hasn't worked on any more versions of it. He's not a member her, and hasn't updated his script beyond version 4 over in Creation Asylum. Pretty much dropped off the face of the RMXP earth since RMXP.net went down.

In this case would Tricksters multi-equip script be a good alternative?
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top