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

[Essentials Tutorial] A better way to change battle music for AI's last Pokémon

zingzags

PokemonGDX creator
  • 536
    Posts
    16
    Years
    Based on this TUT:
    https://pokemonessentials.wikia.com/wiki/Tutorial:Last_sent_out_pokemon_BGM

    I decided to make a better version so you do not have to put a switch each time for a gymleader.

    First thing you want to do is name the event "SpecialTrainer",
    then you have to replace this:
    Code:
      def pbSendOut(index,pokemon)
        pbSetSeen(pokemon)
        @peer.pbOnEnteringBattle(self,pokemon)
        if pbIsOpposing?(index)
          @scene.pbTrainerSendOut(index,pokemon)
         else
          @scene.pbSendOut(index,pokemon)
        end
      end
    With this:
    Code:
      def pbSendOut(index,pokemon)
        pbSetSeen(pokemon)
        @peer.pbOnEnteringBattle(self,pokemon)
        if pbIsOpposing?(index)
          @scene.pbTrainerSendOut(index,pokemon)
          if $game_switches[112]==true && pbPokemonCount(@party2)<2
           pbBGMPlay("PokeCenter",100,100)
         end
        else
          @scene.pbSendOut(index,pokemon)
        end
      end
    Then in pokemonFeild

    add this:
    Code:
    Events.onSpritesetCreate+=proc{|sender,e|
      spriteset=e[0] # Spriteset being created
      viewport=e[1] # Viewport used for tilemap and characters
      map=spriteset.map # Map associated with the spriteset (not necessarily the current map).
      for i in map.events.keys
        if  map.events[i].name=="SpecialTrainer"
          $game_switches[112]=true
        elsif map.events[i].name!="SpecialTrainer"
          $game_switches[112]=false
        end  
      end
    }
    under:
    Code:
    Events.onSpritesetCreate+=proc{|sender,e|
      spriteset=e[0] # Spriteset being created
      viewport=e[1] # Viewport used for tilemap and characters
      map=spriteset.map # Map associated with the spriteset (not necessarily the current map).
      for i in map.events.keys
        if map.events[i].name=="OutdoorLight"
         spriteset.addUserSprite(LightEffect_DayNight.new(map.events[i],map))
        elsif map.events[i].name=="Light"
          spriteset.addUserSprite(LightEffect_Basic.new(map.events[i],map))
        end
      end
      spriteset.addUserSprite(Particle_Engine.new(viewport,map))
    }
    change:
    Code:
      def pbEndBattle(result)
        @abortable=false
        pbShowWindow(BLANK)
        # Fade out all sprites
        pbBGMFade(1.0)
        pbFadeOutAndHide(@sprites)
        pbDisposeSprites
      end
    to:
    Code:
      def pbEndBattle(result)
        @abortable=false
        pbShowWindow(BLANK)
        # Fade out all sprites
        pbBGMFade(1.0)
        pbFadeOutAndHide(@sprites)
        pbDisposeSprites
        $game_switches[112]=false
      end
    And done, you can change the switch, and music to what ever you want.
     
    Last edited:
    Back
    Top