●導入位置
・execute_commandを再定義しているので出来れば上の方に導入してください。
●注意点
・このスクリプトの導入は自己責任で行ってください。
・規格外のメソッドを定義したりmethod_missingを使用していますからこのスクリプトの導入にはそれなりのリスクがある点をご理解ください。
コード: 全て選択
#==============================================================================
# ■ Game_Interpreter
#------------------------------------------------------------------------------
# イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、
# Game_Troop クラス、Game_Event クラスの内部で使用されます。
#==============================================================================
class Game_Interpreter
#--------------------------------------------------------------------------
# ● イベントコマンドの実行
#--------------------------------------------------------------------------
def execute_command
command = @list[@index]
@params = command.parameters
@indent = command.indent
send(command.code.to_s)
end
#--------------------------------------------------------------------------
# ● 未定義のコマンド(何もしない)
#--------------------------------------------------------------------------
def command_no_response
end
#--------------------------------------------------------------------------
# ● method_missing
#--------------------------------------------------------------------------
def method_missing(method_name,*args,&block)
method_name.to_s.match(/\A(\d+)\Z/) do |cmd|
old_method_name = "command_#{cmd[1]}"
old_method_name = :command_no_response unless respond_to?(old_method_name)
self.class.send(:alias_method,cmd[1],old_method_name)
return send(cmd[1])
end
super
end
end





