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.

No battle result screen

I'm trying to make it so that when you win a battle, there is no battle result screen. Instead, only the victory ME should be played, and after about 4 seconds the player is transported back to the map. Any help, please :)

i'm working with rmxp btw.
 

Star

Sponsor

This one is easy as pie.

Code:
class Window_BattleResult < Window_Base 

   def initialize(exp, gold, treasures)

    @exp = exp

    @gold = gold

    @treasures = treasures

    super(160, 0, 320, @treasures.size * 32 + 64)

    self.contents = Bitmap.new(width - 32, height - 32)

    self.y = 160 - height / 2

    self.opacity = 0

    self.visible = false

    refresh

  end

  def refresh

    self.contents.clear

    end

  end
Paste above main. Click Line Number off to get rid of numbers.
 
Thanks! Gonna try it right now. I've thought myself how to edit scripts but for some reason i still find it hard to make my own scripts from scratch. Here's a cookie for Star! ;)

Edit: so I tried it out, the base function works. However, the victory bgm keeps playing on the map and you have to press enter to continue. I'd like to change it so that the victory bgm stops playing after you teleport back to the map and that you teleport to the map automatically. I'm gonna try to do that myself, but I'm not sure if it'll work out :p

Edit2: FFFUUUU! tried to make those edits, but i failed. Will you help me out Star?
 

Star

Sponsor

Code:
class Scene_Battle

    def start_phase5

    # Shift to phase 5

    @phase = 5

     # Return to BGM before battle started

    $game_system.bgm_play($game_temp.map_bgm)

    # Initialize EXP, amount of gold, and treasure

    exp = 0

    gold = 0

    treasures = []

    # Loop

    for enemy in $game_troop.enemies

      # If enemy is not hidden

      unless enemy.hidden

        # Add EXP and amount of gold obtained

        exp += enemy.exp

        gold += enemy.gold

        # Determine if treasure appears

        if rand(100) < enemy.treasure_prob

          if enemy.item_id > 0

            treasures.push($data_items[enemy.item_id])

          end

          if enemy.weapon_id > 0

            treasures.push($data_weapons[enemy.weapon_id])

          end

          if enemy.armor_id > 0

            treasures.push($data_armors[enemy.armor_id])

          end

        end

      end

    end

    # Treasure is limited to a maximum of 6 items

    treasures = treasures[0..5]

    # Obtaining EXP

    for i in 0...$game_party.actors.size

      actor = $game_party.actors[i]

      if actor.cant_get_exp? == false

        last_level = actor.level

        actor.exp += exp

        if actor.level > last_level

          @status_window.level_up(i)

        end

      end

    end

    # Obtaining gold

    $game_party.gain_gold(gold)

    # Obtaining treasure

    for item in treasures

      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)

    # Set wait count

    @phase5_wait_count = 100

  end

  #--------------------------------------------------------------------------

  # * Frame Update (after battle phase)

  #--------------------------------------------------------------------------

  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 = false

        # Clear main phase flag

        $game_temp.battle_main_phase = false

        # Refresh status window

        @status_window.refresh

      end

      return

    end

      battle_end(0)

  end

end

I almost didn't realize you needed more help. In times like these it's okay, I think, to bump your topic. Just replace this code with the code I gave you before. You only need this code for it to work.
 
Thanks, it works now. I learned something new as well. because when i pasted this code, the victory bgm didn't play. But i made it work by adding $game_system.me_play($game_system.battle_end_me)

Thanks again to invest your time in my problem ;)
 

Star

Sponsor

gRaViJa":1nqittj6 said:
Thanks, it works now. I learned something new as well. because when i pasted this code, the victory bgm didn't play. But i made it work by adding $game_system.me_play($game_system.battle_end_me)

Thanks again to invest your time in my problem ;)
Oh right, I took that out cause I thought you said you didn't want the victory music to play but I read it wrong. Oh well, glad you got it squared away.

Be well. :cheers:
 

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