Jump to content
Jetto

Display image in Status screen

Recommended Posts

Hello,  I was wondering if it's possible to display a character's full boddy image (not portrait) in the Staus screen. Like having all the info like name, equipment and stuff to the left and an image of the character in the right. I edited Window_Status to move the text to the left but then realised that I haven't the slightest idea of how to add an image for each character and each class that the character might have. So even if I figured out how to add an image I wouldn't know how to make it character or class specific. I'm also using this Dragon Quest menu script, not sure of it's relevant.

 

Spoiler

#============================================================================
# [VXAce] Dragon Quest Menu V2.00
#----------------------------------------------------------------------------
# By Jamiras843
#
# Features: 
#     V2.00
#     * Fixed menu close issue
#     * Added the ability to hide HP/MP Bars
#     V1.50
#     * Fixed menu overlap issues
#     * Added charater HUD with options
#     V1.00
#     * Simplified menu layout that has adjustable columns and rows.
#     * New actor selection menu which is smaller and simpler in design.
#============================================================================
$imported = {} if $imported.nil?
$imported["Dragon Quest Menu"] = true

module Jami_DQ_Menu
 #========================================================================
 # Script options
 #------------------------------------------------------------------------
 # Here you edit menu specific things, such as height, x/y origin, column
 # number, etc.
 #
 # Make all simple edits here! They are easy to understand and labled! 
 #========================================================================
 WINDOW_OPACITY = 255 #Number 0-255 that determines window opacity
 DRAW_HP_MP_BARS = true #If true shows default RPG maker bar
 MENU_COLUMN = 2    #Number of columns for the menu
 MENU_LINE = 2      #Number of max lines for the menu
 MENU_HEIGHT = 100   #Menu height (at least 80 per line, no <80)
 MENU_WIDTH = 250   #Menu width (at least 90 per column)
 MENU_X = 0        #Menu X origin
 MENU_Y = 0         #Menu Y origin
 LOC_X = 0       #Custom location window X origin
 LOC_Y = 306 - 75          #Custom location window Y origin   
 GOLD_X = 0      #Custom gold window X origin
 GOLD_Y = 306 - 54         #Custom gold window Y origin
 #=========================================================================
 # Menu Command options
 #-------------------------------------------------------------------------
 # This is where you set up what commands you want in the menu, including
 # custom ones using common events.
 #=========================================================================
 SHOW_SAVE_CMD = true #If false removes save option from menu
 SHOW_EXIT_GAME = true #If false removes quit game option from the menu
 SHOW_FORMATION = false #If false removes the formation command
 SHOW_LOCATION = false #If true shows custom gold window w/ location
     VOCAB_LOC = "Location:"
     VOCAB_GOLD = "Gold Coins:"
 SIMPLE_STATUS = false #If true shows a list staus menu DW2,3,&4 style
 ACTOR_WINDOW = false
     SHOW_FACE = false
     SHOW_HP = false
     SHOW_MP = false
     SHOW_LEVEL = false
end #end module Jami_DQ_Menu

#============================================================================    
# WARNING: Do not edit below unless you know what you are doing. This script
# is rather sloppy but it does its job. 
#============================================================================

#============================================================================
# * DQ Window (over writes menu command window)
#============================================================================
class Window_DQ_Menu < Window_Command
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
       super(Jami_DQ_Menu::MENU_X, Jami_DQ_Menu::MENU_Y)
 end
 #--------------------------------------------------------------------------
 # * Get Number of Lines to Show
 #--------------------------------------------------------------------------
 def visible_line_number
       return Jami_DQ_Menu::MENU_LINE
 end
 #--------------------------------------------------------------------------
 # * Get Digit Count
 #--------------------------------------------------------------------------
 def col_max
       return Jami_DQ_Menu::MENU_COLUMN
 end
 #--------------------------------------------------------------------------
 # * Set Width
 #--------------------------------------------------------------------------
 def window_width
       return Jami_DQ_Menu::MENU_WIDTH
 end
 #--------------------------------------------------------------------------
 # * Set Height
 #--------------------------------------------------------------------------
 def window_height
       return Jami_DQ_Menu::MENU_HEIGHT
 end
 #--------------------------------------------------------------------------
 # * Create Command List
 #--------------------------------------------------------------------------
 def make_command_list
       add_main_commands
       add_formation_command
       add_game_end_command
 end
 #--------------------------------------------------------------------------
 # * Create Command List
 #--------------------------------------------------------------------------
 def make_command_list
       add_main_commands
       add_formation_command
       add_save_command
       add_game_end_command
 end
 #--------------------------------------------------------------------------
 # * Add Main Commands to List
 #--------------------------------------------------------------------------
 def add_main_commands
       add_command(Vocab::item,   :item,   main_commands_enabled)
       add_command(Vocab::skill,  :skill,  main_commands_enabled)
       add_command(Vocab::equip,  :equip,  main_commands_enabled)
       add_command(Vocab::status, :status, main_commands_enabled)
 end
 #--------------------------------------------------------------------------
 # * Add Save to Command List
 #--------------------------------------------------------------------------
 def add_save_command
       add_command(Vocab::save, :save, save_enabled) if Jami_DQ_Menu::SHOW_SAVE_CMD == true
 end
 #--------------------------------------------------------------------------
 # * Add Formation to Command List
 #--------------------------------------------------------------------------
 def add_formation_command
       add_command(Vocab::formation, :formation, formation_enabled) if Jami_DQ_Menu::SHOW_FORMATION == true
 end
 #--------------------------------------------------------------------------
 # * Add Exit Game to Command List
 #--------------------------------------------------------------------------
 def add_game_end_command
       add_command(Vocab::game_end, :game_end) if Jami_DQ_Menu::SHOW_EXIT_GAME == true
 end
 #-------------------------------------------------------------------------
 # * Get Activation State of Main Commands
 #-------------------------------------------------------------------------
 def main_commands_enabled
       $game_party.exists
 end
 #-------------------------------------------------------------------------
 # * Get Activation State of Save
 #-------------------------------------------------------------------------
 def save_enabled
   !$game_system.save_disabled
 end
 #-------------------------------------------------------------------------
 # * Get Activation State of Formation
 #-------------------------------------------------------------------------
 def formation_enabled
       $game_party.members.size >= 2 && !$game_system.formation_disabled
 end
end #class Window_DQ_Menu
#============================================================================
# * Window Base
#----------------------------------------------------------------------------
# Edit which changes base window
#============================================================================
class Window_Base < Window
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(x, y, width, height)
   super
   self.windowskin = Cache.system("Window")
   update_padding
   update_tone
   create_contents
   @opening = @closing = false
   self.back_opacity = Jami_DQ_Menu::WINDOW_OPACITY
 end

 #--------------------------------------------------------------------------
 # * Draw HP
 #--------------------------------------------------------------------------
 def draw_actor_hp(actor, x, y, width = 124)
   if Jami_DQ_Menu::DRAW_HP_MP_BARS == true
   draw_gauge(x, y, width, actor.hp_rate, hp_gauge_color1, hp_gauge_color2)
   end
   change_color(system_color)
   draw_text(x, y, 30, line_height, Vocab::hp_a)
   draw_current_and_max_values(x, y, width, actor.hp, actor.mhp,
     hp_color(actor), normal_color)
   end

 #--------------------------------------------------------------------------
 # * Draw MP
 #--------------------------------------------------------------------------
 def draw_actor_mp(actor, x, y, width = 124)
   if Jami_DQ_Menu::DRAW_HP_MP_BARS == true
   draw_gauge(x, y, width, actor.mp_rate, mp_gauge_color1, mp_gauge_color2)
   end
   change_color(system_color)
   draw_text(x, y, 30, line_height, Vocab::mp_a)
   draw_current_and_max_values(x, y, width, actor.mp, actor.mmp,
   mp_color(actor), normal_color)
   end
end

