BMG/BGS/ME/SE Within a Message Box

● ARCHIVED · READ-ONLY
Started by Billy97 4 posts View original ↗
  1. I've been meaning to ask for a long time but

    Are there scripts to play BMG/BGS/ME/SE within a message box.

    As in playing the sounds at a certain part of a message. 

    I don't mean Play Sound, Show Text, Play Sound 

    but Play Sound within a Show Text.

    To clarify what I am trying to say, I am essentially looking for a script that allow

    what this part of Woratana's Neo Message System did for VX.

    Spoiler
    #--------------------------
    #>> [sOUND] PART
    #--------------------------
    #\se[filename] << Play SE
    #\me[filename] << Play ME
    #\bgm[filename] << Play BGM

    class Window_Message < Window_Selectable
    #--------------------------------------------------------------------------
    # * Convert Special Characters
    #--------------------------------------------------------------------------
    def convert_special_characters
    @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    @text.gsub!(/\\V\[([0-9]+)\]/i) { $game_variables[$1.to_i] }
    @text.gsub!(/\\N\[([0-9]+)\]/i) { $game_actors[$1.to_i].name }
    @text.gsub!(/\\C\[([0-9]+)\]/i) { "\x01[#{$1}]" }
    @text.gsub!(/\\G/) { "\x02" }
    @text.gsub!(/\\\./) { "\x03" }
    @text.gsub!(/\\\|/) { "\x04" }
    @text.gsub!(/\\!/) { "\x05" }
    @text.gsub!(/\\>/) { "\x06" }
    @text.gsub!(/\\@text.gsub!(/\\\^/) { "\x08" }
    @text.gsub!(/\\\\/) { "\\" }

    # Woratana's :: Play SE
    @text.gsub!(/\\SE\[(.*?)\]/i) { "\x97[#{$1}]" }
    # Woratana's :: Play ME
    @text.gsub!(/\\ME\[(.*?)\]/i) { "\x98[#{$1}]" }
    # Woratana's :: Play BGM
    @text.gsub!(/\\BGM\[(.*?)\]/i) { "\x99[#{$1}]" }
    end
    #--------------------------------------------------------------------------
    # * Update Message
    #--------------------------------------------------------------------------
    def update_message
    loop do
    c = @text.slice!(/./m) # Get next text character
    case c
    when nil # There is no text that must be drawn
    finish_message # Finish update
    break
    when "\x00" # New line
    new_line
    if @line_count >= MAX_LINE # If line count is maximum
    unless @text.empty? # If there is more
    self.pause = true # Insert number input
    break
    end
    end
    when "\x01" # \C[n] (text character color change)
    @text.sub!(/\[([0-9]+)\]/, "")
    contents.font.color = text_color($1.to_i)
    next
    when "\x02" # \G (gold display)
    @gold_window.refresh
    @gold_window.open
    when "\x03" # \. (wait 1/4 second)
    @wait_count = 15
    break
    when "\x04" # \| (wait 1 second)
    @wait_count = 60
    break
    when "\x05" # \! (Wait for input)
    self.pause = true
    break
    when "\x06" # \> (Fast display ON)
    @line_show_fast = true
    when "\x07" # \< (Fast display OFF)
    @line_show_fast = false
    when "\x08" # \^ (No wait for input)
    @pause_skip = true
    when "\x97"
    @text.sub!(/\[(.*?)\]/, "")
    RPG::SE.new($1).play
    when "\x98"
    @text.sub!(/\[(.*?)\]/, "")
    RPG::ME.new($1).play
    when "\x99"
    @text.sub!(/\[(.*?)\]/, "")
    RPG::BGM.new($1).play
    else # Normal text character
    contents.draw_text(@contents_x, @contents_y, 40, WLH, c)
    c_width = contents.text_size©.width
    @contents_x += c_width
    end
    break unless @show_fast or @line_show_fast
    end
    end
    end
    Thanks in Advance.
  2. I know you can do that with Modern Algebra's ATS Message Options (I'm not to sure if there's a script that separates it out, but the whole ATS series is pretty useful, anyway; plus it looks somewhat like what that section of script you put up is for, so they're probably pretty similar)  
  3. If you want the music to come at a line break you could probably do something with a variable and the draw_text method (Window_Base I think). That would be where I would start, at any rate.
  4. Thank you!

    ATS Message Options is exactly what I was looking for.