Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Trickster's Lufia 2 Battle Result Patch (RTAB)

I need a script that will fix my audio victory, when using trickster's or default script it won't stop playing the ME Audio until the music is completely over, which is VERY annoying can someone get me a code that will turn it off when the Window is done with it's results, and the is pretty large for a result script... Thanks for helping, and taking the time to read my request.
-Ok it's broken down into 3 parts.

Configuration:
HTML:
#==============================================================================
# ** Lufia Style Battle Report
#------------------------------------------------------------------------------
# Trickster ([email=tricksterguy@hotmail.com]tricksterguy@hotmail.com[/email])
# Version: 1.0 Revision
# Date: 12/10/06
#==============================================================================

#--------------------------------------------------------------------------
# Begin SDK Log
#--------------------------------------------------------------------------
SDK.log('Lufia Style Battle Report', 'Trickster', 1.0, '12/10/06')

#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Lufia Style Battle Report') == true
  
module LufiaII_Result
  #--------------------------------------------------------------------------
  # * Gain Exp Text 
  #   - Note: [exp] = exp gained [words] = word for exp
  #--------------------------------------------------------------------------
  Get_Exp_Text = 'Gets [exp] [words].'
  #--------------------------------------------------------------------------
  # * Word for Exp
  #--------------------------------------------------------------------------
  Words_Exp = 'EXP'
  #--------------------------------------------------------------------------
  # * Gain Gold Text 
  #   - Note: [gold] = gold gained [words] = word for gold
  #--------------------------------------------------------------------------
  Get_Gold_Text = 'Gets [gold] [words].'
  #--------------------------------------------------------------------------
  # * Learn Skill Text
  #   - Note: [icon] = skill icon [name] = name of skill
  #--------------------------------------------------------------------------
  Get_Skill_Text = 'Learned [icon] [name].'
  #--------------------------------------------------------------------------
  # * Gain Item Text 
  #   - Note: [icon] = item icon [name] = name of item
  #--------------------------------------------------------------------------
  Get_Item_Text = 'Gets [icon] [name].'
  #--------------------------------------------------------------------------
  # * Level up text
  #   - Note: [name] = Actor name [level] = Level  = right aligned text
  #--------------------------------------------------------------------------
  Level_Up_Text = '[name] Levels Up.'
  #--------------------------------------------------------------------------
  # * Statup Text
  #   - Note: [stat] = stat name [amount] = amount up
  #--------------------------------------------------------------------------
  Stat_Up_Text = '[stat] increases by  [amount].'
  #--------------------------------------------------------------------------
  # * Exp to next level text
  #   - Note: [name] = actor name [amount] = exp to next
  #--------------------------------------------------------------------------
  Next_Level_Text = '[name] next level  [amount].'
  #--------------------------------------------------------------------------
  # * Gold text 
  #   - Note: [gold] = current gold [words] = word for gold
  #--------------------------------------------------------------------------
  Gold_Text = ' [gold] [words].'
  #--------------------------------------------------------------------------
  # * Push Button to move contents downward
  #--------------------------------------------------------------------------
  Push_Button = true
  #--------------------------------------------------------------------------
  # * Wait count for contents to move downward in frames
  #--------------------------------------------------------------------------
  Wait_Count = 40
  #--------------------------------------------------------------------------
  # * Stats used in Level Up Stat text
  #--------------------------------------------------------------------------
  Stats = %w( maxhp maxsp str dex agi int )
  #--------------------------------------------------------------------------
  # * Stat Names used in Level Up Stat text
  #--------------------------------------------------------------------------
  Stat_Names = %W( Max\sHp Max\sSp Strength Dexerity Agility Intellect )
  #--------------------------------------------------------------------------
  # * Scroll Speed 
  #   - Valid Parameters are: instant, faster, fast, slow, slower, slowest
  #--------------------------------------------------------------------------
  Scroll_Speed = 'slowest'
  #--------------------------------------------------------------------------
  # * Last Wait Before End Battle in frames
  #--------------------------------------------------------------------------
  Last_Wait = 160
  #--------------------------------------------------------------------------
  # * Speeds
  #--------------------------------------------------------------------------
  Speeds = {'instant' => 32, 'faster' => 16, 'fast' => 8, 'slow' => 4,
  'slower' => 2, 'slowest' => 1}
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
end

Next part is Scene Battle edit, this is required too I think it deals with Active Battler which is RTAB.