#============================================================================
# ** Gold/location Window
#============================================================================
class Window_Location < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
       super(Jami_DQ_Menu::LOC_X, Jami_DQ_Menu::LOC_Y,300,75)
       self.contents = Bitmap.new(width - 32, height - 32)
       refresh

     end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   self.contents.draw_text(0,0,140,32, Jami_DQ_Menu::VOCAB_LOC)
   self.contents.draw_text(120,0,140,32, $game_map.display_name)
   self.contents.draw_text(0,20,140,32, Jami_DQ_Menu::VOCAB_GOLD)
   self.contents.draw_text(120,20,140,32, $game_party.gold)
 end
end #end class Window_Location

#============================================================================
# ** Gold Window (No location)
#============================================================================
class Window_Gold < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
       super(Jami_DQ_Menu::GOLD_X, Jami_DQ_Menu::GOLD_Y,245,54)
       self.contents = Bitmap.new(width - 32, height - 32)
       refresh

     end
 #--------------------------------------------------------------------------
 # * Refresh
 #--------------------------------------------------------------------------
 def refresh
   self.contents.clear
   self.contents.draw_text(0,0,140,32, Jami_DQ_Menu::VOCAB_GOLD)
   self.contents.draw_text(120,0,140,32, $game_party.gold)
 end
end #end class Window_Location

#============================================================================
# ** Actor Window 
#============================================================================
class Window_Actor < Window_Base
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize
   if $game_party.members.size < 4
       super(0,306,110 * $game_party.members.size,110)
   else 
       super(0,306,110 * 4,110)
   end
       create_contents
       @actor1 = $game_party.members[0]
       @actor2 = $game_party.members[1]
       @actor3 = $game_party.members[2]
       @actor4 = $game_party.members[3]
       refresh
 end
  #----------------------------------------------------
  # * Refresh
  #----------------------------------------------------
 def refresh
       contents.clear
       draw_window_content
       draw_horiz_line (line_height * 1)

     end
  #----------------------------------------------------
  # * Draw Window Contents
  #----------------------------------------------------
 def draw_window_content

   # Face
      if Jami_DQ_Menu::SHOW_FACE == true
   draw_face(@actor1.face_name, @actor1.face_index, 0, 0, enabled = false)
      if $game_party.members.size > 1
   draw_face(@actor2.face_name, @actor2.face_index, 110, 0, enable = false)
      end # > 1
      if $game_party.members.size > 2
   draw_face(@actor3.face_name, @actor3.face_index, 220, 0, enable = false)
      end # > 2
      if $game_party.members.size > 3
   draw_face(@actor4.face_name, @actor4.face_index, 330, 0, enable = false)
      end # > 3
    end # if face

   # Actor Name
   draw_actor_name(@actor1, 0, 0)
     if $game_party.members.size > 1
   draw_actor_name(@actor2, 110, 0)
      end # > 1
      if $game_party.members.size > 2
   draw_actor_name(@actor3, 220, 0)
      end # > 2
      if $game_party.members.size > 3
   draw_actor_name(@actor4, 330, 0)
      end # > 3

   # Actor HP
   if Jami_DQ_Menu::SHOW_HP == true
   draw_actor_hp(@actor1, 0, 24, 80)
     if $game_party.members.size > 1
   draw_actor_hp(@actor2, 110, 24, 80)
      end # > 1
      if $game_party.members.size > 2
   draw_actor_hp(@actor3, 220, 24, 80)
      end # > 2
      if $game_party.members.size > 3
   draw_actor_hp(@actor4, 330, 24, 80)
      end # > 3
   end #if SHOW_HP

   # Actor MP
   if Jami_DQ_Menu::SHOW_MP == true
   draw_actor_mp(@actor1, 0, 44, 80)
     if $game_party.members.size > 1
   draw_actor_mp(@actor2, 110, 44, 80)
      end # > 1
      if $game_party.members.size > 2
   draw_actor_mp(@actor3, 220, 44, 80)
      end # > 2
      if $game_party.members.size > 3
   draw_actor_mp(@actor4, 330, 44, 80)
      end # > 3
   end #if SHOW_MP

   # Actor LV
   if Jami_DQ_Menu::SHOW_LEVEL == true
   draw_actor_level(@actor1, 0, 64)
     if $game_party.members.size > 1
   draw_actor_level(@actor2, 110, 64)
      end # > 1
      if $game_party.members.size > 2
   draw_actor_level(@actor3, 220, 64)
      end # > 2
      if $game_party.members.size > 3
   draw_actor_level(@actor4, 330, 64)
      end # > 3
   end #if SHOW_Level
 end # df draw_window_content
end #end class Window_Location

 #--------------------------------------------------------------------------
 # * Draw Horizontal Line
 #--------------------------------------------------------------------------
 def draw_horiz_line(y)
   contents.fill_rect(0, 22, contents_width, 2, line_color)
 end
 #--------------------------------------------------------------------------
 # * Get Color of Horizontal Line
 #--------------------------------------------------------------------------
 def line_color
   color = normal_color
   color.alpha = 200
   color
 end


#==============================================================================
# ** Window_MenuStatus
#------------------------------------------------------------------------------
#  This window displays party member status on the menu screen.
#==============================================================================

class Window_Simple_MenuStatus < Window_Selectable
 #--------------------------------------------------------------------------
 # * Public Instance Variables
 #--------------------------------------------------------------------------
 attr_reader   :pending_index            # Pending position (for formation)
 #--------------------------------------------------------------------------
 # * Object Initialization
 #--------------------------------------------------------------------------
 def initialize(x, y)
   super(x, y, window_width, window_height)
   @pending_index = -1
   refresh
 end
 #--------------------------------------------------------------------------
 # * Get Window Width
 #--------------------------------------------------------------------------
 def window_width
   Jami_DQ_Menu::MENU_WIDTH
 end
 #--------------------------------------------------------------------------
 # * Get Window Height
 #--------------------------------------------------------------------------
 def window_height
   124
 end
 #--------------------------------------------------------------------------
 # * Get Number of Items
 #--------------------------------------------------------------------------
 def item_max
   $game_party.members.size
 end
 #--------------------------------------------------------------------------
 # * Get Item Height
 #--------------------------------------------------------------------------
 def item_height
   22
 end
 #--------------------------------------------------------------------------
 # * Draw Item
 #--------------------------------------------------------------------------
 def draw_item(index)
   actor = $game_party.members[index]
   enabled = $game_party.battle_members.include?(actor)
   rect = item_rect(index)
   draw_item_background(index)
   draw_actor_name(actor, 4, rect.y - 2)

 end
 #--------------------------------------------------------------------------
 # * Draw Background for Item
 #--------------------------------------------------------------------------
 def draw_item_background(index)
   if index == @pending_index
     contents.fill_rect(item_rect(index), pending_color)
   end
 end
 #--------------------------------------------------------------------------
 # * Processing When OK Button Is Pressed
 #--------------------------------------------------------------------------
 def process_ok
   super
   $game_party.menu_actor = $game_party.members[index]
 end
 #--------------------------------------------------------------------------
 # * Restore Previous Selection Position
 #--------------------------------------------------------------------------
 def select_last
   select($game_party.menu_actor.index || 0)
 end
 #--------------------------------------------------------------------------
 # * Set Pending Position (for Formation)
 #--------------------------------------------------------------------------
 def pending_index=(index)
   last_pending_index = @pending_index
   @pending_index = index
   redraw_item(@pending_index)
   redraw_item(last_pending_index)
 end
end


#============================================================================
# ** Scene_Menu
#----------------------------------------------------------------------------
#  This overwrites menu
#============================================================================

