• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

updating item icon in Pokemon Storage

  • 70
    Posts
    19
    Years
    hello everyone, yeah it's me again.

    I'm updating the PokemonStorage-Script and I want to show the item icon next to the itemname. Again it works good, except one thin. When you switching the pokémon in the box, the item icon don't dispose before and the new icon is overlapping the old icon. I think I must put somewhere an .update or .dispose command, but I don't know where.

    The icon is called by @sprites["icon"], if this would be a matter.

    And what would be the best way to put a pokemon icon next to the pokemon name for the actual selected pokemon? I know this would be a little useless, because the storagebox already shows the icons of the stored pokemon, but I think also this would be nice anyway.
     
    It doesn't workin... Well, m problem is not that the icon doesn't appear, but the old icon doesn't dissapear, if the item icon is updating. It overlapping it instead.

    Here's the the script, that shows the item icon:

    Code:
        if pokemon.item>0
        @sprites["icon"].dispose if @sprites["icon"]
        filename=sprintf("Graphics/Icons/item%03d",pokemon.item)
        @sprites["icon"]=IconSprite.new(16,404,@viewport)
        @sprites["icon"].setBitmap(filename)
          itemname=PBItems.getName(pokemon.item)
        end

    Edit: If I put " @sprites["icon"].dispose if @sprites["icon"]" before my code, the items don't overlapping anymore, but they still visible even if the user doesn't held a item.
     
    Last edited:
    It doesn't workin... Well, m problem is not that the icon doesn't appear, but the old icon doesn't dissapear, if the item icon is updating. It overlapping it instead.

    Here's the the script, that shows the item icon:

    Code:
        if pokemon.item>0
        @sprites["icon"].dispose if @sprites["icon"]
        filename=sprintf("Graphics/Icons/item%03d",pokemon.item)
        @sprites["icon"]=IconSprite.new(16,404,@viewport)
        @sprites["icon"].setBitmap(filename)
          itemname=PBItems.getName(pokemon.item)
        end

    Edit: If I put " @sprites["icon"].dispose if @sprites["icon"]" before my code, the items don't overlapping anymore, but they still visible even if the user doesn't held a item.
    Put an "else" in you 'if' with the line '@sprites["icon"].visible=false if @sprites["icon"]'
     
    If I try this I get an error, when i switch to a pokémon that held a item.

    Spoiler:

    The changed line is

    @sprites["icon"].dispose if @sprites["icon"] else @sprites["icon"].visible=false if @sprites["icon"]

    I think I do it wrong. Sorry, I'm a little bit gawky.
     
    Back
    Top