MSS Text SE

Discussion in 'RGSS3 Scripts (RMVX Ace)' started by mobychan, Jul 23, 2012.

  1. mobychan

    mobychan CodeMaster Veteran

    Messages:
    297
    Likes Received:
    43
    Location:
    Baden-Würrtemberg - Germany
    First Language:
    German
    [​IMG]



    Text SE - V1.0

    Last Update: 2012.07.23


    Updates:

    • N/A

    Script Description:

    This Script plays a SE you define in the module at the top every x letters.

    These settings can be made in a module:

    • SE File Name
    • Pitch Range
    • Volume
    • Interval(x)

    List of methods:

    Overridden methods:
    • None

    Aliased methods:

    • class Window_Message
      - initialize
      - process_normal_character
      - process_new_page

    New methods:

    • module Sound
      - play_text_se
    Compatible Scripts:

    Should be compatible to nearly everything, if you have problems try putting this script below every other script you have.

    Screenshots:

    Sound is kinda hard to capture in a screenshot ;)

    It is setup to play the RTP Cursor1 sound, so just put it in your project and test it out ^^

    Script:

    Script

    Credits:

    • mobychan
    • Hyde for requesting it

    FAQ:

    Any questions?

    Just ask here or per mail(mobychan@gmx.de)

    Want to commission something?

    Please look here
     
    Last edited by a moderator: Aug 1, 2012
    #1
  2. hyde9318

    hyde9318 RMC Coordinator Veteran

    Messages:
    2,593
    Likes Received:
    679
    Location:
    Michigan, USA
    First Language:
    English
    Primarily Uses:
    RMMV
    Awesome script Moby, truly useful. It always spices up text alot to have it play a sound during it. And, although most of them were VX, not many scripts that do this, do it with as many options as yours. They usually just let you set a sound and move on. Yours lets them pick a sound, choose an interval, set a random range for the sounds (which is useful for when you want the illusion of voices), and even lets you set the volume. Couldn't ask for a better script.
     
    #2
  3. Nybras

    Nybras Veteran Veteran

    Messages:
    36
    Likes Received:
    0
    Location:
    Copenhagen
    First Language:
    Danish
    Great work. I was wondering if there is any way to bind a uniqe sound and/or pitch to a specific actor and/or npc? So all characters in the game don't "talk" the same way?
     
    #3
  4. Bird Eater

    Bird Eater Boredom is just another thing you want to avoid Veteran

    Messages:
    272
    Likes Received:
    26
    First Language:
    Dutch
    Hi, made that modification a while ago for someone on the IRC.

    You can modify it to your likes, it's really not hard.

    Code:
    ################################################################################
    # Made by mobychan, slightly edited by Bird Eater.
    # Give mobychan the cookies.
    # http://forums.rpgmakerweb.com/index.php?/topic/3463-mss-text-se/
    #
    #
    # INSTRUCTIONS:
    # Place above 'Main' in the scripts section but below 'Materials'.
    # Change things in module TSE to your liking to vary the sound, pitch and volume
    # of the SE played. These correspond with the value VARIABLE 5 has. Make sure
    # variable 5 has a value between 1 and 7. HAVE FUN.
    #
    # So if variable 5 is equal to 5,
    # SE5 will be played
    # Pitch5 will be used
    # With a volume of Volume5
    ################################################################################
    module TSE
    
    # The name of the file that will be played, must be placed in Audio/SE
    # CHANGE THESE TO ALTHER THE SOUND PLAYED DURING THE MESSAGE
    SE1 = "Cursor1"
    SE2 = "Cursor1"
    SE3 = "Cursor1"
    SE4 = "Cursor1"
    SE5 = "Cursor1"
    SE6 = "Cursor1"
    SE7 = "Cursor1"
    
    # The pitch range of the file being played, change them however you like
    # [start_pitch, end_pitch]
    # start and end pitch can be the same to have a static pitch
    # CHANGE THESE TO ALTER THE DIFFERENT PITCHES!
    Pitch1 = [50, 60]
    Pitch2 = [70, 90]
    Pitch3 = [90, 110]
    Pitch4 = [120, 130]
    Pitch5 = [130, 140]
    Pitch6 = [140, 150]
    Pitch7 = [150, 160]
    
    # The volume of the file being played
    Volume1 = 90
    Volume2 = 100
    Volume3 = 100
    Volume4 = 100
    Volume5 = 100
    Volume6 = 100
    Volume7 = 110
    
    # The interval at which the sound is being played, every x characters
    Interval = 4
    end
    #==============================================================================
    # ** Sound
    #==============================================================================
    module Sound
    # System Sound Effect
    def self.play_text_se
    #puts $game_variables[5]
    if $game_variables[5] == 1
    	 file = "Audio/SE/" + TSE::SE1
    	 pitch = rand(TSE::Pitch1[1] - TSE::Pitch1[0]) + TSE::Pitch1[0]
    	 Audio.se_play(file, TSE::Volume1, pitch)
    elsif $game_variables[5] == 2
    	 file = "Audio/SE/" + TSE::SE2
    	 pitch = rand(TSE::Pitch2[1] - TSE::Pitch2[0]) + TSE::Pitch2[0]
    	 Audio.se_play(file, TSE::Volume2, pitch)
    elsif $game_variables[5] == 3
    	 file = "Audio/SE/" + TSE::SE3
    	 pitch = rand(TSE::Pitch3[1] - TSE::Pitch3[0]) + TSE::Pitch3[0]
    	 Audio.se_play(file, TSE::Volume3, pitch)
    elsif $game_variables[5] == 4
    	 file = "Audio/SE/" + TSE::SE4
    	 pitch = rand(TSE::Pitch4[1] - TSE::Pitch4[0]) + TSE::Pitch4[0]
    	 Audio.se_play(file, TSE::Volume4, pitch)
    elsif $game_variables[5] == 5
    	 file = "Audio/SE/" + TSE::SE5
    	 pitch = rand(TSE::Pitch5[1] - TSE::Pitch5[0]) + TSE::Pitch5[0]
    	 Audio.se_play(file, TSE::Volume5, pitch)
    elsif $game_variables[5] == 6
    	 file = "Audio/SE/" + TSE::SE6
    	 pitch = rand(TSE::Pitch6[1] - TSE::Pitch6[0]) + TSE::Pitch6[0]
    	 Audio.se_play(file, TSE::Volume6, pitch)
    elsif $game_variables[5] == 7
    	 file = "Audio/SE/" + TSE::SE7
    	 pitch = rand(TSE::Pitch7[1] - TSE::Pitch7[0]) + TSE::Pitch7[0]
    	 Audio.se_play(file, TSE::Volume7, pitch)
    else
    	 #puts "Your variable number 9 isn't 1-7, change it!"
    end
    end
    end
    #==============================================================================
    # ** Window_Message
    #==============================================================================
    class Window_Message < Window_Base
    #--------------------------------------------------------------------------
    # * Object Initialization
    #--------------------------------------------------------------------------
    alias tse_init initialize unless $@
    def initialize
    	 tse_init
    	 @character = 0
    end
    #--------------------------------------------------------------------------
    # * Normal Character Processing
    #--------------------------------------------------------------------------
    alias tse_process_normal_character process_normal_character unless $@
    def process_normal_character(c, pos)
    	 tse_process_normal_character(c, pos)
    	 Sound.play_text_se if @character % TSE::Interval == 0 && !@line_show_fast
    	 #p @character if @character % TSE::Interval == 0 && !@line_show_fast
    	 @character += 1
    end
    alias tse_process_new_page process_new_page unless $@
    #--------------------------------------------------------------------------
    # * New Page Character Processing
    #--------------------------------------------------------------------------
    def process_new_page(text, pos)
    	 tse_process_new_page(text, pos)
    	 @character = 0
    end
    end
    
     
    Last edited by a moderator: Oct 2, 2012
    #4
    Badweather4cast and readydotexe like this.
  5. Nybras

    Nybras Veteran Veteran

    Messages:
    36
    Likes Received:
    0
    Location:
    Copenhagen
    First Language:
    Danish
    Thanks for your reply :)

    I just started out with RPG maker ace, so I'm a bit off a script noob. I cannot see how to "bind" a sound/pitch to a certain actor from the script you posted but I will take a closer look when I get home from work.

    Eg. I would like the skinny girl in the party to alway talk with a high pitch and the buffed warrior a low pitch and different sound. Just like the old classic Sega RPG game Shining in the darkness :)
     
    #5
  6. Nosleinad

    Nosleinad Storyteller Veteran

    Messages:
    351
    Likes Received:
    28
    Location:
    Brazil
    First Language:
    Portuguese
    (I hope this is not considered necroposting, as this is the official script topic)

     I am using this script, it really adds a nice feeling to the messages and it's very easy to use. There's just one thing that's a bit annoying: everytime a player press enter during a message, there's a 1 sec delay for the entire message to show up, and all the SE will be played at once. I am sure the lag is due to the ammount of SE playing at once, so i'd like to ask if it's hard to implement a "no text SE will be played when pressing enter on messages".

     Thanks in advance!!
     
    Last edited by a moderator: Apr 9, 2013
    #6
  7. Oriceles

    Oriceles 0 + a.atk * 4 - b.def * 2 Veteran

    Messages:
    384
    Likes Received:
    70
    Location:
    Venezuela
    First Language:
    Spanish
    Primarily Uses:
    RMMV
    Moby I want a similar request as the one of Nosleinad. Fenifyrex has a very similar script to yours but he has more options like adding sounds to new lines and pages, It is just that his script lacks of interval on character sound so it's pretty annoying. I was wondering if you can add lines and pages sounds too on the next version please? :D
     
    #7
  8. RadDevVan101

    RadDevVan101 Devin Manning Member

    Messages:
    24
    Likes Received:
    2
    First Language:
    English
    Is it possible to change the sound on the fly? Like having specific character have specific sounds for their messages?

    If not then it would be a nice feature
     
    #8
  9. Pumamori

    Pumamori Veteran Veteran

    Messages:
    108
    Likes Received:
    20
    First Language:
    German
    Primarily Uses:
    RMVXA
    Bird Eater posted a script to do just that. From what I can tell, all you have to do is change your fifth variable to any number from 1-7 that you defined in the header. 

    But it's in the instructions anyway, just give it a shot, I know I will! :) 
     
    #9
  10. kae

    kae Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    english
    I have the script placed above the main.. but.. how do I use it?


    With an event or something? None of my NPCs are making a sound..?
     
    #10
  11. xismage

    xismage Warper Member

    Messages:
    1
    Likes Received:
    0
    First Language:
    Portuguese
    I used this script, tidily pasted into "(insert here)" from Materials, but still didn't get what i wanted, to each character play a unique sound in their dialogue.
    In fact, when i tried, i couldn't get Any sound to play...


    I'm such a noob, excuse my ignorance, but... sigh... What exactly do i do?
     
    #11
  12. Kakis

    Kakis Villager Member

    Messages:
    13
    Likes Received:
    0
    Location:
    Britain
    First Language:
    English
    Primarily Uses:
    RMXP
    I'm also struggling with using this script. Any guidance for using variables for this? I'd like to be able to give characters different voice pitches for male and female characters.

    I've tested out the script and it works fine, but I just want to know how I can change a characters pitch, as I'm not really familiar with variables. Do you have to create an event for a character for this? How is this done?
     
    #12
  13. tv.ghost

    tv.ghost Veteran Veteran

    Messages:
    261
    Likes Received:
    77
    First Language:
    English
    Primarily Uses:
    RMVXA
    In the module, make something like

    Code:
    SE_CUSTOM_1 = "Sound name goes here"
    Pitch_CUSTOM_1 = [50,100]
    Then you could do something like this:

    Code:
    module Sound
    
      # System Sound Effect
      def self.play_text_se
        file = "Audio/SE/" + TSE::SE if $game_variables[VARIABLE HERE] == 0
        file = "Audio/SE/" + TSE::SE_CUSTOM_1 if $game_variables[VARIABLE HERE] == 1
        ##more can be added here
        pitch = rand(TSE::Pitch[1] - TSE::Pitch[0]) + TSE::Pitch[0] if $game_variables[VARIABLE HERE] == 0
        pitch = rand(TSE::Pitch_CUSTOM_1[1] - TSE::Pitch_CUSTOM_1[0]) + TSE::Pitch[0] if $game_variables[VARIABLE HERE] == 1
        Audio.se_play(file, TSE::Volume, pitch)
      end
    end
    [VARIABLE HERE] can be anything. You can also set up one variable for pitch and one for the sound if you want.
    Manually adjust the selected variable through events to change pitch; this can work for actors or random NPCs.
     
    #13
  14. Kakis

    Kakis Villager Member

    Messages:
    13
    Likes Received:
    0
    Location:
    Britain
    First Language:
    English
    Primarily Uses:
    RMXP
    Ok, thanks!
    So I followed what you said and put it under module in script editor.
    [​IMG]

    So then I can now create an event for a character to change pitch?
    I'm still a little confused on how this works. I noticed when creating an event, under "conditions" it has variables listed. But when I try to add a number to that, nothing's happening.
    [​IMG]
    What do I do here? Or am I looking at it wrong? Is it because in the script, I need to put a number where [VARIABLE HERE] is? Sorry, all of this is pretty new to me.
     

    Attached Files:

    #14
  15. Kes

    Kes Global Moderators Global Mod

    Messages:
    19,706
    Likes Received:
    10,080
    First Language:
    English
    Primarily Uses:
    RMVXA
    No. Put it under Materials. That is where all custom scripts must go.
     
    #15
  16. Kakis

    Kakis Villager Member

    Messages:
    13
    Likes Received:
    0
    Location:
    Britain
    First Language:
    English
    Primarily Uses:
    RMXP
    Oh, ok. I did that but it gave me an error and said there was something wrong with line 8.
     
    #16
  17. tv.ghost

    tv.ghost Veteran Veteran

    Messages:
    261
    Likes Received:
    77
    First Language:
    English
    Primarily Uses:
    RMVXA
    You need to put all that new stuff inside of Moby's script under it's appropriate sections, not under a new page like that.

    Code:
    module TSE
      # The name of the file that will be played, must be placed in Audio/SE
      SE = "Cursor1"
      SE_CUSTOM_1 = "Cursor2" ##sound file name goes here
      # The pitch range of the file being played
      # [start_pitch, end_pitch]
      # start and end pitch can be the same to have a static pitch
      Pitch = [150, 175]
      Pitch_CUSTOM_1 = [50, 100] #Adjust this accordingly
      # The volume of the file being played
      Volume = 100
      # The interval at which the sound is being played, every x characters
      Interval = 4
    end
    Code:
    module Sound
    
      # System Sound Effect
      def self.play_text_se
        file = "Audio/SE/" + TSE::SE if $game_variables[1] == false
        file = "Audio/SE/" + TSE::SE if $game_variables[1] == true
        pitch = rand(TSE::Pitch[1] - TSE::Pitch[0]) + TSE::Pitch[0] if $game_variables[1] == false
        pitch = rand(TSE::Pitch_CUSTOM_1[1] - TSE::Pitch_CUSTOM_1[0]) + TSE::Pitch_CUSTOM_1[0] if $game_variables[1] == true
        Audio.se_play(file, TSE::Volume, pitch)
      end
    end
    Also, you need to put a number where [VARIABLE HERE] is written. In this case, I put variable 1. Same for "Sound file goes here"; put an actual sound file, not what I wrote.
     
    Last edited: Jan 8, 2019
    #17
  18. Kakis

    Kakis Villager Member

    Messages:
    13
    Likes Received:
    0
    Location:
    Britain
    First Language:
    English
    Primarily Uses:
    RMXP
    Ok, thanks!
    So whereabouts would i put the audio file I'd be using? Would it be here?
    Audio.se_play(file, TSE::Volume, pitch)
    end
    Because I noticed when I used Moby's script, it already had sound added to it.
     
    #18
  19. tv.ghost

    tv.ghost Veteran Veteran

    Messages:
    261
    Likes Received:
    77
    First Language:
    English
    Primarily Uses:
    RMVXA
    No, you don't tamper with that line of code. Change this line of code that should be in the module: SE_CUSTOM_1 = "Cursor2"

    As a general rule, Modules for a lot of RPG Maker scripts are where you go and customize stuff. That's why you see a lot of "don't edit below unless you know what you're doing!" warnings once the module section ends.
     
    #19

Share This Page