class Scene_Menu < Scene_MenuBase
 #--------------------------------------------------------------------------
 # * Start Processing
 #--------------------------------------------------------------------------
 def start
   super
   create_command_window
   if Jami_DQ_Menu::SHOW_LOCATION == false
     create_gold_window
   else
     create_location_window
   end
   if Jami_DQ_Menu::SIMPLE_STATUS == false
     create_status_window
   else
     create_simple_status_window
   end
   if Jami_DQ_Menu::ACTOR_WINDOW == true
     create_actor_window
   end
 end
 #--------------------------------------------------------------------------
 # * Create Command Window
 #--------------------------------------------------------------------------
 def create_command_window
   @command_window = Window_DQ_Menu.new
   @command_window.set_handler(:item,      method(:command_item))
   @command_window.set_handler(:skill,     method(:command_personal))
   @command_window.set_handler(:equip,     method(:command_personal))
   @command_window.set_handler(:status,    method(:command_personal))
   @command_window.set_handler(:formation, method(:command_formation))
   @command_window.set_handler(:save,      method(:command_save))
   @command_window.set_handler(:game_end,  method(:command_game_end))
   @command_window.set_handler(:cancel,    method(:return_scene))

 end
 #--------------------------------------------------------------------------
 # * Create Status Window
 #--------------------------------------------------------------------------
 def create_status_window
   @status_window = Window_MenuStatus.new(0,0)
   @status_window.hide
 end
 #--------------------------------------------------------------------------
 # * Create Simple Status Window
 #--------------------------------------------------------------------------
 def create_simple_status_window
   @simple_status_window = Window_Simple_MenuStatus.new(0,0)
   @simple_status_window.hide
 end
 #--------------------------------------------------------------------------
 # * [skill], [Equipment] and [status] Commands
 #--------------------------------------------------------------------------
 def command_personal
   if Jami_DQ_Menu::SIMPLE_STATUS == false
   @status_window.show
   @command_window.hide
   if Jami_DQ_Menu::ACTOR_WINDOW == true
   @actor_window.hide
   end
   @status_window.select_last
   @status_window.activate
   @status_window.set_handler(:ok,     method(:on_personal_ok))
   @status_window.set_handler(:cancel, method(:on_personal_cancel))
   else
   @simple_status_window.show
   @command_window.hide
   @simple_status_window.select_last
   @simple_status_window.activate
   @simple_status_window.set_handler(:ok,     method(:on_personal_ok))
   @simple_status_window.set_handler(:cancel, method(:on_personal_cancel))
   end
 end
 #--------------------------------------------------------------------------
 # * [Cancel] Personal Command
 #--------------------------------------------------------------------------
 def on_personal_cancel
   if Jami_DQ_Menu::SIMPLE_STATUS == false
   @status_window.unselect
   @status_window.hide
   if Jami_DQ_Menu::ACTOR_WINDOW == true
   @actor_window.dispose
   @actor_window = Window_Actor.new
   end
   @command_window.show
   @command_window.activate
   else
   @simple_status_window.unselect
   @command_window.show
   @simple_status_window.hide
   if Jami_DQ_Menu::ACTOR_WINDOW == true
   @actor_window.dispose
   @actor_window = Window_Actor.new
   end
   @command_window.activate
   end
 end
 #--------------------------------------------------------------------------
 # * [Formation] Command
 #--------------------------------------------------------------------------
 def command_formation
   if Jami_DQ_Menu::SIMPLE_STATUS == false
   @status_window.show
   @command_window.hide
   if Jami_DQ_Menu::ACTOR_WINDOW == true
   @actor_window.hide
   end
   @status_window.select_last
   @status_window.activate
   @status_window.set_handler(:ok,     method(:on_formation_ok))
   @status_window.set_handler(:cancel, method(:on_formation_cancel))
   else
   @simple_status_window.show
   @command_window.hide
   @simple_status_window.select_last
   @simple_status_window.activate
   @simple_status_window.set_handler(:ok,     method(:on_formation_ok))
   @simple_status_window.set_handler(:cancel, method(:on_formation_cancel))
   end
 end      
 #--------------------------------------------------------------------------
 # * Formation [OK]
 #--------------------------------------------------------------------------
 def on_formation_ok
   if Jami_DQ_Menu::SIMPLE_STATUS == false
   if @status_window.pending_index >= 0
     $game_party.swap_order(@status_window.index,
                            @status_window.pending_index)
     @status_window.pending_index = -1
     @status_window.redraw_item(@status_window.index)
     if Jami_DQ_Menu::ACTOR_WINDOW == true
     @actor_window.dispose
     @actor_window = Window_Actor.new
     @actor_window.hide
     end
   else
     @status_window.pending_index = @status_window.index
   end
   @status_window.activate
   else 
   if @simple_status_window.pending_index >= 0
     $game_party.swap_order(@simple_status_window.index,
                            @simple_status_window.pending_index)
     @simple_status_window.pending_index = -1
     @simple_status_window.redraw_item(@simple_status_window.index)
     if Jami_DQ_Menu::ACTOR_WINDOW == true
     @actor_window.dispose
     @actor_window = Window_Actor.new
     end
   else
     @simple_status_window.pending_index = @simple_status_window.index
   end
   @simple_status_window.activate
   end
 end
 #--------------------------------------------------------------------------
 # * Formation [Cancel]
 #--------------------------------------------------------------------------
 def on_formation_cancel
   if Jami_DQ_Menu::SIMPLE_STATUS == false
     if @status_window.pending_index >= 0
       @status_window.pending_index = -1
       @status_window.activate
     else
       @status_window.unselect
       @status_window.hide
       if Jami_DQ_Menu::ACTOR_WINDOW == true
     @actor_window.dispose
     @actor_window = Window_Actor.new
     end
       @command_window.show
       @command_window.activate
     end
     else
     if @simple_status_window.pending_index >= 0
       @simple_status_window.pending_index = -1
       @simple_status_window.activate
     else
       @simple_status_window.unselect
       @simple_status_window.hide
       if Jami_DQ_Menu::ACTOR_WINDOW == true
       @actor_window.dispose
       @actor_window = Window_Actor.new
     end
       @command_window.show
       @command_window.activate
     end
  end 
 end
 #--------------------------------------------------------------------------
 # * Location window
 #--------------------------------------------------------------------------
 def create_location_window
   @location_window = Window_Location.new
 end
 #--------------------------------------------------------------------------
 # * Create Gold Window
 #--------------------------------------------------------------------------
 def create_gold_window
   @gold_window = Window_Gold.new
 end
 #--------------------------------------------------------------------------
 # * Create Actor Window
 #--------------------------------------------------------------------------
 def create_actor_window
   @actor_window = Window_Actor.new
 end
