• 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.

How to change Battle BGM in Battle...

42
Posts
13
Years
  • I wonder if it was possible to add a script that checks if Gym Leader has sent out their last pokemon, if True I want it to change the current battle BGM into an Replacement, just like in Black and White.

    Thanks ^^
     

    venom12

    Pokemon Crystal Rain Relased
    476
    Posts
    17
    Years
    • Age 33
    • Seen Dec 28, 2023
    It is possible, you will need to create check if leader have last pokemon, i will look into that, i wanted to do that but never try.
     
    42
    Posts
    13
    Years
  • Personally i find it the best updates in the pokemon game history on the Handheld Console :P
    Would be awesome if you're able to do so, venom12 ^^
     

    venom12

    Pokemon Crystal Rain Relased
    476
    Posts
    17
    Years
    • Age 33
    • Seen Dec 28, 2023
    Ok so i figured it out, thanks to FL for help here.
    So go to PokeBattle_Battle Script
    Search for :
    @battlers[1].pbInitialize(trainerpoke,sendout,false)
    pbSendOut(1,trainerpoke)

    and under that put
    if $game_switches[YOUR_SWITCH] and pbPokemonCount(@party2)==1
    pbBGMPlay("YOURS BGM",100,100)
    end
     
    42
    Posts
    13
    Years
  • It doesn't work for some reason :/
    Battle BGM stays the same after last pokémon has been sent out.
    The switch is set to on, but it doesn't react on it, what i do wrong? :/

    Edit:
    I've also tried without the Switch command, and still not working...

    Another Edit:
    The script does work if Opponent Trainer has only 1 Pokémon with him/her.
     
    Last edited:

    venom12

    Pokemon Crystal Rain Relased
    476
    Posts
    17
    Years
    • Age 33
    • Seen Dec 28, 2023
    Maybe you place it in wrong line, should be here,

    Spoiler:
     
    42
    Posts
    13
    Years
  • I have that in the exact same order.
    It appears to be only working if Opponent trainer only has 1 Pokémon in his/her team. :s

    I have tested it with the Switch on and off, and works correctly, only whenever the last pokémon is sent out, the script doesn't work properly for some reason, BGM just stays the same.

    I have a trainer which only has 1 pokémon in his team, and suddenly the script works fine in there.
    But if i test it with a Trainer that has more then 1 pokémon, the script just won't function. :s
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Maybe you missed the part where it says Initialize opponent in single battles. That means that particular script only runs once, at the start of the battle. The script that checks the remaining available Pokémon and changed the BGM accordingly needs to go elsewhere.

    I don't know where, though. Try finding the place where the opposing trainer sends in a new Pokémon (since that's when it should change).
     
    42
    Posts
    13
    Years
  • Got it working :D

    Find in PokeBattle_Battle around line 2232:
    Code:
    def pbSendOut(index,pokemon)
    pbSetSeen(pokemon)
    @peer.pbOnEnteringBattle(self,pokemon)
    if pbIsOpposing?(index)
    @scene.pbTrainerSendOut(index,pokemon)

    And add Venom's script after that, works all fine now!
    Thank you for the script Venom and Thank you for the tip Maruno <3
     
    Last edited:
    42
    Posts
    13
    Years
  • Shouldn't be a problem, and would be reasonable to give credits to venom12 for making the script ;P

    Edit:

    I've also added a Tutorial on the Essentials Wiki shown in here.
    And yes, credits given to venom12 :3
     
    Last edited:
    34
    Posts
    14
    Years
  • This is pretty good, but is there a way to fade the BGM into the new one rather then the sudden change? It just sounds a bit weird.

    Also I've never scripted before but I wanted to play with this a bit to make them say something when their last Pokémon comes out.

    How to change Battle BGM in Battle...


    Code:
    @scene.pbShowOpponent(0)
    pbDisplayPaused("Text")
    @scene.pbHideOpponent
    achieves this, but I'm unsure how to define the text for each trainer, individually, rather than a single message for them all.
     

    venom12

    Pokemon Crystal Rain Relased
    476
    Posts
    17
    Years
    • Age 33
    • Seen Dec 28, 2023
    Hmm you could define by using a line to check trainer name i think it was
    If trainername==PBTrainers::Silver
    and where placed that code to show trainer?

    For fade old bgm use before pbbgmplay, pbBgmFade i think
     
    34
    Posts
    14
    Years
  • Can't seem to make that work, though it's more likely to be a problem from me since I'm not complete sure what I'm doing.

    If possible I'd like to do
    Code:
    pbDisplayPaused(@lastpokemon)
    I'm just not sure how I could define it for the trainer or what I'd need to add to the script.


    and where placed that code to show trainer?
    Didn't read that part of your message before.
    I've placed those 3 lines underneath pbBGMPlay.
    Code:
      def pbSendOut(index,pokemon)
        pbSetSeen(pokemon)
        @peer.pbOnEnteringBattle(self,pokemon)
        if pbIsOpposing?(index)
          @scene.pbTrainerSendOut(index,pokemon)
          #venom12's Last Pokemon
          if $game_switches[112] and pbPokemonCount(@party2)==1
           pbBGMPlay("Battle! Gym Leader (Kanto)",100,100)
           @scene.pbShowOpponent(0)
            pbDisplayPaused("You haven't defeated me yet!")
           @scene.pbHideOpponent
          end
        else
          @scene.pbSendOut(index,pokemon)
        end
      end
     
    Last edited:

    venom12

    Pokemon Crystal Rain Relased
    476
    Posts
    17
    Years
    • Age 33
    • Seen Dec 28, 2023
    Ok i got it

    it use trainer type,

    Code:
     if PBTrainers==trainer type
           @scene.pbShowOpponent(0)
           pbDisplayPaused("You haven't defeated me yet!")
           @scene.pbHideOpponent
         end
     
    Last edited:
    34
    Posts
    14
    Years
  • Thanks for your help, but that one didn't work either.

    I went through different codes a bunch of times and I've finally gotten one that works the way I want it.

    Code:
    def pbSendOut(index,pokemon)
        pbSetSeen(pokemon)
        @peer.pbOnEnteringBattle(self,pokemon)
        if pbIsOpposing?(index)
          @scene.pbTrainerSendOut(index,pokemon)
    [S-HIGHLIGHT]       #venom12's Last Pokemon
          if $game_switches[112] and pbPokemonCount(@party2)==1
            pbBGMPlay("Battle! Gym Leader (Kanto)",100,100)
            @scene.pbShowOpponent(0)
            if @opponent.trainertype==004
              lastpkmn="You haven't defeated me yet!"
            end
            pbDisplayPaused(_INTL("{1}",lastpkmn))
            @scene.pbHideOpponent[/S-HIGHLIGHT]
          end
        else
          @scene.pbSendOut(index,pokemon)
        end
      end
    Displays without any issues, and it can be set for any you want.

    I would use trainertypename, but it doesn't seem to like spaces and using internalname doesn't work.


    Edit: I've updated the wiki page on this script to include mine as an optional.
    https://pokemonessentials.wikia.com/wiki/Tutorial:Last_sent_out_pokemon_BGM
     
    Last edited:

    venom12

    Pokemon Crystal Rain Relased
    476
    Posts
    17
    Years
    • Age 33
    • Seen Dec 28, 2023
    Oh you found better way great work :)
     
    42
    Posts
    13
    Years
  • For some reason it doesn't want to work for me :/
    It's exactly the same, but the only problem i have is that it shows No Text at all...
    What I do wrong?
     
    34
    Posts
    14
    Years
  • Can you post the entire script you have in Pokebattle_Battle?

    Edit: Before doing so try this and let me know if it works:

    The trainertype is the number that is used to refer to the image of the trainer - you can see it inside PBS/trainertypes.txt or inside your Graphics/Characters folder as trainer###.png

    As an example, my trainertype is Leader_Bob and his name is Bob - his trainertype id is 4 and therefore the script is
    if @opponent.trainertype==004
    Check if the trainertype you've entered is the number that refers to the gym leader's image. I wanted to use the internalname but that didn't work.

    Edit2: Maruno's way is exactly what I needed so use that one.
    Final code will be something like

    Code:
          if $game_switches[112] and pbPokemonCount(@party2)==1
            pbBGMPlay("Battle! Gym Leader (Kanto)",100,100)
            @scene.pbShowOpponent(0)
            if isConst?(@opponent.trainertype,PBTrainers,:Leader_Forrest)
              lastpkmn="You're good, but you won't win this battle!"
            end
            pbDisplayPaused(_INTL("{1}",lastpkmn))
            @scene.pbHideOpponent
     
    Last edited:
    Back
    Top