RPGツクールXP/VX用のRGSS素材です。
一部英語版対応です。
(A few materials can be used for English RPG MAKER XP/VX.)
競合率はルファーの独断と偏見なのでたまにハズレます。
#==============================================================================
# ■ ダイナミックメッセージ・軽
#------------------------------------------------------------------------------
# 原版からシェイク機能だけを取り出したバージョン。
# 「他のウィンドウが流れてないのに文章ウィンドウだけ流れてるのが違和感」
# っていう時にお使いください。
# (C) ルファー
# WebSite https://tkoolerlufar.pages.dev/
#==============================================================================
=begin
=対応RGSS
1 2
=必要なライブラリ
ルファー作スクリプト素材共通ライブラリ
=他の素材との競合の可能性
!!. それなりに気をつけてるけど、文章ウィンドウ改造系スクリプトとはいまいち?
=RPGツクールXPでの導入方法
Window_Messageより下に新セクションを作成して、
このプログラムをそこにコピーする
=シェイク方法
原版と同じです。
イベントコマンド「スクリプト」で、
$game_temp.message_vshake = true
という処理を入れると、次回の文章コマンドで文章ウィンドウが縦に振動します。
同様に、
$game_temp.message_hshake = true
という処理を入れると、次回の文章コマンドで文章ウィンドウが横に振動します。
また、
$game_temp.message_hshake = true
$game_temp.message_vshake = true
という処理を入れると、次回の文章コマンドで文章ウィンドウが斜めに振動します。
=備考
「ワイドモード」に対応してます。
=更新履歴
2010/09/08 滑らかモードOFFのときにウィンドウが全く縦振動しない仕様を修正
この仕様変更に伴い円運動機能を廃止、代わりに斜め振動機能を実装
新規定義しているメソッド・プロパティの誤表記を修正
RPGツクールVXに対応
2010/04/13 公開
=再定義しているメソッド (いずれもエイリアス使用)
Game_Temp#initialize
Window_Message#initialize
Window_Message#refresh (RPGツクールXPのみ)
Window_Message#update
Window_Message#update_show_fast (RPGツクールVXのみ)
Window_Message#start_message (RPGツクールVXのみ)
=新規定義しているメソッド
Window_Message#_Lufar13_UpdateShake
=再定義しているプロパティ (いずれもエイリアス使用)
Window_Message#x
Window_Message#y
=新規定義しているプロパティ
Game_Temp#message_hshake
Game_Temp#message_vshake
Window_Message#_Lufar13_RealX
Window_Message#_Lufar13_RealY
=end
#----------------------------------------------------------------------------
# ◆ Game_Temp クラス
#----------------------------------------------------------------------------
class Game_Temp
#--------------------------------------------------------------------------
# ● 公開インスタンス変数
#--------------------------------------------------------------------------
attr_accessor :message_hshake ## メッセージ 水平シェイクフラグ
attr_accessor :message_vshake ## メッセージ 垂直シェイクフラグ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias _Lufar13_PrototypeOfInit initialize
def initialize
_Lufar13_PrototypeOfInit()
@message_hshake = false
@message_vshake = false
end
end
#----------------------------------------------------------------------------
# ◆ Window_Message クラス
#----------------------------------------------------------------------------
class Window_Message < Window_Selectable
#--------------------------------------------------------------------------
# ○ 定数
#--------------------------------------------------------------------------
WIDTH = 480 ## 幅
HEIGHT = 160 ## 高さ
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
alias _Lufar13_PrototypeOfInit initialize
def initialize
@x = 0
@y = 0
@shake_x = 0
@shake_y = 0
_Lufar13_PrototypeOfInit()
if rpgxp?
@gold_window = nil unless defined? @gold_window
@input_number_window = nil unless defined? @input_number_window
self.ox = 0
self.oy = 0
self.width = WIDTH
self.height = HEIGHT
@fade_in_duration = 0
@fade_out_duration = 0
else
@shake_duration = 0
end
@hshake = false
@vshake = false
end
#--------------------------------------------------------------------------
# ○ 座標の取得・設定
#--------------------------------------------------------------------------
alias _Lufar13_RealX x unless method_defined?(:_Lufar13_RealX)
alias _Lufar13_RealY y unless method_defined?(:_Lufar13_RealY)
alias _Lufar13_RealX= x= unless method_defined?(:_Lufar13_RealX=)
alias _Lufar13_RealY= y= unless method_defined?(:_Lufar13_RealY=)
def x
@x
end
def y
@y
end
def x=(val)
@x = val
self._Lufar13_RealX = @x + @shake_x
end
def y=(val)
@y = val
self._Lufar13_RealY = @y + @shake_y
end
#--------------------------------------------------------------------------
# ● リフレッシュ
#--------------------------------------------------------------------------
if rpgxp?
alias _Lufar13_PrototypeOfRefreshment refresh
def refresh
@hshake = $game_temp.message_hshake
$game_temp.message_hshake = false
@vshake = $game_temp.message_vshake
$game_temp.message_vshake = false
@fade_in_duration = 16
_Lufar13_UpdateShake
_Lufar13_PrototypeOfRefreshment
end
end
#--------------------------------------------------------------------------
# ● フレーム更新
#--------------------------------------------------------------------------
alias _Lufar13_PrototypeOfUpdating update
def update
if rpgxp?
## フェードイン?
if @fade_in
@fade_in_duration -= 1
if @fade_in_duration <= 0
@hshake = @vshake = false
@fade_in = false
end
_Lufar13_UpdateShake
self.contents_opacity = 255
self.contents_opacity -= @fade_in_duration * 15 unless @hshake || @vshake
return if @fade_in_duration > 0
end
else
_Lufar13_UpdateShake
end
# フレーム更新
_Lufar13_PrototypeOfUpdating
if rpgxp?
self.contents_opacity = 0xFF if @fade_in and @hshake || @vshake
## フェードアウト?
if @fade_out_duration > 0
self.visible = true
@fade_out = true
$game_temp.message_window_showing = true
end
if @fade_out
@fade_out_duration = 5 if @fade_out_duration <= 0
@fade_out_duration -= 1
self.opacity = @fade_out_duration * 51
if @fade_out_duration == 0
self.visible = false
@fade_out = false
$game_temp.message_window_showing = false
end
end
end
end
#--------------------------------------------------------------------------
# ○ シェイク更新
#--------------------------------------------------------------------------
def _Lufar13_UpdateShake
if rpgxp?
@shake_x = if @hshake then case Graphics.frame_count & 0b11
when 0 then +(@fade_in_duration + 1 & ~1)
when 1, 3 then 0
when 2 then -(@fade_in_duration + 1 & ~1)
end; else 0
end
@shake_y = if @vshake then case Graphics.frame_count & 0b11
when 0 then +(@fade_in_duration + 1 & ~1)
when 1, 3 then 0
when 2 then -(@fade_in_duration + 1 & ~1)
end; else 0
end
else
return if @shake_duration <= 0
@shake_x = if @hshake then case @shake_duration % 6
when 1 then +(@shake_duration / 3 * 2)
when 0, 2 then +(@shake_duration / 3 * 2) / 2
when 3, 5 then -(@shake_duration / 3 * 2) / 2
when 4 then -(@shake_duration / 3 * 2)
end; else 0
end
@shake_y = if @vshake then case @shake_duration % 6
when 1 then +(@shake_duration / 3 * 2)
when 0, 2 then +(@shake_duration / 3 * 2) / 2
when 3, 5 then -(@shake_duration / 3 * 2) / 2
when 4 then -(@shake_duration / 3 * 2)
end; else 0
end
@shake_duration -= 1
@wait_count = 1 if @text == nil
end
self.x = x
self.y = y
end
#--------------------------------------------------------------------------
# ● 早送りフラグの更新
#--------------------------------------------------------------------------
unless rpgxp?
alias _Lufar13_PrototypeOfUpdatingShowFast update_show_fast
def update_show_fast
if @shake_duration > 0
@show_fast = true
else
_Lufar13_PrototypeOfUpdatingShowFast
end
end
end
#--------------------------------------------------------------------------
# ● メッセージの開始
#--------------------------------------------------------------------------
unless rpgxp?
alias _Lufar13_PrototypeOfStartingMessage start_message
def start_message
_Lufar13_PrototypeOfStartingMessage
@hshake = $game_temp.message_hshake
$game_temp.message_hshake = false
@vshake = $game_temp.message_vshake
$game_temp.message_vshake = false
@shake_duration = @hshake || @vshake ? 24 : 0
end
end
end
戻る