Picture Viewport

Hi.

Engine: RPG MAKER XP

So, I'm trying to set up a script for displaying message window character graphics and I can't for the life of me figure out how to set it that the picture is in front of the message window.

Both the message window and the picture displays correctly but the picture is below the message window.

In what script is defined that the message window is in front of the picture?
From what I read on the internet I'm supposed to change the z coordinate somewhere but I can't find where.

If you require more information, please ask.

Thanks in advance for any help.
Well, the script that handles the drawing of the Window where all the message text is held is the Window_Message class. And the first method within the Window_Message class is the 'initialize' method. It is here on line 15 that you will see that the z-Depth for this window is set to 9998. A high number indeed. For anything to draw overtop the message window, it would need a z-Depth higher in value.
Thx for the reply but I still can't get it to work.

I tried changing the z-Depth inside Window_Message to -10000 and still the picture is below the message window which led me to assume there's another script that is used for the message window. True enough there's a script called "Message Display" which has about ~1000 lines but even if I change the z-Depth there, nothing happens.

If even tried using CTRL+SHIFT+F to look for ".z" and change the value to -10000 in most places and still the picture is below the message window... It's driving me nuts.

This is a part of the script in question...

If a z-Depth isn't defined for a window, what's the default value of that window?

Code:
class Window_Message < Window_Selectable
  #--------------------------------------------------------------------------
  # フォント設定
  #--------------------------------------------------------------------------
  DEFAULT_FONT_NAME      = ""       # 文章部分の文字フォント ( "" で無変更 )
  DEFAULT_FONT_SIZE      =  20      # 標準文字サイズ( 22が初期設定 )
  DEFAULT_LINE_SPACE     =  22      # 標準行間   ( 32が初期設定 )
  #--------------------------------------------------------------------------
  # 基本メッセージウィンドウ
  #--------------------------------------------------------------------------
  DEFAULT_BG_PICTURE     = ""       # 背景ピクチャ ( "" で使用しない )
  DEFAULT_BG_X           =   0      # 背景ピクチャ X 位置
  DEFAULT_BG_Y           = 320      # 背景ピクチャ Y 位置
  DEFAULT_RECT           = Rect.new (35, 360, 570, 120) #(80, 322, 496, 160)
  DEFAULT_BACK_OPACITY   =  200      # ウィンドウの不透明度
  DEFAULT_STRETCH_ENABLE = true     # 五行以上の場合自動的にサイズを変更する
  #--------------------------------------------------------------------------
  # インフォメーションウィンドウ
  #--------------------------------------------------------------------------
  INFO_RECT              = Rect.new(-16, 64, 672, DEFAULT_LINE_SPACE + 32)
  #--------------------------------------------------------------------------
  # 一文字ずつ描写 (falseにすると同時に全表示)
  #--------------------------------------------------------------------------
  DEFAULT_TYPING_ENABLE = true
  DEFAULT_TYPING_SPEED  = 0
  #--------------------------------------------------------------------------
  # 高速スキップ/タイピングスキップ
  #--------------------------------------------------------------------------
  KEY_SHOW_ALL          = Input::B # タイピングスキップ(残りを瞬間表示)
  KEY_MESSAGE_SKIP      = Input::L # 高速スキップ
  #
  # 高速スキップを有効にするスイッチのID.( 0 は常時可能)
  #
  HISKIP_ENABLE_SWITCH_ID = 0
  #
  # 高速スキップ・タイピングスキップを共に禁止するスイッチのID. ( 0 は常時可能)
  #
  SKIP_BAN_SWITCH_ID      = 0
  #--------------------------------------------------------------------------
  # 顔グラフィック
  #--------------------------------------------------------------------------
  FACE_STRETCH_ENABLE    = false     # 顔グラフィックを↓指定のサイズに拡大する。
  FACE_WIDTH             =  96      # 拡大後の「幅」
  FACE_HEIGHT            =  96      # 拡大後の「高さ」
  #--------------------------------------------------------------------------
  # キャラポップ
  #--------------------------------------------------------------------------
  CHARPOP_HEIGHT         =  56      # キャラポップの高さ
end
module XRXS9
  #--------------------------------------------------------------------------
  # ネームウィンドウ
  #--------------------------------------------------------------------------
  NAME_WINDOW_TEXT_COLOR  = Color.new(255,255,255,255) # \name ウィンドウ文字色
  NAME_WINDOW_TEXT_SIZE   =  18     # \name ウィンドウの文字サイズ
  NAME_WINDOW_SPACE       =  8     # \name ウィンドウの余白
  NAME_WINDOW_OFFSET_X    =  20     # \name ウィンドウのオフセット位置 X
  NAME_WINDOW_OFFSET_Y    = -30     # \name ウィンドウのオフセット位置 Y
  #--------------------------------------------------------------------------
  # 終了時フェードアウト (Fade Out Before Terminate)
  #--------------------------------------------------------------------------
  FOBT_DURATION           =  20     # \fade を指定した時のフェード持続時間
