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

Custom BGM for Specific Pokemon

46
Posts
13
Years
    • Age 29
    • Seen Jul 2, 2018
    Hey guys,

    I've been racking my brain for ages and I just can't figure out where I'm going wrong.

    In the PField_Battles script, I've been trying to set a specific Pokemon to have a different battle BGM, upon research I found this:

    In PokemonField script section, about at line 1000, in def pbWildBattle, when the script say "$PokemonGlobal.nextBattleBGM=nil", you can make a little variation by replacing it with (RAYQUAZA is a little example):

    if(species==PBSpecies::RAYQUAZA) then
    $PokemonGlobal.nextBattleBGM=("Audio/BGM/YourTheme")
    else
    $PokemonGlobal.nextBattleBGM=nil
    end

    but even following it exactly to the T, writing it out exactly etc just doesn't seem to change anything.

    My code is:

    Code:
    pbSet(variable,1)
        if(species==PBSpecies::MEWZARD) then
          $PokemonGlobal.nextBattleBGM=("Battle Totem Pokemon")
        else
          $PokemonGlobal.nextBattleBGM  = nil
          end
        $PokemonGlobal.nextBattleME   = nil
        $PokemonGlobal.nextBattleBack = nil
        return true
      end

    So overall I'm not sure if I'm missing something super obvious or it just isn't working for some reason. All the Pokemon and the Music names are properly defined where they should be, so it can't be that. If anyone is able to offer my some help or point me in the right direction it'd be greatly appreciated :D
     

    Ego13

    hollow_ego
    311
    Posts
    6
    Years
  • Code:
    pbSet(variable,1)
        if(species==PBSpecies::MEWZARD) then
          $PokemonGlobal.nextBattleBGM=("Battle Totem Pokemon")
        else
          $PokemonGlobal.nextBattleBGM  = nil
          end
        $PokemonGlobal.nextBattleME   = nil
        $PokemonGlobal.nextBattleBack = nil
        return true
      end

    I think your issue lies in this line
    Code:
          $PokemonGlobal.nextBattleBGM=("Battle Totem Pokemon")
    RMXP / RGSS sometimes has issues recognizing file names with spaces. So it's better to name it like "Battle-Totem-Pokemon"
    Another thing might be that you might need to set the file path just like in the example you showed.
     
    46
    Posts
    13
    Years
    • Age 29
    • Seen Jul 2, 2018
    I think your issue lies in this line
    Code:
          $PokemonGlobal.nextBattleBGM=("Battle Totem Pokemon")
    RMXP / RGSS sometimes has issues recognizing file names with spaces. So it's better to name it like "Battle-Totem-Pokemon"
    Another thing might be that you might need to set the file path just like in the example you showed.

    Hey, I tried to set the file path, changing the name to both Battle-Totem-Pokemon and BattleTotemPokemon but it still only plays the normal battle theme :/
     
    46
    Posts
    13
    Years
    • Age 29
    • Seen Jul 2, 2018
    It's located here in the script section:
    RBedd4b.png


    after it is PField_Encounters

    The whole code for that section is

    Code:
    #===============================================================================
    # Start a single wild battle
    #===============================================================================
    def pbWildBattle(species,level,variable=nil,canescape=true,canlose=false)
      if (Input.press?(Input::CTRL) && $DEBUG) || $Trainer.pokemonCount==0
        if $Trainer.pokemonCount>0
          Kernel.pbMessage(_INTL("SKIPPING BATTLE..."))
        end
        pbSet(variable,1)
        if(species==PBSpecies::MEWZARD) then
    $PokemonGlobal.nextBattleBGM=("Battle-Totem-Pokemon")
    else
    $PokemonGlobal.nextBattleBGM=nil
    end
        $PokemonGlobal.nextBattleME   = nil
        $PokemonGlobal.nextBattleBack = nil
        return true
      end
      if species.is_a?(String) || species.is_a?(Symbol)
        species = getID(PBSpecies,species)
      end
      handled = [nil]
      Events.onWildBattleOverride.trigger(nil,species,level,handled)
      return handled[0] if handled[0]!=nil
      currentlevels = []
      for i in $Trainer.party
        currentlevels.push(i.level)
      end
      genwildpoke = pbGenerateWildPokemon(species,level)
      Events.onStartBattle.trigger(nil,genwildpoke)
      scene = pbNewBattleScene
      battle = PokeBattle_Battle.new(scene,$Trainer.party,[genwildpoke],$Trainer,nil)
      battle.internalbattle = true
      battle.cantescape     = !canescape
      pbPrepareBattle(battle)
      decision = 0
      pbBattleAnimation(pbGetWildBattleBGM(species),0,[genwildpoke]) {
        pbSceneStandby {
          decision = battle.pbStartBattle(canlose)
        }
        pbAfterBattle(decision,canlose)
      }
      Input.update
      pbSet(variable,decision)
      Events.onWildBattleEnd.trigger(nil,species,level,decision)
      return (decision!=2)
    end
     
    Last edited:
    Back
    Top