• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Elite Battle 2015 add-on] Change BGM on low HP

rigbycwts

Hmm, hmm.
98
Posts
11
Years
    • Seen Feb 22, 2019
    Okay, so this shows how the BGM changes if the player's Pokemon are on low health, similar to the Gen 5 games.
    Note that this requires Luka's Elite Battle System.

    Step 1: In EliteBattle_Scene, inside the function pbStartBattle, add this line:
    Code:
    $lowHPbattle=false

    Step 2: In EliteBattle_UI, inside the function update, below this:
    Code:
    @animatingHP=false if @currenthp==@endhp
    Add these:
    Code:
    if (@battler.index==0 or @battler.index==2) && (@currenthp<=(@battler.totalhp*0.2) && !(self.hp<1)) && $lowHPbattle==false
            $game_system.bgm_memorize
            pbBGMPlay("lowhp-gen5.mp3")
            $lowHPbattle=true
          end   
          if (@battler.index==0 or @battler.index==2) && (@currenthp>(@battler.totalhp*0.2) or @currenthp<=0) && $lowHPbattle==true
            $game_system.bgm_restore
            $lowHPbattle=false
          end

    What to fix next: if the HP is low at the very first turn of the battle, the BGM won't change.
     
    91
    Posts
    14
    Years
    • Seen Sep 5, 2015
    Neat, although I'll try to translate it to my vanilla battle system. Shouldn't be too hard, I hope.
     

    KillerMapper

    Helix Follower
    200
    Posts
    9
    Years
  • I myself tried to do this, it was somewhat good for 1vs1 battle but not in double battle, and I ran into some glitches too :p

    I'll try your code asap. Thanks for sharing!
     

    KillerMapper

    Helix Follower
    200
    Posts
    9
    Years
  • So I tried your script and you have the same problem as me. Get a pokémon (with yellow / green bar) in a battle and make sure you take little damage (using lot of moves like growl or battling a weak pokémon). You'll reach the point when your HP bar becomes red but the BGM won't immediately change. It will after losing 1-2 more HP. Looks like there is a difference between the HP bar and the actual HP value used by the script to determinate when the BGM should change.
    When I tried, I based my changes on the color change, but the same problem happened...
     

    Sunbean

    Breeeeeder
    29
    Posts
    11
    Years
  • So I tried your script and you have the same problem as me. Get a pokémon (with yellow / green bar) in a battle and make sure you take little damage (using lot of moves like growl or battling a weak pokémon). You'll reach the point when your HP bar becomes red but the BGM won't immediately change. It will after losing 1-2 more HP. Looks like there is a difference between the HP bar and the actual HP value used by the script to determinate when the BGM should change.
    When I tried, I based my changes on the color change, but the same problem happened...

    It might work if you play around with the math and conditionals a little, but I haven't implemented it just yet to try this out.
     
    79
    Posts
    8
    Years
    • Seen Jan 17, 2017
    "What to fix next: if the HP is low at the very first turn of the battle, the BGM won't change."
    Is this still a thing?
     
    824
    Posts
    8
    Years
  • What to fix next: if the HP is low at the very first turn of the battle, the BGM won't change.
    Step 2: In EliteBattle_Battle, inside the function pbStartBattleCore, below this:
    Code:
        #====================================
        # Initialize player in single battles
        #====================================
          sendout=pbFindNextUnfainted(@party1,0)
          if sendout < 0
            raise _INTL("Player has no unfainted Pokémon")
          end
          playerpoke=@party1[sendout]
          @battlers[0].pbInitialize(playerpoke,sendout,false)
          if getBattlerPokemon(@battlers[0]).namex != nil
            pbDisplayBrief(_INTL("Go! {1} and {2}!",getBattlerPokemon(@battlers[0]).name,getBattlerPokemon(@battlers[0]).namex))
          else
            pbDisplayBrief(_INTL("Go! {1}!",getBattlerPokemon(@battlers[0]).name))
          end
          pbSendOut(0,playerpoke)
        end
    Add these:
    Code:
    if (@battler.index==0 or @battler.index==2) && (@currenthp<=(@battler.totalhp*0.2) && !(self.hp<1)) && $lowHPbattle==false
            $game_system.bgm_memorize
            pbBGMPlay("lowhp-gen5.mp3")
            $lowHPbattle=true
          end   
          if (@battler.index==0 or @battler.index==2) && (@currenthp>(@battler.totalhp*0.2) or @currenthp<=0) && $lowHPbattle==true
            $game_system.bgm_restore
            $lowHPbattle=false
          end

    Still known issue: if using a healing item on your Pokemon, the music doesn't change back until your Pokemon is hit again.
     
    79
    Posts
    8
    Years
    • Seen Jan 17, 2017
    Hey Rot8er_ConeX.
    Your method worked fine until the new update.
    When I try to add your block of code below
    it i get an undefined method error for "index".?

    qRro1P0.png
     
    824
    Posts
    8
    Years
  • Hey Rot8er_ConeX.
    Your method worked fine until the new update.
    When I try to add your block of code below
    it i get an undefined method error for "index".?

    qRro1P0.png

    The new update appears to have broken the ability to check for low HP and change the music. I have two trainers that cause the music to change when their ace is sent out - one changes to a different track and the other slows the music down tremendously - and those work fine, but for whatever reason I can't change the music based on my own HP.

    I think we're going to have to wait for the OP to figure out the new update.
     
    81
    Posts
    8
    Years
    • Seen Sep 7, 2019
    I'm not getting any errors and yet it's not working. I have EBS essentials with BW essentials.
     
    Back
    Top