end
#==============================================================================
# --- セリフ効果音 ---
#        $game_system.speak_se = RPG::AudioFile.new("")と設定し使用します。
#==============================================================================
class Game_System
  attr_accessor :speak_se
  def speak_se_play
    self.se_play(self.speak_se) if self.speak_se != nil
  end
end
class Window_Message < Window_Selectable
  # 文字描画SE除外文字
  NOT_SOUND_CHARACTERS = [" ", " ", "・", "、", "。", "─"]
end
#==============================================================================
# □ Sprite_Pause
#==============================================================================
class Sprite_Pause < Sprite
  def initialize
    super
    self.bitmap = RPG::Cache.windowskin($game_system.windowskin_name)
    self.x = 604
    self.y = 456
    self.z = -10000#6001
    @count = 0
    @wait_count = 0
    update
  end
  def update
    super
    if @wait_count > 0
      @wait_count -= 1
    else
      @count = (@count + 1)%4
      x = 160 + @count % 2
      y =  64 + @count / 2
      self.src_rect.set(x, y, 16, 16)
      @wait_count = 4
    end
  end
end
#==============================================================================
# ■ Window_Message
#==============================================================================
class Window_Message < Window_Selectable
  # 定数
  AUTO   = 0
  LEFT   = 1
  CENTER = 2
  RIGHT  = 3
  #--------------------------------------------------------------------------
  # ○ line_height : 行の高さ(@y増加値)を返します。
  #--------------------------------------------------------------------------
  def line_height
    return DEFAULT_LINE_SPACE
  end
  #--------------------------------------------------------------------------
  # ● オブジェクト初期化
  #--------------------------------------------------------------------------
  alias xrxs9_initialize initialize
  def initialize
    # 初期化
    
    @stand_pictuers = []
    @held_windows = []
    @extra_windows = []
    @extra_sprites = []
    # ポーズサインの作成
    @pause = Sprite_Pause.new
    # 呼び戻す
    xrxs9_initialize
    # ポーズサインの設定
    @pause.visible = false
    @pause.z = self.z + 1
    
  end
  #--------------------------------------------------------------------------
You never mentioned any additional Message script. Okay, an XRXS (of fukuyama) message script. Of this, I am unfamiliar. Oh, I've dealt with his battle scripts, but none of the others.

And you can't set a negative z-Depth. 😛

Hrm. It 'aliases' the default Window_Message class, so your z-Depth edit in the Window_Message class itself shoulda worked unless he adjusted the z-Depth later.


O_O OKIE DOKIE... THE Z-DEPTH OF THE PICTURES IS THAT LOW??????

Um, okay. You do have a Game_Picture class. True enough. It handles each individual picture. But what runs all 100 possible pictures? The Sprite_Picture class. And in line 62, it sets each picture's z-Depth only by the picture number, from 1 to 100. THAT part might be where you wanna concentrate too.
Well, I saw somewhere inside the script the .z value set to -1000 so I thought it could be negative.
Is there a max value for z.Depth?

I tried changing inside Sprite_Pictures line 62 "self.z = @picture.number" to " "self.z = @picture.number+15000" but nothing happens.
I tried creating a new viewport4 with z set to 20000 and calling Sprite_Picture with the new viewport but nothing happens as well.

Code:
for i in 1..50
      @picture_sprites.push(Sprite_Picture.new(@viewport4,
        $game_screen.pictures[i]))
end

This is the whole script: https://mega.nz/#!PPwQAYwa!JiU3jUGhbsy4Ei9oWLdKiBxsrYTQiniTPUsACCjSh9k

Also, the script that calls the pictures in question is called "Pose script". Maybe that helps you further. This is a part of the script.
Code:
# ■ Pose
#------------------------------------------------------------------------------
# Pose画像の表示を行うクラスです。

 class Pose < Sprite

  def initialize(pose,kaotype)
    super()
    @pose = pose             #ポーズ
    @kaotype = kaotype       #顔
    if $game_switches[224] == true
      if @pose == "e"
        @posex = -160
        @posey = -15
        @blackx = 0
        @blacky = 0
      else
        @posex = -160
        @posey = -90
        @blackx = 0
        @blacky = -90
      end
    elsif @pose == "e"
      @posey = 85
      @posex = 0
    else
      @posey = 0
      @posex = 0
    end
  end
  #--------------------------------------------------------------------------
  # ● 各画像の準備
  #--------------------------------------------------------------------------
  def body  #身体
    @body = Sprite.new
    @body.bitmap = RPG::Cache.picture("#{@pose}")
    @body.x = @posex
    @body.y = @posey
  end