Scene_Battle#Edits:
HTML:
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Lufia Style Battle Report') == true
  
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Start Phase 5
  #--------------------------------------------------------------------------
  def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp, gold, treasures = 0, 0, []
    # Loop
    $game_troop.enemies.each do |enemy|
      # Skip id enemy is hidden
      next if enemy.hidden
      # Add EXP and amount of gold obtained
      exp += enemy.exp
      gold += enemy.gold
      # Skip if no treasure
      next if rand(100) > enemy.treasure_prob
      # Push Treasures if defined
      treasures << $data_items[enemy.item_id] if enemy.item_id > 0
      treasures << $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0
      treasures << $data_armors[enemy.armor_id] if enemy.armor_id > 0
    end
    # Obtaining EXP
    level_flags = Array.new($game_party.actors.size) {false}
    # Run Through Each Actor With Index
    $game_party.actors.each_with_index do |actor, index|
      # Skip if can't get exp
      next if actor.cant_get_exp?
      # Get Last Level
      last_level = actor.level
      # Add Exp
      actor.exp += exp
      # Skip if no level change
      next if last_level == actor.level
      # Set Level Flags
      level_flags[index] = last_level 
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    treasures.each do |item|
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures, level_flags)
    # Set Wait
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # * Update Phase 5
  #--------------------------------------------------------------------------
  def update_phase5
    # If wait count is larger than 0
    if @phase5_wait_count > 0
      # Decrease wait count
      @phase5_wait_count -= 1
      # If wait count reaches 0
      if @phase5_wait_count == 0
        # Show result window
        @result_window.visible = true
        # Clear main phase flag
        $game_temp.battle_main_phase = false
        # Refresh status window
        @status_window.refresh
      end
      return
    end
    # If result window 
    if not @result_window.disposed?
      # Update Result
      @result_window.update
      # Get final wait count
      @final_wait = LufiaII_Result::Last_Wait
      # Return
      return
    end
    # If Final Wait is greater than 0 and C is not triggered
    if @final_wait > 0 and not Input.trigger?(Input::C)
      # Reduce By 1
      @final_wait -= 1
      # Return
      return
    end
    # Set Result Window to nil
    @result_window = nil
    # Battle End
    battle_end(0)
  end
end

module RPG
class Class
  #--------------------------------------------------------------------------
  # * Learn Skills
  #--------------------------------------------------------------------------
  def learn_skills(level)
    # Setup Data Array
    data = []
    # Run Through Each Learning Skill
    @learnings.each do |learning|
      # Push if levels are the same
      data << learning.skill_id if learning.level == level
    end
    # Return Data
    return data
  end
end
end

class Game_Actor
  #--------------------------------------------------------------------------
  # * Get the current EXP
  #--------------------------------------------------------------------------
  def now_exp
    return @exp - @exp_list[@level]
  end
  #--------------------------------------------------------------------------
  # * Get the next level's EXP
  #--------------------------------------------------------------------------
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
  #--------------------------------------------------------------------------
  # * Learn Skills
  #--------------------------------------------------------------------------
  def stat_change(stat, last_level, new_level = nil)
    last = $data_actors[@actor_id].parameters[stat, last_level]
    new_level = self.level if new_level == nil
    now = $data_actors[@actor_id].parameters[stat, new_level]
    return now - last
  end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
end

Last part is the Window Result, 3rd part, and last.

Window_BattleResult:
HTML:
#==============================================================================
# ** Window_BattleResult
#------------------------------------------------------------------------------
#  This window displays amount of gold and EXP acquired at the end of a battle.
#==============================================================================

#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Lufia Style Battle Report') == true
  
