Help - Search - Members - Calendar
Full Version: Showing Picture of Item
RPG RPG Revolution Forums > Game Engines > RPG Maker XP Discussion
revolverwinds
happy.gif ,

I've been trying to create a feature where an item, upon being clicked on from the menu, shows an illustrated picture of that item which stops other events and can then be exited upon pressing a button. Anyone have an event system they can share that functions similarly? Thank you in advance.
Jens of Zanicuud
I feel this is impossible by event processing. You need a script, since when you click an item, events can't run.
If nobody answer your question, I can do it, but you'll have to wait four to five days (the script isn't actually difficult, but I have some problem ATM).

Jens
revolverwinds
That would be excellent, and I'd be in your debt. I've already all the pictures ready at hand. I only wish I could figure out how to bypass this issue. Thank you again. laugh.gif
Sakura Phoenix
I suppose it'd be good to ask if you are using any scripts outside the default? Like any item detail scripts or which menu command script you might use/be using.
Jens of Zanicuud
QUOTE (Sakura Phoenix @ Feb 15 2012, 05:45 PM) *
I suppose it'd be good to ask if you are using any scripts outside the default? Like any item detail scripts or which menu command script you might use/be using.


@revolverwinds

Right. And yes, I have to know the approximate size of the pictures... 640 x 480? 320 x 240? Or variable size?
Well, I'll give it a shot, then, using the more aliases I can in order to make it compatible with almost everything...
I'll trigger it with Z key, it's okay?

EDIT: No way, I've just scripted something which should work.

CODE
#==============================================================================
#=#============================================================================
# #** Jens of Zanicuud item picture script v 1.0
# #   -free use, just credit
# #   -free customization, however, posting on RRR the modified version is
# #    mandatory
# #   -you can find me on www.rpgrevolution.com
#=#============================================================================
#==============================================================================

#==============================================================================
# ** How to use
#==============================================================================
# Just put into Pictures folder pictures with the same name of the item they
# are related to. In Item scene, just press Z key in order to show the picture
# Ask for troubleshooting anytime.
#==============================================================================
# ** Scene Item
#==============================================================================
class Scene_Item
  
#==============================================================================
# * Aliases
#==============================================================================
  alias joz3_picture_item_main        main
  alias joz3_picture_item_update      update
  alias joz3_picture_item_update_item update_item

#==============================================================================
# ** Main
#==============================================================================
  def main
    #create sprite
    @item_sprite   = RPG::Sprite.new
    @item_sprite.z = 9999
    @item_sprite.x = 320
    @item_sprite.y = 240
    @item_view     = false
    #standard main
    joz3_picture_item_main
    #dispose sprite
    if @item_sprite.bitmap != nil
    @item_sprite.bitmap.dispose
    end
    @item_sprite.dispose
  end

#==============================================================================
# ** Update
#==============================================================================
  def update
    #new update
    if @item_view
      update_picture
      return
    end
    #standard update
    joz3_picture_item_update
  end

#==============================================================================
# ** Update Item
#==============================================================================
  def update_item
    joz3_picture_item_update_item
    #when Z key is pressed
    if Input.trigger?(Input::A)
       @item                = @item_window.item
      #check the existence of the picture file
      if FileTest.exist?("Graphics/Pictures/"+ @item.name + ".png")
       $game_system.se_play($data_system.decision_se)
       @item_view           = true
       @item_window.active  = false
       #picture should share the same name as the item
       @item_sprite.bitmap  = RPG::Cache.picture(@item.name)
       @item_sprite.ox      = @item_sprite.bitmap.width/2
       @item_sprite.oy      = @item_sprite.bitmap.height/2
       @item_sprite.visible = true
       return
      else
       #if file doesn't exist, return a buzzer
       $game_system.se_play($data_system.buzzer_se)
      return
      end
    end
  end

#==============================================================================
# ** Update Picture
#==============================================================================
  def update_picture
    #if Enter, C, Esc, X, Del or Z are pressed
   if Input.trigger?(Input::A) or
      Input.trigger?(Input::B) or
      Input.trigger?(Input::C)
      #return back to item selection
      $game_system.se_play($data_system.cancel_se)
      @item_sprite.visible = false
      @item_view           = false
      @item_window.active  = true
      return
    end
  end
  
  end #Scene item class end


Instructions are in the first few lines of the script itself.

Ask for troubleshooting anytime smile.gif

Jens
revolverwinds
Thank you greatly laugh.gif . I was planning ahead, so it'll be a few days until I've completely tested it. I'll be sure to report on its success here once I've tried it.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.