• 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?".
  • Forum moderator applications are now open! Click here for details.
  • 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
15
Years
Based on this TUT:
http://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