class Window_BattleResult < Window_Base
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     exp       : EXP
  #     gold      : amount of gold
  #     treasures : treasures
  #--------------------------------------------------------------------------
  def initialize(exp, gold, treasures, level_flags)
    # Call Window_Base#initialize and setup window
    super(80, 0, 480, 256)
    # Setup Instance Variables
    @exp = exp
    @gold = gold
    @treasures = treasures
    @level_flags = level_flags
    # Setup Contents
    self.contents = Bitmap.new(width - 32, height - 32)
    # Setup Background Opacity
    self.back_opacity = 160
    # Invisible
    self.visible = false
    # Setup Index
    @index = 0
    # Setup Wait count
    @wait_count = LufiaII_Result::Wait_Count
    # Setup Data
    @data = []
    # Setup Text
    setup_text
    # Dispose Contents
    self.contents.dispose
    # Remake Contents
    self.contents = Bitmap.new(width - 32, @data.size * 32)
  end
  #--------------------------------------------------------------------------
  # * Setup Text
  #--------------------------------------------------------------------------
  def setup_text
    # Get Exp Text
    exp_text = LufiaII_Result::Get_Exp_Text.dup
    # Replace [exp] with exp gained
    exp_text.gsub!(/\[exp\]/, "#{@exp}")
    # Replace [words] with the word for Exp
    exp_text.gsub!(/\[words\]/, LufiaII_Result::Words_Exp)
    # Push Text
    @data << exp_text
    # Get Gold Text
    gold_text = LufiaII_Result::Get_Gold_Text.dup
    # Replace [gold] with gold gained
    gold_text.gsub!(/\[gold\]/, "#{@gold}")
    # Replace [words] with the word for gold
    gold_text.gsub!(/\[words\]/, $data_system.words.gold)
    # Push Text
    @data << gold_text
    # Get Treasure Text
    @treasures.each_with_index do |treasure, index|
      # Get Item Text
      item_text = LufiaII_Result::Get_Item_Text.dup
      # Replace [icon] with \001[index]
      item_text.gsub!(/\[icon\]/, "\001[#{index}]")
      # Replace [name] with Item Name
      item_text.gsub!(/\[name\]/, "#{treasure.name}")
      # Push Text
      @data << item_text
    end
    # Blank Line
    @data << ''
    # Run Through Each Actor with index
    $game_party.actors.each_with_index do |actor, actor_index|
      # Get Next Level Text
      level_text = LufiaII_Result::Next_Level_Text.dup
      # Replace [name] with actor name
      level_text.gsub!(/\[name\]/, actor.name)
      # Replace [amount] with exp left
      level_text.gsub!(/\[amount\]/, "#{actor.next_exp - actor.now_exp}")
      # If Level Up Flag is False
      if @level_flags[actor_index] == false
        # Push Text
        @data << level_text
      else
        # Get Level Up Text
        levelup_text = LufiaII_Result::Level_Up_Text.dup
        # Replace [name] with the actor name
        levelup_text.gsub!(/\[name\]/, actor.name)
        # Replace [level] with the actor's level
        levelup_text.gsub!(/\[level\]/, "#{actor.level}")
        # Push Level up text
        @data << levelup_text
        # Get Learned Skills for level
        skills = $data_classes[actor.class_id].learn_skills(actor.level)
        # Run through each skill with index
        skills.each_with_index do |skill_id, index|
          # Get Skill Learn Text
          skill_learn_text = LufiaII_Result::Get_Skill_Text.dup
          # Replace [icon] with \003|skill_id|
          skill_learn_text.gsub!(/\[icon\]/, "\003|#{skill_id}|")
          # Replace [name] with skill name
          skill_learn_text.gsub!(/\[name\]/, $data_skills[skill_id].name)
          # Push Text
          @data << skill_learn_text
        end
        # Run Through Stats Defined with index
        LufiaII_Result::Stats.each_with_index do |stat, index|
          # Get Stat Text
          stat_text = LufiaII_Result::Stat_Up_Text.dup
          # Replace [stat] with Stat name
          stat_text.gsub!(/\[stat\]/, LufiaII_Result::Stat_Names[index])
          # Get Stat Change
          amount = actor.stat_change(index, @level_flags[actor_index])
          # Replace [amount] with the stat change amount
          stat_text.gsub!(/\[amount\]/, "#{amount}")
          # Push Stat Text
          @data << stat_text
        end
        # Push Level Text
        @data << level_text
        # Push Blank if not last actor
        @data << '' if actor_index != $game_party.actors.size - 1
      end
    end
    # Push Blank
    @data << ''
    # Get Current Gold Text
    cgold_text = LufiaII_Result::Gold_Text.dup
    # Replace [gold] with the current gold
    cgold_text.gsub!(/\[gold\]/, "#{$game_party.gold}")
    # Replace [words] with the word for gold
    cgold_text.gsub!(/\[words\]/, $data_system.words.gold)
    # Push Current Gold Text
    @data << cgold_text
  end
  #--------------------------------------------------------------------------
  # * Update
  #--------------------------------------------------------------------------
  def update
    # If Scrolling
    if @scrolling
      # Reduce Scroll Time
      @scroll_time -= 1
      # Increase Oy 
      self.oy += LufiaII_Result::Speeds[LufiaII_Result::Scroll_Speed]
      # If Scroll time is 0 set scrolling to false else true
      @scrolling = @scroll_time != 0
      # Return
      return
    end
    # If Wait Count is not nil
    if LufiaII_Result::Wait_Count != nil
      # Decrease Wait Count
      @wait_count -= 1
      # If Wait Count is zero
      if @wait_count == 0
        # Reset Wait Count
        @wait_count = LufiaII_Result::Wait_Count
        # If Index is less than or equal to text sizes - 1
        if @data.size - 1 >= @index
          # If A Blank Line
          if @data[@index] == ''
            # Window is Scrolling
            @scrolling = true
            # Get Scroll Speed
            scroll_speed = LufiaII_Result::Scroll_Speed
            # Get Scroll Time
            @scroll_time = 32 / LufiaII_Result::Speeds[scroll_speed]
            # Increase Index
            @index += 1
            # Return
            return
          end
          # Refresh Window
          refresh 
          # Increase Index
          @index += 1
          # If Index is > 7
          if @index > 7
            # We Are Scrolling
            @scrolling = true
            # Get Scroll Speed
            scroll_speed = LufiaII_Result::Scroll_Speed
            # Get Scroll Time
            @scroll_time = 32 / LufiaII_Result::Speeds[scroll_speed]
          end
        # Else case
        else
          # Dispose Window
          dispose
        end
        # Return
        return
      end
    end
    # If Push Button Option and C has been triggered
    if LufiaII_Result::Push_Button and Input.trigger?(Input::C)
      # Reset Wait Count
      @wait_count = LufiaII_Result::Wait_Count
      # If Index is less than or equal to text sizes - 1
      if @data.size - 1 >= @index
        # If A Blank Line
        if @data[@index] == ''
          # Set Scrolling to True
          @scrolling = true 
          # Get Scroll Speed
          scroll_speed = LufiaII_Result::Scroll_Speed
          # Get Scroll Time
          @scroll_time = 32 / LufiaII_Result::Speeds[scroll_speed]
          # Increase Index
          @index += 1
          # Return
          return
        end
        # Refresh
        refresh 
        # Increase Index
        @index += 1
        # If index is greater than 7
        if @index > 7
          # Set Scrolling to true
          @scrolling = true 
          # Get Scroll Speed
          scroll_speed = LufiaII_Result::Scroll_Speed
          # Get Scroll Time
          @scroll_time = 32 / LufiaII_Result::Speeds[scroll_speed]
        end
      # Else 
      else
        # Dispose
        dispose
      end
    end
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    # Setup X
    x = 0
    # Get Text
    text = @data[@index]
    # Replace  with \002
    text.gsub!(/\[right\]/, "\002")
    # Split into two parts
    text = text.split("\002")
    # Return if empty
    return if text.empty?
    # Split Left Aligned Text at \001 \003 and space and run through
    text[0].split(/\001|\003|\s/).each do |string|
      # If Matched Against [any number of digits]
      if string.sub!(/\[([0-9]+)\]/, "") != nil
        # Get Matched, item_id
        index = $1.to_i
        # Get Bitmap
        bitmap = RPG::Cache.icon(@treasures[index].icon_name)
        # Draw Bitmap
        self.contents.blt(x, @index * 32, bitmap, bitmap.rect)
        # Increase By width
        x += bitmap.width
      # Else If Matched by |any number of digits|
      elsif string.sub!(/\|([0-9]+)\|/, "") != nil
        # Get Matched, skill_id
        skill_id = $1.to_i
        # Get Bitmap
        bitmap = RPG::Cache.icon($data_skills[skill_id].icon_name)
        # Draw Bitmap
        self.contents.blt(x, @index * 32, bitmap, bitmap.rect)
        # Increase By Width
        x += bitmap.width        
      # Else
      else
        # Draw The String
        self.contents.draw_text(x, @index * 32, width - 32, 32, string)
        # Increase By Width
        x += contents.text_size(string).width
      end
      # Increase by Space Width
      x += contents.text_size(' ').width
    end
    # If Right Text is not nil
    if text[1] != nil
      # Draw Right Aligned Text
      self.contents.draw_text(0, @index * 32, width - 32, 32, text[1], 2)
    end
  end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