*sigh* Likely, this is my fear.........

The message window system operates within its own overlapping viewport greater than the others. In this, any graphics you render will always be under the message window. This an intentional feature to ensure that the game player is not hampered in reading any necessary text.

So, I'm trying to set up a script for displaying message window character graphics
Okay, riddle me THIS. Are you trying to add the face of the person talking within the window??? IF so, it's built into XRXS's script.

:razz: However, the XRXS script is assuming you have another script that he wrote that runs tests so you're not trying to upload a non-existent face file. Easy to remove this test.

Find:
Code:
      if (/\\[Ff]\[(.+?)(?:,(\d+))?\]/.match(@now_text)) != nil
        # ファイルチェック
        if RPG_FileTest.picture_exist?($1)
          # フェイスファイルを設定
          @face_file = $1 + ".png"
          @face_index = $2.to_i
          # 全行インデントを入れる。
          src = RPG::Cache.picture(@face_file)
          if FACE_STRETCH_ENABLE
            @indent += FACE_WIDTH
          elsif $2 == nil
            @indent += src.width
            @face_index = -1
          else
            @indent += src.width/4
          end
        end
        @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
      end

and change it to:

Code:
      if (/\\[Ff]\[(.+?)(?:,(\d+))?\]/.match(@now_text)) != nil
        # ファイルチェック
        #if RPG_FileTest.picture_exist?($1)
          # フェイスファイルを設定
          @face_file = $1 + ".png"
          @face_index = $2.to_i
          # 全行インデントを入れる。
          src = RPG::Cache.picture(@face_file)
          if FACE_STRETCH_ENABLE
            @indent += FACE_WIDTH
          elsif $2 == nil
            @indent += src.width
            @face_index = -1
          else
            @indent += src.width/4
          end
        #end
        @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
      end

Now you can use a command like \n[filename] to draw a face in the message window just as you can use \c[number] to change the color of the text. And the filename is the file of a graphics in the Graphics\Pictures folder.

:mrsatan: Personally, I would use a separate cache to store faces, a Graphics\Faces folder. Easy enough to do if you know what you're doing.

And I'm HOPING that your intended message window character is a face. But if not, notice that XRXS's script basically blitted the face in the window with a self.contents.blt (or self.contents.stretch_blt) near the end of its refresh method.

Is it me, or does that smiley/emoji look like Don Kanonji from Bleach?
It's not a face(single picture).

It's a combination of pictures composed together in a certain order to get a full picture. I have pictures for the body, hair, facial expression and then within the poses script, I make functions which I call to display a certain combination of pictures to get different poses and expressions easily anytime I want.

Example:
$pose = Pose.new("b","01")
$pose.shake
SHOW TEXT"BLABLABLA"
$pose.clear
$pose = nil

1. I set the pose to create a new body pose "b" with a facial expression "01" and then call function shake which does a little animation to the pose I previously created
2. Show text
3. Remove picture/s

It seems this is harder to achieve than I thought it would be.
Anyway, thanks a lot for your time and will to help 🙂

I'll just have to capitulate and have the message window be above the pose picture. 🙁
OR HAVE YOU THOUGHT THIS?????

Fake it.

Have you considered taking a screenshot of your message window and using it as an actual picture drawn with the SHOW PICTURE event command, and then draw the other pics overtop?

Couple that with a message window showing... um... NOTHING. A blank message window with no content other than mebby a couple space characters and with no background windowskin. It should just show the PAUSE cursor over the pictures then.
The only way I know without any additional script is faking the message window as DerVVulfman said above.
Also, I think you should try Universal Message System (UMS) script by Ccoa, it's really easy to use in my opinion.
He would still run into the same issue, that being the pictures-under-messagewindow. Personally, I think Wachunga's Multiple Message works as fine.
Thanks for all the suggestions.

The problem is that I've got quite a few dialogs already written inside the game. What are the chances that if I put inside another script, I would just mess things up?

I'll download demo of Wachunga's Multiple Message and see how it works.

Original thread: https://forums.rpgmakerweb.com/threads/picture-viewport.102717/