#------------------------------------------------------------------------------- # イベントテストスクリプト for VXAce 製作者:奏ねこま(おとぶきねこま) #------------------------------------------------------------------------------- # 任意のイベントを選択して直接実行します。 # # [ 使い方 ] # #  タイトル画面でF9を押すと、イベントテスト画面に移行します。 #  各ウインドウについては以下をご参照ください。 # # <マップリスト(初期表示)> # #  マップの一覧を表示します。 #  「000:コモンイベント」を選択すると、コモンイベントリストを表示します。 #  001以降を選択すると、選択したマップのイベントリストを表示します。 # # <イベントリスト> # #  マップイベントの一覧を表示します。 #  イベントを選択すると、ページリストを表示します。 # # <ページリスト> # #  イベントのページ一覧を表示します。 #  ページを選択すると、イベント実行開始ウインドウを表示します。 # # <コモンイベントリスト> # #  コモンイベントの一覧を表示します。 #  イベントを選択すると、イベント実行開始ウインドウを表示します。 # # <イベント実行開始ウインドウ> # #  イベント開始時の設定とイベント実行を行うウインドウです。 #  「イベント実行」を選択すると、イベントを実行します。 #  「イベント実行」以外の項目は、左右キーで設定の変更ができます。 #  「イベント実行」以外で決定キーを押すと、「イベント実行」に移動します。 # #  [ イベント実行 ] #   決定キーを押すと、イベントを実行します。 # #  [ プレイヤーの位置 ] #   イベント実行時のプレイヤーの位置を、左右キーで選択します。 #    - イベント座標:実行するイベントと同じ座標に設定します。 #    - イベントの上:実行するイベントの上に設定します。 #    - イベントの右:実行するイベントの右に設定します。 #    - イベントの下:実行するイベントの下に設定します。 #    - イベントの左:実行するイベントの左に設定します。 #    - 指定座標  :指定した座標に設定します。(XYを左右キーで変更) #   ※XYを変更すると、自動的に「指定座標」に設定されます。 # #  [ プレイヤーの向き ] #   イベント実行時のプレイヤーの向きを、左右キーで選択します。 #    - 上:上向きに設定します。 #    - 右:右向きに設定します。 #    - 下:下向きに設定します。 #    - 左:左向きに設定します。 # #  [ プレイヤーの表示 ] #   イベント実行時のプレイヤーの表示状態を、左右キーで選択します。 #    - 表示する :プレイヤーを表示します。 #    - 表示しない:プレイヤーを表示しません(透明状態)。 # #  [ 変数・スイッチ ] #   イベント実行時の変数とスイッチの状態を、左右キーで選択します。 #    - 初期値       :初期状態に設定します。 #    - デバッグ画面で設定 :イベント実行前にデバッグ画面を表示します。 #    - セーブデータをロード:イベント実行前にロード画面を表示します。 #               :ロードしたデータの変数とスイッチを反映します。 #   ※ロードで反映されるのは変数とスイッチのみです。 # # [ 利用規約 ] ................................................................. # 本スクリプトの利用者は、RPGツクールVXAceの正規ユーザーに限られます。 # 商用、非商用、ゲームの内容(年齢制限など)を問わず利用可能です。 # ゲームへの利用の際、報告や出典元の記載等は必須ではありません。 # 二次配布や転載、ソースコードURLやダウンロードURLへの直接リンクは禁止します。 # (スクリプトを利用したゲームに同梱する形での結果的な配布はOKです) # 不具合対応以外のサポートやリクエストは受け付けておりません。 # 本スクリプトにより生じたいかなる問題においても、一切の責任を負いかねます。 # [ 改訂履歴 ] ................................................................. # Version 1.00 2016/10/08 初版 # -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ # Web Site: http://makonet.sakura.ne.jp/rpg_tkool/ # Twitter : https://twitter.com/koma_neko #------------------------------------------------------------------------------- # Scene_Title #------------------------------------------------------------------------------- class Scene_Title alias :makonet003_update :update def update makonet003_update SceneManager.call(Scene_EventTest) if $TEST && Input.press?(:F9) end end #------------------------------------------------------------------------------- # Scene_LoadForEventTest #------------------------------------------------------------------------------- class Scene_LoadForEventTest < Scene_Load def on_savefile_ok game_system = $game_system game_timer = $game_timer game_message = $game_message game_self_switches = $game_self_switches game_actors = $game_actors game_party = $game_party game_troop = $game_troop game_map = $game_map game_player = $game_player super $game_system = game_system $game_timer = game_timer $game_message = game_message $game_self_switches = game_self_switches $game_actors = game_actors $game_party = game_party $game_troop = game_troop $game_map = game_map $game_player = game_player end def on_load_success Sound.play_load SceneManager.return end end #------------------------------------------------------------------------------- # Game_Map #------------------------------------------------------------------------------- class Game_Map def setup_for_test(map_id, event_id, list) setup(map_id) @interpreter.setup(list, event_id) end end #------------------------------------------------------------------------------- # Scene_EventTest #------------------------------------------------------------------------------- class Scene_EventTest < Scene_MenuBase def start super @map_list = [] @event_list = [] @page_list = [] @common_list = [] create_map_window create_event_window create_page_window create_common_window create_command_window end def load_map common = RPG::MapInfo.new common.name = "コモンイベント" @map_list = [[0, common]] load_data("Data/MapInfos.rvdata2").sort.each{|id, data| @map_list.push([id, data]) } end def load_event(index) @event_list = [] load_data(sprintf("Data/Map%03d.rvdata2", @map_list[index][0])).events.sort.each{|id, data| @event_list.push([id, data]) } end def load_page(index) @page_list = [] pages = @event_list[index][1].pages pages.each_index{|index| data = RPG::Event.new(0, 0) data.id = index data.pages = [pages[index]] @page_list.push([index, data]) } end def load_common @common_list = [] load_data("Data/CommonEvents.rvdata2").each{|data| @common_list.push([data.id, data]) if data } end def create_map_window @map_window = Window_EventTestList.new(0) @map_window.set_handler(:ok, method(:on_ok_map)) @map_window.set_handler(:cancel, method(:on_cancel_map)) load_map @map_window.set_list(@map_list) @map_window.activate end def create_event_window @event_window = Window_EventTestList.new(Graphics.width / 3) @event_window.set_handler(:ok, method(:on_ok_event)) @event_window.set_handler(:cancel, method(:on_cancel_event)) @event_window.visible = false end def create_page_window @page_window = Window_EventTestList.new(Graphics.width / 3 * 2) @page_window.set_handler(:ok, method(:on_ok_page)) @page_window.set_handler(:cancel, method(:on_cancel_page)) @page_window.visible = false end def create_common_window @common_window = Window_EventTestList.new(Graphics.width / 3) @common_window.set_handler(:ok, method(:on_ok_common)) @common_window.set_handler(:cancel, method(:on_cancel_common)) @common_window.visible = false end def create_command_window @command_window = Window_EventTestCommand.new @command_window.set_handler(:ok, method(:on_ok_command)) @command_window.set_handler(:cancel, method(:on_cancel_command)) @command_window.visible = false end def on_ok_map if (@map_window.index > 0) load_event(@map_window.index) @event_window.set_list(@event_list) @event_window.activate @event_window.visible = true else load_common @common_window.set_list(@common_list) @common_window.activate @common_window.visible = true end end def on_cancel_map SceneManager.return end def on_ok_event load_page(@event_window.index) @page_window.set_list(@page_list) @page_window.activate @page_window.visible = true end def on_cancel_event @event_window.visible = false @event_window.deactivate @map_window.activate end def on_ok_page event = @event_list[@event_window.index][1] @command_window.prepare(event.x, event.y) @command_window.select(0) @command_window.activate @command_window.visible = true end def on_cancel_page @page_window.visible = false @page_window.deactivate @event_window.activate end def on_ok_common @command_window.prepare(0, 0, true) @command_window.select(0) @command_window.activate @command_window.visible = true end def on_cancel_common @common_window.visible = false @common_window.deactivate @map_window.activate end def on_ok_command if @page_window.visible map_id = @map_list[@map_window.index][0] event_id = @event_list[@event_window.index][0] command_list = @page_list[@page_window.index][1].pages[0].list else map_id = $data_system.start_map_id event_id = 0 command_list = @common_list[@common_window.index][1].list end settings = @command_window.settings DataManager.setup_new_game $game_map.setup_for_test(map_id, event_id, command_list) $game_player.center(settings[:x], settings[:y]) $game_player.moveto(settings[:x], settings[:y]) $game_player.set_direction(settings[:direction]) $game_player.transparent = settings[:transparent] SceneManager.goto(Scene_Map) SceneManager.call(Scene_Debug) if settings[:startup] == 1 SceneManager.call(Scene_LoadForEventTest) if settings[:startup] == 2 end def on_cancel_command @command_window.visible = false @command_window.deactivate if @page_window.visible @page_window.activate else @common_window.activate end end end #------------------------------------------------------------------------------- # Window_EventTestList #------------------------------------------------------------------------------- class Window_EventTestList < Window_Selectable def initialize(x) @item_list = [] super(x, 0, Graphics.width - x, Graphics.height) end def set_list(list) @item_list = list create_contents select(0) refresh end def item_max @item_list.length end def draw_item(index) id = @item_list[index][0] data = @item_list[index][1] if data.name != '' text = sprintf("%03d:%s", id, data.name) else text = sprintf("%02d:", id) end draw_text(4, line_height * index, contents_width, line_height, text) end end #------------------------------------------------------------------------------- # Window_EventTestCommand #------------------------------------------------------------------------------- class Window_EventTestCommand < Window_Command def initialize @settings = [ {:index => 0, :text => [""]}, {:index => 0, :text => ["イベント座標", "イベントの上", "イベントの右", "イベントの下", "イベントの左", "指定座標"]}, {:index => 0, :text => [""]}, {:index => 0, :text => [""]}, {:index => 0, :text => ["上", "右", "下", "左"]}, {:index => 0, :text => ["表示する", "表示しない"]}, {:index => 0, :text => ["初期値", "デバッグ画面で設定", "セーブデータをロード"]} ] @event_x = 0 @event_Y = 0 @is_common = false clear_command_list make_command_list super((Graphics.width - window_width) / 2, (Graphics.height - window_height) / 2) refresh select(0) end def window_width return 365 end def make_command_list add_command("イベント実行", :symbol) add_command("プレイヤーの位置", :symbol) add_command("                X:", :symbol) add_command("                Y:", :symbol) add_command("プレイヤーの向き", :symbol) add_command("プレイヤーの表示", :symbol) add_command("変数・スイッチ", :symbol) end def prepare(x, y, is_common = false) @event_x = x @event_y = y @is_common = is_common @settings.each{|setting| setting[:index] = 0 } @settings[1][:index] = 5 if @is_common @settings[2][:index] = @event_x @settings[3][:index] = @event_y refresh end def cursor_right(wrap = false) super(wrap) if index > 0 @settings[index][:index] += 1 if [1,4,5,6].include?(index) @settings[index][:index] = 0 if @settings[index][:index] >= @settings[index][:text].length end if @is_common || [2,3].include?(index) @settings[1][:index] = 5 end set_position if index == 1 Sound.play_cursor refresh end end def cursor_left(wrap = false) super(wrap) if index > 0 @settings[index][:index] -= 1 if @settings[index][:index] < 0 @settings[index][:index] = [1,4,5,6].include?(index) ? @settings[index][:text].length - 1 : 0 end if @is_common || [2,3].include?(index) @settings[1][:index] = 5 end set_position if index == 1 Sound.play_cursor refresh end end def set_position if @settings[1][:index] < 5 @settings[2][:index] = @event_x + [0,0,1,0,-1][@settings[1][:index]] @settings[3][:index] = @event_y + [0,-1,0,1,0][@settings[1][:index]] @settings[2][:index] = 0 if @settings[2][:index] < 0 @settings[3][:index] = 0 if @settings[3][:index] < 0 end end def settings { :x => @settings[2][:index], :y => @settings[3][:index], :direction => [8,6,2,4][@settings[4][:index]], :transparent => @settings[5][:index] == 1, :startup => @settings[6][:index] } end def draw_item(index) change_color(normal_color, command_enabled?(index)) draw_text(item_rect_for_text(index), command_name(index), index > 0 ? 0 : 1) setting_text = [0,1,4,5,6].include?(index) ? @settings[index][:text][@settings[index][:index]] : @settings[index][:index].to_s draw_text(item_rect_for_text(index), setting_text, 2) end def process_ok if index == 0 Sound.play_ok Input.update deactivate call_ok_handler else select(0) Sound.play_cursor end end end