end

All I am asking for is a Patch, not for RTAB, but for the Victory music to stop after this is completed, thanks!
 
To Stop the ME from playing after the battle and the result window is finish showing, Just add "Audio.me_stop" before the battle_end(0)
heres the code
this one is the one you posted 2nd
it should be fix ryt after that.

heres the code
The red text is the one you have to add

Code:
#--------------------------------------------------------------------------
# Begin SDK Enabled Check
#--------------------------------------------------------------------------
if SDK.state('Lufia Style Battle Report') == true
  
class Scene_Battle
  #--------------------------------------------------------------------------
  # * Start Phase 5
  #--------------------------------------------------------------------------
  def start_phase5
    # Shift to phase 5
    @phase = 5
    # Play battle end ME
    $game_system.me_play($game_system.battle_end_me)
    # Return to BGM before battle started
    $game_system.bgm_play($game_temp.map_bgm)
    # Initialize EXP, amount of gold, and treasure
    exp, gold, treasures = 0, 0, []
    # Loop
    $game_troop.enemies.each do |enemy|
      # Skip id enemy is hidden
      next if enemy.hidden
      # Add EXP and amount of gold obtained
      exp += enemy.exp
      gold += enemy.gold
      # Skip if no treasure
      next if rand(100) > enemy.treasure_prob
      # Push Treasures if defined
      treasures << $data_items[enemy.item_id] if enemy.item_id > 0
      treasures << $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0
      treasures << $data_armors[enemy.armor_id] if enemy.armor_id > 0
    end
    # Obtaining EXP
    level_flags = Array.new($game_party.actors.size) {false}
    # Run Through Each Actor With Index
    $game_party.actors.each_with_index do |actor, index|
      # Skip if can't get exp
      next if actor.cant_get_exp?
      # Get Last Level
      last_level = actor.level
      # Add Exp
      actor.exp += exp
      # Skip if no level change
      next if last_level == actor.level
      # Set Level Flags
      level_flags[index] = last_level 
    end
    # Obtaining gold
    $game_party.gain_gold(gold)
    # Obtaining treasure
    treasures.each do |item|
      case item
      when RPG::Item
        $game_party.gain_item(item.id, 1)
      when RPG::Weapon
        $game_party.gain_weapon(item.id, 1)
      when RPG::Armor
        $game_party.gain_armor(item.id, 1)
      end
    end
    # Make battle result window
    @result_window = Window_BattleResult.new(exp, gold, treasures, level_flags)
    # Set Wait
    @phase5_wait_count = 100
  end
  #--------------------------------------------------------------------------
  # * Update Phase 5
  #--------------------------------------------------------------------------
  def update_phase5
    # If wait count is larger than 0
    if @phase5_wait_count > 0
      # Decrease wait count
      @phase5_wait_count -= 1
      # If wait count reaches 0
      if @phase5_wait_count == 0
        # Show result window
        @result_window.visible = true
        # Clear main phase flag
        $game_temp.battle_main_phase = false
        # Refresh status window
        @status_window.refresh
      end
      return
    end
    # If result window 
    if not @result_window.disposed?
      # Update Result
      @result_window.update
      # Get final wait count
      @final_wait = LufiaII_Result::Last_Wait
      # Return
      return
    end
    # If Final Wait is greater than 0 and C is not triggered
    if @final_wait > 0 and not Input.trigger?(Input::C)
      # Reduce By 1
      @final_wait -= 1
      # Return
      return
    end
    # Set Result Window to nil
    @result_window = nil
    # Battle End
    [COLOR=Red][B]Audio.me_stop[/B][/COLOR]
    battle_end(0)
  end