end # end Scene_Menu

 

 

I maded a little mock up of what I want.

Sin título.png

Share this post


Link to post
Share on other sites

Aren't there scripts already to put a big image in the status menu? It's not that hard to add a static image to menus, but I am a bit confused about this:

 

22 hours ago, That One NPC said:

It would be more lively and sophisticated if it had the stepping animation with the direction rotating, but that's getting into some hardcore stuff.

 

That makes it sound like the OP wants characters to show up and not big busts/portraits, but I don't think they really indicated that anywhere. Am I missing something?

Share this post


Link to post
Share on other sites
5 hours ago, Kayzee said:

Aren't there scripts already to put a big image in the status menu? It's not that hard to add a static image to menus, but I am a bit confused about this:

 

 

That makes it sound like the OP wants characters to show up and not big busts/portraits, but I don't think they really indicated that anywhere. Am I missing something?

 

I want to display full-body images of each character in the status screen, I moved the text but I don't know anything about coding. I was able to move the text just by trial and error.

That thing about the sprite animation was just him getting excited I guess.

 

If there are scripts to display images on the status screen can you please link them to me? Because I wasn't able to find any, maybe I just didn't search properly.

Edited by Jetto

Share this post


Link to post
Share on other sites
7 hours ago, PhoenixSoul said:

@Kayzee Paper doll image that shows the entire character. Most portraits are top-third or top-half.

 

Eh? Paper dolls now? Where did that come from? When I think 'paper doll' I think 'image made up of many layered images for different equipment or something'.

 

3 hours ago, Jetto said:

 

I want to display full-body images of each character in the status screen, I moved the text but I don't know anything about coding. I was able to move the text just by trial and error.

That thing about the sprite animation was just him getting excited I guess.

 

If there are scripts to display images on the status screen can you please link them to me? Because I wasn't able to find any, maybe I just didn't search properly. 

 

