Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
- # Message Window SEs v1.0
- # FenixFyreX
- # RPG Maker VxAce
- # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
- # This script adds sound effects to the characters and control characters drawn
- # in the message window. You can choose for the character to wait with the se,
- # or just for the se to wait, thus not slowing the text any.
- # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
- module FyxA
- module LetterSE
- # How long should each respective type of characte wait? In frames.
- Waits = {
- :char => 1,
- :line => 4,
- :page => 22, }
- # Should the respective type of character wait for its alotted time above,
- # or should just the SE wait?
- CharsWait = {
- :char => true,
- :line => true,
- :page => true, }
- # RPG::SE.new(name,volume,pitch)
- # volume and pitch can be left out, or included.
- # Set to nil for no sound effect at all.
- SEs = {
- :char => RPG::SE.new("Switch1",70),
- :line => RPG::SE.new("Bell3", 70),
- :page => RPG::SE.new("Book1"),
- :gold => nil,
- :wait => nil,
- :input => nil,
- :fast => nil,
- :slow => nil,
- :skip => nil,
- :color => nil,
- :icon => nil,
- :big => nil,
- :small => nil, }
- end
- end
- class Window_Message < Window_Base
- alias initialize_char_se_wait initialize
- def initialize(*a,&b)
- @fyx_waits = {:char => fyx_wait(:char),
- :line => fyx_wait(:line),
- :page => fyx_wait(:page), }
- initialize_char_se_wait(*a,&b)
- end
- alias new_page_se_fyx new_page
- def new_page(*a,&b)
- new_page_char_wait
- new_page_se_fyx(*a,&b)
- end
- alias process_new_line_se_fyx process_new_line
- def process_new_line(*a,&b)
- new_line_char_wait
- process_new_line_se_fyx(*a,&b)
- end
- alias process_escape_se_fyx process_escape_character
- def process_escape_character(*a,&b)
- fyx_escape_se(a[0].upcase).play rescue nil
- process_escape_se_fyx(*a,&b)
- end
- alias process_norm_char_se_fyx process_normal_character
- def process_normal_character(*a,&b)
- normal_char_wait
- process_norm_char_se_fyx(*a,&b)
- end
- alias close_n_wait_se_fyx close_and_wait
- def close_and_wait(*a,&b)
- close_n_wait_se_fyx(*a,&b)
- self.contents.clear
- end
- def obtain_escape_param_!(text)
- text.slice(/^\[\d+\]/)[/\d+/].to_i rescue 0
- end
- def char_wait_se?(sym)
- (b = FyxA::LetterSE::CharsWait[sym]).nil? ? false : b
- end
- def fyx_wait(sym)
- (n = FyxA::LetterSE::Waits[sym]).nil? ? 0 : n
- end
- def reset_fyx_wait(sym)
- @fyx_waits[sym] = fyx_wait(sym)
- end
- def fyx_escape_se(code)
- case code
- when '$'; fyx_char_se(:gold)
- when '.','|'; fyx_char_se(:wait)
- when '!'; fyx_char_se(:input)
- when '>'; fyx_char_se(:fast)
- when '<'; fyx_char_se(:slow)
- when '^'; fyx_char_se(:skip)
- when 'C'; fyx_char_se(:color)
- when 'I'; fyx_char_se(:icon)
- when '{'; fyx_char_se(:big)
- when '}'; fyx_char_se(:small)
- end
- end
- def fyx_char_se(sym)
- (se = FyxA::LetterSE::SEs[sym]).nil? ? RPG::SE.new : se
- end
- def normal_char_wait
- if char_wait_se?(:char)
- wait(fyx_wait(:char))
- fyx_char_se(:char).play rescue nil
- else
- update_normal_char_wait
- end
- end
- def new_line_char_wait
- if char_wait_se?(:line)
- wait(fyx_wait(:line))
- fyx_char_se(:line).play rescue nil
- else
- update_line_char_wait
- end
- end
- def new_page_char_wait
- self.contents.clear
- if char_wait_se?(:page)
- wait(fyx_wait(:page))
- fyx_char_se(:page).play rescue nil
- else
- update_page_char_wait
- end
- end
- def update_normal_char_wait
- @fyx_waits[:char] -= 1
- if @fyx_waits[:char] <= 0
- fyx_char_se(:char).play rescue nil
- reset_fyx_wait(:char)
- end
- end
- def update_line_char_wait
- @fyx_waits[:line] -= 1
- if @fyx_waits[:line] <= 0
- fyx_char_se(:line).play rescue nil
- reset_fyx_wait(:line)
- end
- end
- def update_page_char_wait
- @fyx_waits[:page] -= 1
- if @fyx_waits[:page] <= 0
- fyx_char_se(:page).play rescue nil
- reset_fyx_wait(:page)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement