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.

[VX] Images In Window_Help

Pretty simple; I want to know how to display an image from the Pictures folder in the help window for items. I've been tinkering with it but I don't seem to understand how Window_Help obtains and displays its information. I'm not asking for someone to write me a script, but to teach me how this would work. Thank you.
 

e

Sponsor

Code:
Cache.picture("MY_PICTURE_NAME.extension")

Replace MY_PICTURE_NAME by the file name and .extension by the extension (e.g. : "bob.png")

That should return to your a Bitmap object. I'm sure you can manage afterwards ;)
 

e

Sponsor

You'll have to be more specific. Do you want to display both text and icon, simply an icon, or simply text? Currently, the Window_Help class is there to display text only.

For example :

Code:
#--------------------------------------------------------------------------
  # * Set Icon
  #   icon  : the icon to display
  #--------------------------------------------------------------------------
  def set_icon(icon)
    if icon != @icon
      self.contents.clear
      self.contents.blt(0, 0, icon, icon.rect)
      @icon = icon
    end
  end
  #--------------------------------------------------------------------------
  # * Set Icon Text
  #   icon  : the icon to display
  #   text  : the text to display
  #   align : alignement (0..flush left, 1..center, 2..flush right)
  #--------------------------------------------------------------------------
  def set_icon_text(icon, text, align = 0)
    if icon != @icon or text != @text or align != @align
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.draw_text(4, 0, self.width - 40, WLH, text, align)
      self.contents.blt(0, 0, icon, icon.rect)
      @icon   = icon
      @text   = text
      @align  = align
    end
  end

This will probably not give you what you want; for one, the icon will more likely be drawn above the text, which is probably not a good idea. Either way, set_icon should draw an icon only (note: it clears any text there was before) and set_icon_text should draw both icon and text (clearing anything there was prior to calling it).

To set the icon to be displayed in the Window_Help, you'd go into whatever other Window class uses it; there, you'd load the icon as I've shown above, and pass the bitmap as a parameter to one of the two functions.

If that's unclear, please specify what you need. I'm not even sure I'm pointing you in the right direction.
 
Okay, I've rearranged the inventory screen so it looks like this:

+---------+---------+
|Item      |Help Box  |
|Item      |            |    <--Window_Help
|Item      |            |
|Item      |            |
|Item      |            |
|            |            |
|            |---------+         
|            |  <--------------Window_Item     
+---------+ 

Now, instead of displaying the help text in the help box I want to display a picture that has the same name as the selected item.
 

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