Well I know I have seen lots of games do it at least. I don't know if there is a simple script that does that actually. I think most of the time it's done using Luna Engine? I also found this script when looking around that looked kinda neat but not exactly the same.

 

Anyway, if you want to try and figure out how to script images in menus yourself, you might wanna take a look at the code for draw_icon, draw_face, and draw_character in the Window_Base default script, and look at some more of the default scripts to see how they are used.

 

 

Share this post


Link to post
Share on other sites

It's mostly about coordinates, but there's a lot that goes into drawing images rather than lines, windows or text...

@Kayzee I mentioned paper dolls as a reference to a common image manip where it's the whole character, stating the comparison to most portraits being either top-third or top-half.

Share this post


Link to post
Share on other sites

I don't thing drawing images is that much more complicated, but I guess it could be depending. Maybe this might help?

 

class Window_Base < Window
 
  def draw_picture(picture_name, x, y, enabled = true)
    bitmap = Cache.picture(picture_name)
    contents.blt(x, y, bitmap, bitmap.rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
  end
  
end

It just adds a method to all windows to draw a whole picture image into the window. It's pretty straightforward I think. You could take the method and add it to just whatever window class you are working with too.

 

I never heard that called 'paper dolls' before, but okay.

Share this post


Link to post
Share on other sites
5 hours ago, Kayzee said:

I don't thing drawing images is that much more complicated, but I guess it could be depending. Maybe this might help?

 


class Window_Base < Window
 
  def draw_picture(picture_name, x, y, enabled = true)
    bitmap = Cache.picture(picture_name)
    contents.blt(x, y, bitmap, bitmap.rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
  end
  
end

It just adds a method to all windows to draw a whole picture image into the window. It's pretty straightforward I think. You could take the method and add it to just whatever window class you are working with too.

 

I never heard that called 'paper dolls' before, but okay.

 

Thanks! But how do I use this script? Sorry if it's a dumb question.

Share this post


Link to post
Share on other sites
On 12/19/2019 at 6:16 AM, Jetto said:

Hello,  I was wondering if it's possible to display a character's full boddy image (not portrait) in the Staus screen. Like having all the info like name, equipment and stuff to the left and an image of the character in the right.

 

Like most things with scripting the answer of whether it's possible is of course, yes.

 

KZ's snippet is basically what you do to display any external picture file in a window. If you look at the default code in the engine for "draw_face" (which is used to display the portrait, located in Window_Base) it basically is the exact same thing, with only one difference, which is that it needs to chop up the image file containing the faces in order to pull the right face from it.

  #--------------------------------------------------------------------------
  # * Draw Face Graphic
  #     enabled : Enabled flag. When false, draw semi-transparently.
  #--------------------------------------------------------------------------
  def draw_face(face_name, face_index, x, y, enabled = true)
    bitmap = Cache.face(face_name)
    rect = Rect.new(face_index % 4 * 96, face_index / 4 * 96, 96, 96) # This is the only thing it does differently.
    contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
    bitmap.dispose
  end

But I guess to be fair, for someone who is only just dipping their feet in the engine's code, these 3 or 4 lines of code might be kinda not very easy to understand. So I'll break down what KilloZappit's snippet actually does line by line:

    bitmap = Cache.picture(picture_name)
   # Load (but not display) an image file from "Graphics/Pictures" whose filename corresponds to 
   # the value stored in the variable "picture_name" and set it to a Local variable called "bitmap".
   # "Cache" is one of the default scripts right at the top of the list, its job is to load images
   # from the game's Graphics folders and cache them for quick reloading, if the same picture
   # needs to be used later. If you check it out, each of its Methods corresponds to one of the
   # sub-folders in the game's Graphics folder.
   # Example usage: bitmap = Cache.picture("actor1-fullbody.png")
   #
   # The file extension is optional. You can omit the extension and it will look for whatever valid ones
   # it can find.

    contents.blt(x, y, bitmap, bitmap.rect, enabled ? 255 : translucent_alpha)
   # Displays the image in the window. Every Window has its own completely transparent, blank
   # bitmap image called "content" that it creates when it is initialized ("create_contents").
   # To display things, some other image is typically loaded and gets copied onto this "contents".
   # using the "blt" Method. "blt" is short for 'block transfer' and it preserves transparency, so
   # you can 'layer' things on each other by repeated "blt"s as opposed to other Methods for drawing
   # things like "fill_rect" or "gradient_fill_rect", which will completely replace whatever was
   # underneath, even if you try it with a transparent color.
   #
   # Example usage: contents.blt(12, 24, image_file, Rect.new(0,0,4,4), 255)
   # Meaning: "I want to copy the image in the variable 'image_file' and display it starting 12 pixels
   # 	from the left of the Window and 24 pixels down from the top. I don't want the whole image
   # 	to be displayed, just a 4x4pixel portion of the top left corner. And do it at full 255 opacity,
   # 	not translucent or transparent."
   #
   # X-coodinates start from the left, Y-coordinates from the top (unlike RPGMaker MV, which I
   # believe has y-coordinates starting from the bottom of the screen). Opacity ranges from 0
   # to 255, with 0 being fully transparent/invisible and 255 being fully opaque. Images are drawn
   # from left to right, top to bottom.
   #
   # The particular call in the snippet does not look much like the example, because all the parameters 
   # used are themselves variables. Plus, there is that headache of a ternary operator used to
   # decide the opacity.
   # Meaning of the call in the snippet: "Display the image from the "bitmap" variable however many pixels
   # 	to the left was in the "x" variable and however many pixels down specified in the "y" variable.
   #	I want the whole image displayed, the entire portion of whole rectangle of the image in the
   #	"bitmap" variable. For opacity, I want to look at the variable "enabled". If such a variable
   #	exists and/or has any value assigned that isn't "false", make this image 255 fully opaque.
   #	Otherwise, set it to the opacity value stored in "translucent_alpha"."
   #
   # "translucent_alpha" is a method in Window_Base whose sole purpose is to store a number. That number
   # being 160, which is the opacity that not "enabled" images will be drawn at, such as actor porraits
   # of reserve party members.

    bitmap.dispose
   # Unloads/disposes of the image to free up system memory. It has already been copied onto "contents",
   # so the original is no longer needed. "contents" itself gets disposed when the Window is disposed,
   # which only really happens during Scene changes. Most other times you 'close' or 'shut' a Window in-game,
   # like with the message box, it's actually only being turned invisible and not really disposed.

You might ask, where are all these variables called "picture_name" or "enabled" or "x" or "y" actually being set and given values?

 

The answer is, they are set in the parentheses that you type when calling the Method to run it.

  def draw_picture(picture_name, x, y, enabled = true)
 # Declares the lines of code written after to be a Method called "draw_picture" so that it can be    
 # called repeatedly without having to retype the lines of code within. The value of the variables in
 # the parentheses are to be specified at the point of calling the Method. The first three are mandatory,
 # the last one has been given a pre-existing default value of "true" and so is optional; if you don't put
 # anything in for it, it will default to "true".
 #
 # Example usage: draw_picture("actor1-fullbody.png", 0, 0, false)
 # Meaning: "Load the image "actor1-fullbody" from the Pictures folder. Display the whole image 
 # 	from the start of the Window's top-left corner, at translucent 160 opacity."
 #
 # Example usage 2: draw_picture("actor2", (self.width-200), (self.height-200))
 # Meaning: "Load the image "actor2" the Pictures folder. Display the whole image starting 200 pixels 
 #	from the right side of the Window and 200 pixels from the bottom of the window. Do it at
 #	full 255 opacity."
 	...
 	...
 	...
 end

Basically, you need to decide what coordinates you want the picture displayed at and have a picture ready so you can prepare the Method call (something like "draw_picture("actor1-fullbody.png", 0, 0)") and then find a good place in the code of Window_Status to insert the call into.

 

Remember that the images drawn will layer over one another, so whatever gets drawn first will end up underneath something that gets drawn later if they get drawn in the same spot. Which means you will want to insert your picture-drawing call somewhere before the text gets drawn if you plan to have text written over it.

Edited by Traverse

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×