Change the Text Sound Effect

● ARCHIVED · READ-ONLY
Started by Argami 10 posts View original ↗
  1. Hi! I'm using the Zerbu's Text Sound Effect Script and I want to know if it's possible to modify the script to add the feature to change the sound using Variables.

    Here is the original script:

    Spoiler
    #==============================================================================
    # Text Sound Effect (version 2)
    # NEW FEATURE: Switch to turn off sound effect
    #------------------------------------------------------------------------------
    # by Zerbu
    #==============================================================================
    module Text_Sound_Effect
    #--------------------------------------------------------------------------
    # Options
    #--------------------------------------------------------------------------
    # The sound effect to play
    MESSAGE_SOUND = RPG::SE.new("Knock", 70, 80)

    # The number of characters to display before each time the sound plays
    # The default is 3, it's recommended you keep it as this unless you
    # know what you're doing
    MESSAGE_SOUND_FRAMES = 3

    # Switch to disable sound effect
    # If you need to turn off the sound effect for any part of the game,
    # turn this switch on
    MESSAGE_SOUND_DISABLE = 2

    end

    class Window_Base < Window
    include Text_Sound_Effect
    #--------------------------------------------------------------------------
    # alias method: process_characer
    #--------------------------------------------------------------------------
    alias textsound_process_character_normal process_character
    def process_character(c, text, pos)
    if !$game_switches[MESSAGE_SOUND_DISABLE]
    #---
    if !defined?(@sound_frames)
    @sound_frames = 0
    end
    #---
    if @sound_frames == 0
    MESSAGE_SOUND.play
    end
    #---
    @sound_frames+=1
    #---
    if @sound_frames == MESSAGE_SOUND_FRAMES
    @sound_frames = 0
    end
    #---
    end
    textsound_process_character_normal(c, text, pos)
    end
    #---
    end

    Code:
    Thanks in advance! :D
  2. It's not that hard, here it is:

    If you want the knock sound set the variable to 0, for Cursor1 to 1...

    you can add as many as you want ^^



    Code:
    #==============================================================================
    # Text Sound Effect (version 2)
    # NEW FEATURE: Switch to turn off sound effect
    #------------------------------------------------------------------------------
    # by Zerbu
    #==============================================================================
    module Text_Sound_Effect
      #--------------------------------------------------------------------------
      # Options
      #--------------------------------------------------------------------------
      # The sound effect to play
      MESSAGE_SOUND = {
        0 => RPG::SE.new("Knock", 70, 80),
        1 => RPG::SE.new("Cursor1", 70, 80),
        2 => RPG::SE.new("Cursor2", 70, 80),
      }
    
      # ID of the Variable that stores the current sound
      SOUND_VAR = 1
      # The number of characters to display before each time the sound plays
      # The default is 3, it's recommended you keep it as this unless you
      # know what you're doing
      MESSAGE_SOUND_FRAMES = 3
      # Switch to disable sound effect
      # If you need to turn off the sound effect for any part of the game,
      # turn this switch on
      MESSAGE_SOUND_DISABLE = 2
    end
    class Window_Base < Window
      include Text_Sound_Effect
      #--------------------------------------------------------------------------
      # alias method: process_characer
      #--------------------------------------------------------------------------
      alias textsound_process_character_normal process_character
      def process_character(c, text, pos)
        if !$game_switches[MESSAGE_SOUND_DISABLE]
    	   #---
    	   if !defined?(@sound_frames)
    	   @sound_frames = 0
    	   end
    	   #---
    	   if @sound_frames == 0
    	   MESSAGE_SOUND[$game_variables[SOUND_VAR]].play
    	   end
    	   #---
    	   @sound_frames+=1
    	   #---
    	   if @sound_frames == MESSAGE_SOUND_FRAMES
    	   @sound_frames = 0
    	   end
    	   #---
        end
        textsound_process_character_normal(c, text, pos)
      end
      #---
    end
  3. Wow! You were fast! Thank you very much, It will be very useful to me :)
  4. no problem ^^
  5. Sorry Mobychan but I tested the script and it doesn't work. It doesn't appear any message error but it doesn't sound anything :S

    Sorry again Mobychan it was my error. Thanks!
  6. how did you configure the sounds (the MESSAGE_SOUND part) and what value does you variable (the one with the id SOUND_VAR) have?

    Or did you use VX?

    I tried it in VXAce and it worked just fine for me, didn't see that you're using VX before...

    EDIT:

    Oh, ok then ^^
  7. Hey, I'm trying out this script as well. It works for me, but I need help with the variables/changing the pitch.
    How do I do this? I'm pretty new to all of it.
    Is it done under events > variable? So that way its assigned to a character? Whenever I try at variables the character disappears for me. Could I have some help?
  8. Maybe I'm just being dumb but I copy-pasted the script into the game and there's no sound. Do I have to make event variables and set those or make in-event scripts or....?
  9. I'm surprised the thread wasn't closed due to the necro post before yours @Actual_Isami

    If you do not change variable 1 in your game then it should work straight away.
    So are you changing the variable somewhere else? Another script that uses it?
    Or the switch in the script? Turning the switch on will turn off the script.
    You can also use a different variable and switch. just change the numbers for them.
    Remember to always assign names to the switches and variables.
    to do that open an event, insert a command -> variable, pick one and click in the name box.
  10. Roninator2 said:
    I'm surprised the thread wasn't closed due to the necro post before yours @Actual_Isami

    If you do not change variable 1 in your game then it should work straight away.
    So are you changing the variable somewhere else? Another script that uses it?
    Or the switch in the script? Turning the switch on will turn off the script.
    You can also use a different variable and switch. just change the numbers for them.
    Remember to always assign names to the switches and variables.
    to do that open an event, insert a command -> variable, pick one and click in the name box.

    I ended up using a whole other script in the end but thanks anyway lol.