Jump to content

Recommended Posts

Message Window SEs v1.0

Author: FenixFyreX

 

Introduction

This script plays an SE after a user defined wait time when displaying text in the Message Window. You can choose whether the text waits that defined wait time, or just the SE waits.

 

Script

 

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
# 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,&
   @fyx_waits = {:char => fyx_wait(:char),
                 :line => fyx_wait(:line),
                 :page => fyx_wait(:page), }
   initialize_char_se_wait(*a,&
 end

 alias new_page_se_fyx new_page
 def new_page(*a,&
   new_page_char_wait
   new_page_se_fyx(*a,&
 end

 alias process_new_line_se_fyx process_new_line
 def process_new_line(*a,&
   new_line_char_wait
   process_new_line_se_fyx(*a,&
 end

 alias process_escape_se_fyx process_escape_character
 def process_escape_character(*a,&
   fyx_escape_se(a[0].upcase).play rescue nil
   process_escape_se_fyx(*a,&
 end

 alias process_norm_char_se_fyx process_normal_character
 def process_normal_character(*a,&
   normal_char_wait
   process_norm_char_se_fyx(*a,&
 end

 alias close_n_wait_se_fyx close_and_wait
 def close_and_wait(*a,&
   close_n_wait_se_fyx(*a,&
   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

 

 

Please do alert me of any errors if you test it. I'll be glad to fix them.

 

Credit myself.

Share this post


Link to post
Share on other sites

Was looking for something just like this, but sadly I'm getting an error when I try to use it:

 

 

line 55 syntax error occurred

 

Unexpected tCONSTANT, expecting tIDENTIFIER

def initialize(*a,&B )

Edited by Sarus Walker

Share this post


Link to post
Share on other sites

Was looking for something just like this, but sadly I'm getting an error when I try to use it:

 

 

line 55 syntax error occurred

 

Unexpected tCONSTANT, expecting tIDENTIFIER

def initialize(*a,&B )

 

Same error

Share this post


Link to post
Share on other sites

Thanks a mil, mate, it a works just fine. I'm sure Fenix won't mind, after all I'm sure he'd prefer that people use his script especially since there's nothing else like it yet. Again, thank you Fenix for the nice script, and thank you kindly Niclas for fixing the problem.

Share this post


Link to post
Share on other sites

To FenixFyre, or anyone else who might know the answer,

 

If I planned on having voice overs in my project, would this be a good script to use?

 

I've downloaded and played with it, and I know how it works, but I'm not sure how I would go about using this with Voice SEs.

 

Thanks for taking the time to read this.

Share this post


Link to post
Share on other sites

To FenixFyre, or anyone else who might know the answer,

 

If I planned on having voice overs in my project, would this be a good script to use?

 

I've downloaded and played with it, and I know how it works, but I'm not sure how I would go about using this with Voice SEs.

 

Thanks for taking the time to read this.

If you're going to have voice overs, you could just play each bit of dialogue audio individually before its respective message, which'll play as the message is being drawn. This script, as I understand it, is more for blanket sounds played during messages and wouldn't be very effective for voice overs.

 

Try something like this:

ROqEZ.png

 

In this example, Applause1 would be the actor saying "Congratulations!"

Edited by pfhorwhore

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted