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.

Show equipped items in the item list

This is a simple request (I think), but I just can't figure it out.

I want my equipped items (weapon and armors) to show up in my item list. I assume there's something in the default script I can find and modify to make this happen, but I just can't figure out where. If someone could point me in the right direction, I would greatly appreciate it.
 

Atoa

Member

It would be harder than you think

The equip is removed from the iventory so it can't be equiped by other actors.

If i'm not wrong the method that removes the equiped weapon from inventary, and add it back when removed is the "def equip" from Game_Actor.

But you would need an whole new method to check if the weapon is equiped by an actor, so other actors can't equip it
 
The extra method to check if the weapon is equipped by another actor shouldn't be an issue in the game I'm making because it will only have one character.

I looked at "def equips" in Game Actor, and I'm not quite sure what I would edit to get the items to appear. I was wondering if what I was looking for wasn't, perhaps, in the $data_weapons and $data_armors sections, and just not accessable in the script editor. Those two areas are relied upon in the "def equips" section, it looks like. The only other guess I had was if it was buried in the game interpreter section somewhere.
 
Code:
class Game_Party

  alias_method :seph_equipitemnumber_gmprty_in, :item_number

  def item_number(item)

    n = seph_equipitemnumber_gmprty_in(item)

    if item.is_a?(RPG::Weapon) || item.is_a?(RPG::Armor)

      for actor in members

        n += 1 if actor.equips.include?(item)

      end

    end

    return n

  end

end

Just insert above Main
 
@Sephiroth Spawn:

I put in that script above main, and I get an error that says:

line 2: NameError occured
undefined method 'number' for class 'Game_Party'

What can I do to fix that? Thanks for your help.
 
@Sephiroth Spawn:

Thanks for the help. I didn't end up using your exact script, but it pointed me in the right direction to make it do what I wanted.

I noticed with your script above, every time I would equip and unequip an item, the amount of the item I had kept going up. I'm not sure what caused that.

What I ended up doing was going to $game_party.items and changing the part where is says to get weapons and armor if "> 0" to "> -1". That seemed to do the trick. The only problem I ran into with that is that it will not show the items you have initially equipped until you've unequipped them at least once. I figure I can side step this by not having any items initially equiped (which I planned on doing anyway as the starting scene was in a dungeon).

Like I said, thank you. I wouldn't have figured out what do to if I hadn't seen what your script was doing.
 

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