# ============================================================================= # TheoAllen - VX Style Choices # Version : 1.0b # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com # (This script documentation is written in informal indonesian language) # ============================================================================= ($imported ||= {})[:Theo_VXStyleChoices] = true # ============================================================================= # CHANGE LOGS: # ----------------------------------------------------------------------------- # 2013.10.14 - Bugfix. Choice isn't displayed if it isn't followed by texts # 2013.10.12 - Finished script # ============================================================================= =begin Perkenalan : Script ini ngebikin kamu bisa gunain style choice kek VX Cara penggunaan : Pasang script ini dibawah material namun diatas main. Gunakan script call sebagai berikut buat nampilin choice model VX. vx_choice(true) << buat ngehidupin vx_choice(false) << buat ngematiin Terms of use : Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau dipake buat komersil, jangan lupa, gw dibagi gratisannya. =end # ============================================================================= # Tidak ada konfigurasi # ============================================================================= class Game_Interpreter def vx_choice(bool) $game_message.vx_choice = bool end end class Game_Message attr_accessor :vx_choice alias theo_vxchoice_init initialize def initialize theo_vxchoice_init @vx_choice = true end end class Window_Message < Window_Base alias theo_vxchoice_init initialize def initialize theo_vxchoice_init init_vxchoice_member end def init_vxchoice_member @need_clear = false @choice_index = 0 @choice_y = 0 end alias theo_vxchoice_input input_choice def input_choice return start_vx_choice if $game_message.vx_choice return theo_vxchoice_input end alias theo_vxchoice_new_page new_page def new_page(text, pos) theo_vxchoice_new_page(text, pos) @need_clear = ($game_message.texts.size + $game_message.choices.size) > visible_line_number end alias theo_vxchoice_new_line process_new_line def process_new_line(text, pos) theo_vxchoice_new_line(text, pos) @choice_y = pos[:y] end def start_vx_choice open_and_wait unless open? if @need_clear input_need_clear end @choice_index = 0 ypos = 0 $game_message.choices.each do |choice| draw_text_ex(new_line_x + padding_x, @choice_y + ypos, choice) ypos += line_height end update_vx_choice(@choice_y) end def padding_x return 16 end def input_need_clear input_pause contents.clear @choice_y = 0 @need_clear = false end def update_vx_choice(ypos) rect_width = contents.width - new_line_x - rface cursor_rect.set(new_line_x, ypos, rect_width, line_height) wait(10) until Input.trigger?(:C) || (Input.trigger?(:B) && cancel_enabled?) update_choice_cursor Fiber.yield end cursor_rect.empty execute_choice Input.update end def rface ($imported[:Theo_RightSideFace] && !$game_message.face_name.empty? && $game_message.rface) ? 100 : 0 end def cancel_enabled? $game_message.choice_cancel_type > 0 end def update_choice_cursor cursor_rect.y = @choice_y + @choice_index * line_height change_choice_index(1) if Input.repeat?(:DOWN) change_choice_index(-1) if Input.repeat?(:UP) end def change_choice_index(amount) Sound.play_cursor @choice_index += amount wrap_index end def wrap_index @choice_index = 0 if @choice_index > $game_message.choices.size - 1 @choice_index = $game_message.choices.size - 1 if @choice_index < 0 end def execute_choice call_ok_handler if Input.trigger?(:C) call_cancel_handler if Input.trigger?(:B) end def call_ok_handler Sound.play_ok $game_message.choice_proc.call(@choice_index) end def call_cancel_handler Sound.play_cancel $game_message.choice_proc.call($game_message.choice_cancel_type - 1) end end