• 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!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

[Scripting Question] EncounterModifiers for unique battle music in 19.1

  • 3
    Posts
    5
    Years
    • Seen Jan 13, 2022
    NOTE: I figured out a working solution for this! See it in the comments section below!
    I've seen it recommended in several different places that if you want to change the battle music for any encounter of a specific species, you can put this:
    Code:
      Events.onWildPokemonCreate += proc { |_sender, e|
      pokemon = e[0]
        if isConst?(pokemon.species,PBSpecies,:POKEMON)
          $PokemonGlobal.nextBattleBGM="SONG.ogg"
        end
    }
    Inside the encounter modifiers section. This made it so that every time you encountered this specific wild pokemon, the battle music that plays would be unique to this single pokemon.
    However it seems that this no longer works in v19.1, due to the changes made to the PBS systems. I'm still not well versed on all of the changes made to the system, so I could really use some help here. How do I do this same thing, with the same outcome, but in essentials version 19.1?
     
    Last edited:
    I've actually managed to figure it out on my own, and it works perfectly! It goes like this now:
    Code:
    if pokemon.species==:NAME
        $PokemonGlobal.nextBattleBGM="UNIQUESONG.ogg"
    else
        $PokemonGlobal.nextBattleBGM="DEFAULTSONG.ogg"
      end
    }

    You can also write it like this if you want to have multiple unique songs, and use || to set multiple pokemon to the same unique song.
    Code:
    if pokemon.species==:NAME1
        $PokemonGlobal.nextBattleBGM="UNIQUESONG.ogg"
      elsif pokemon.species==:NAME2 || pokemon.species==:NAME3
        $PokemonGlobal.nextBattleBGM="DUOSONG.ogg"
      else
        $PokemonGlobal.nextBattleBGM="DEFAULTSONG.ogg"
      end
    }
     
    Back
    Top