[RESOLVED] RMVX Ace to RMXP - Another Short Script Conversion

Started by Zangetsu, December 22, 2015, 01:57:57 pm

Previous topic - Next topic

Zangetsu

I was worried since it looks like I'm posting way too much... I hope this was enough to make a new topic, and I'm sorry for not being active on the forums! I feel like I should help more, since everyone helps me so much. I'll be sure to do that soon.

So I was looking at my UMS and I added an SE to accompany the text. However, there's SE for every character and it's very annoying. I'd prefer it every three or so characters, and so this feature would be perfect:

#==============================================================================
# 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
  # Set to nil to disable this feature
  MESSAGE_SOUND_DISABLE = nil
 
end

class Window_Message < Window_Base
  include Text_Sound_Effect
  #--------------------------------------------------------------------------
  # alias method: process_characer
  #--------------------------------------------------------------------------
  alias textsound_process_character_normal process_character
  def process_character(c, text, pos)
    if !MESSAGE_SOUND_DISABLE or !$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


If someone could create it to be based off the UMS script, which helps to show one character at a time in message boxes, I'd be grateful!

Again, I'll come around the forums more and look to contribute other than asking for help all the time. I apologise!

~Zangetsu
My name is Kitsuki.

KK20

Since I'm not sure about the different versions, try finding these areas in the UMS:

if $game_system.sound_effect != ""
  Audio.se_play("Audio/SE/" + $game_system.sound_effect, 80, 100)
end

and change the condition to this:

if $game_system.sound_effect != "" && Graphics.frame_count % 3 == 0

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!