• 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 Conquest 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.

[Question] Pokemon Essentials: Creating an item that displays a picture.

  • 12
    Posts
    2
    Years
    • Seen Oct 9, 2022
    I'm trying to create at item that, when used from the bag or quick select, fades in to a picture in my graphics folder for a few seconds then fades out back to the bag or back to the overworld, whatever is easiest. I've tried looking at the Town Map for clues on how to code this but the Town Map has a lot of extra code attached to it, like dealing with flying, displaying different towns and routes, leaving messages on certain spots, etc. So far what I have is an item that, when used, will display the image but only after I've left the bag menu. I can still walk around and the image just stays there indefinitely.

    Here is my code:

    ItemHandlers::UseFromBag.add(:IMAGE, proc { |item|
    $game_screen.pictures[1].show('Image', :CENTER, 250, 200, zoomX = 100, zoomY = 100, opacity = 255, blendType = 0)
    })

    Any help would be appreciated.
     
    Which version of Essentials?
    I did something similar.

    Code:
    ItemHandlers::UseFromBag.add(:IMAGE, proc { |item|
    	viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) # Not sure what that is, but it's mandatory apparently.
      sprites = {} # Always use an Hash.
      
      pbFadeOutIn {
        sprites["image"] = IconSprite.new(viewport)
        sprites["image"].setBitmap("Graphics/Pictures/GTS/bar2")
        sprites["image"].x = Graphics.width / 2 # Center the image.
        sprites["image"].x -= sprites["image"].bitmap.width / 2
        sprites["image"].y = 0 # set the position as you wish.
      }
      
      loop do 
        Graphics.update
        Input.update
        break if Input.trigger?(Input::B)
      end 
      
      pbFadeOutAndHide(sprites)
      pbDisposeSpriteHash(sprites)
    })

    It's not tested but I think it's a good base.
     
    Hello, thank you for your help. I am using v20.1. Not working but I think it because I'm doing something wrong.

    What I have is:


    ItemHandlers::UseFromBag.add(:(name of item in bag), proc { |item|
    viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) # Not sure what that is, but it's mandatory apparently.
    sprites = {(does anything go here?)} # Always use an Hash.

    pbFadeOutIn {
    sprites["image"] = IconSprite.new(viewport)
    sprites["image"].setBitmap("Graphics/Pictures/(name of image in folder)")
    sprites["image"].x = Graphics.width / 2 # Center the image.
    sprites["image"].x -= sprites["(not sure what goes here. I tried it with "image" and the name of the image in the folder)"].bitmap.width / 2
    sprites["image"].y = 0 # set the position as you wish.
    }

    loop do
    Graphics.update
    Input.update
    break if Input.trigger?(Input::B)
    end

    pbFadeOutAndHide(sprites)
    pbDisposeSpriteHash(sprites)
    })



    When I tried this.


    ItemHandlers::UseFromBag.add(:BRAILLEPAGE, proc { |item|
    viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) # Not sure what that is, but it's mandatory apparently.
    sprites = {} # Always use an Hash.

    pbFadeOutIn {
    sprites["image"] = IconSprite.new(viewport)
    sprites["image"].setBitmap("Graphics/Pictures/Braille")
    sprites["image"].x = Graphics.width / 2 # Center the image.
    sprites["image"].x -= sprites["image"].bitmap.width / 2
    sprites["image"].y = 0 # set the position as you wish.
    }

    loop do
    Graphics.update
    Input.update
    break if Input.trigger?(Input::B)
    end

    pbFadeOutAndHide(sprites)
    pbDisposeSpriteHash(sprites)
    })

    I get an Exeption: Type Error
    Message: no implicit conversion of Integer into Hash.

    I tried a couple different variations. tried replaceing "image" with the name of the name of the image in the folder. I usually get the "no implicit conversion of Integer into Hash" message.
     
    You may want to take a look at this thread. I answered it recently for v20.1. Its the same concept, except it uses an item to call a Common Event that calls an image.

    https://www.pokecommunity.com/threads/481144

    The reason why it uses a Common event is because there is already a "Show Picture" script in the events options, making it a little easier to use then coding a whole new script.
     
    You absolute badass. Thank you so much for this. At first I didn't know what a Common Event was(It's in the Database window, next to Tilesets, for those who didn't know). That seems like an awesome tool to use.
    And thank you to StCooler for your help too. It is always nice to see people try to help someone just for the sake of helping out.

    Here is my code for anyone who needs an example:

    ItemHandlers::UseFromBag.add(:(name of item in inventory), proc { |item|
    next 2
    })

    ItemHandlers::UseInField.add(:(name of item in inventory), proc { |item|
    pbCommonEvent(number of Common Event in the Database window)
    next true
    })

    And then my Common Event just consists of the Show Picture command, Wait 100 frames command, and then the Erase Picture command.

    Thanks again you guys.
     
    Back
    Top