end

module RPG
class Class
  #--------------------------------------------------------------------------
  # * Learn Skills
  #--------------------------------------------------------------------------
  def learn_skills(level)
    # Setup Data Array
    data = []
    # Run Through Each Learning Skill
    @learnings.each do |learning|
      # Push if levels are the same
      data << learning.skill_id if learning.level == level
    end
    # Return Data
    return data
  end
end
end

class Game_Actor
  #--------------------------------------------------------------------------
  # * Get the current EXP
  #--------------------------------------------------------------------------
  def now_exp
    return @exp - @exp_list[@level]
  end
  #--------------------------------------------------------------------------
  # * Get the next level's EXP
  #--------------------------------------------------------------------------
  def next_exp
    return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
  end
  #--------------------------------------------------------------------------
  # * Learn Skills
  #--------------------------------------------------------------------------
  def stat_change(stat, last_level, new_level = nil)
    last = $data_actors[@actor_id].parameters[stat, last_level]
    new_level = self.level if new_level == nil
    now = $data_actors[@actor_id].parameters[stat, new_level]
    return now - last
  end
end
#--------------------------------------------------------------------------
# End SDK Enabled Check
#--------------------------------------------------------------------------
end
 
I am trying it out, and I know but every time I put it in there it would error, I ain't to good at scripting. Thanks so much if it works you really are helping me out tons.
Request is closed thanks so much dude!
So, no help is needed unless someone wants to enhance the script better for
RTAB, make sure to get Trickster's permission tho.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top