Skip to content

Instantly share code, notes, and snippets.

@cacao-soft
Created September 6, 2023 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cacao-soft/37cd9af9044c4fa18ebd2e812c15192d to your computer and use it in GitHub Desktop.
Save cacao-soft/37cd9af9044c4fa18ebd2e812c15192d to your computer and use it in GitHub Desktop.
RGSS2 メッセージウィンドウより上にピクチャを表示する
# 12 番のピクチャをメッセージウィンドウより上に表示する
# $game_map.screen.pictures[12].above_message_window = true
class Game_Picture
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :above_message_window # Window_Messageより上に表示フラグ
end
class Spriteset_Map
#--------------------------------------------------------------------------
# ● ピクチャ番号からスプライトを取得
#--------------------------------------------------------------------------
def pictures(number)
@picture_sprites[number - 1]
end
end
class Scene_Map < Scene_Base
#--------------------------------------------------------------------------
# ● 開始処理
#--------------------------------------------------------------------------
alias _cao_picture_z_start start
def start
_cao_picture_z_start
update_pictures
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias _cao_picture_z_update update
def update
_cao_picture_z_update
update_pictures
end
#--------------------------------------------------------------------------
# ● ピクチャの更新 (Sprite_Picture#update 後に実行)
#--------------------------------------------------------------------------
def update_pictures
for pic in $game_map.screen.pictures
sp = @spriteset.pictures(pic.number)
if pic.above_message_window
sp.z = @message_window.z + pic.number
sp.viewport = nil
else
sp.viewport = @viewport2
end
end
end
end
@cacao-soft
Copy link
Author

cacao-soft commented Sep 6, 2023

  • 各ピクチャ個別に表示状態を変更できる。
  • メッセージウィンドウの上か下の設定はスクリプトでおこなう。
  • ピクチャの表示や消去では、設定がリセットされない。
# メッセージウィンドウの上に表示
$game_map.screen.pictures[ピクチャ番号].above_message_window = true
# メッセージウィンドウの下に表示
$game_map.screen.pictures[ピクチャ番号].above_message_window = false

イベント例:
SS2309070130013

SS2309070130107

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment