• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Displaying the quantity of key items

Guest123123

Guest
0
Posts
    The key items pocket in the bag doesn't list how many of a certain item you have. I assume this is because for most key items, like the Bicycle and rod types, there are only one.

    I do have a key item of which there are multiple. I use a variable whenever one is obtained so the game knows how many a player has, but players can't see this information themselves due to key items not displaying the number. Originally I assumed this is just how the key items pocket works and there's no way around it, but I have noticed in some fangames that the number of certain key items does show. Would anyone know how I would go about making the number visible for this key item of which there are multiple?

    Apologies in advance if this question was already answered somewhere. I don't believe I saw it mentioned in the "Defining an item" page on the wiki.
     
    59
    Posts
    8
    Years
    • Seen Aug 9, 2020
    I did this a while ago myself, so feel free to use this. (Replace inside the class Window_PokemonBag) Replace "YOURITEM" with its internal name.
    Code:
    def drawItem(index,count,rect)
        textpos=[]
        rect=drawCursor(index,rect)
        ypos=rect.y+4
        if [email protected][self.pocket].length
          textpos.push([_INTL("CLOSE BAG"),rect.x,ypos,false,
             self.baseColor,self.shadowColor])
        else
          [email protected][self.pocket][index][0]
          [email protected](item)
          qty=_ISPRINTF("x{1: 2d}",@bag.pockets[self.pocket][index][1])
          sizeQty=self.contents.text_size(qty).width
          xQty=rect.x+rect.width-sizeQty-16
          baseColor=(index==@sortIndex) ? Color.new(0,0,0) : self.baseColor
          shadowColor=(index==@sortIndex) ? Color.new(168,184,184) : self.shadowColor
          textpos.push([itemname,rect.x,ypos,false,baseColor,shadowColor])
          if !pbIsImportantItem?(item)|| item==PBItems::YOURITEM 
            textpos.push([qty,xQty,ypos,false,baseColor,shadowColor])
          end
        end
        pbDrawTextPositions(self.contents,textpos)
        if [email protected][self.pocket].length
          if @[email protected][self.pocket][index][0]
            pbDrawImagePositions(self.contents,[
               ["Graphics/Pictures/bagReg",rect.x+rect.width-58,ypos+4,0,0,-1,-1]
            ])
          end
        end
      end
     
    Back
    Top