• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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
    12
    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.
     
    Neat, although I'll try to translate it to my vanilla battle system. Shouldn't be too hard, I hope.
     
    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!
     
    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...
     
    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.
     
    "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?
     
    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.
     
    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".?

    [PokeCommunity.com] [Elite Battle 2015 add-on] Change BGM on low HP
     
    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".?

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

    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.
     
    I'm not getting any errors and yet it's not working. I have EBS essentials with BW essentials.
     
    Back
    Top