FANDOM


Last Pokémon message and BGM
This tutorial was written by HelioAU, with the script by Venom12 and modified by HelioAU. Please give credit.

This tutorial is related to the following pages:

Click here for more tutorials!


(DO NOT USE THIS WITH THE ELITE BATTLE SYSTEM!!! EBS offers a form of this functionality by default. Following this tutorial and adding it to EBS will cause EBS to BUG OUT and NOT BEHAVE PROPERLY.)

This tutorial will show you exactly how you can add a script that checks a trainers sent out Pokémon; if it's their last and they are listed within the script it will change the BGM and display a custom-set message.

Unlike venom12's script you do not need to modify the event with a switch.

PokeBattle_Battle script

Brock

Example #1

Load your project and then open the 'Script Editor' by pressing F11. You must now search for the line:

@scene.pbTrainerSendOut(index,pokemon)

which is located around line 2234.

After this add in the lines:

      # Last Pokemon script; credits to venom12 and HelioAU
      if pbPokemonCount(@party2)==1
        # Define any trainers that you want to activate this script below
        if isConst?(@opponent.trainertype,PBTrainers,:Leader_Brock)
          @scene.pbShowOpponent(0)
          # For each defined trainer, add the BELOW section for them
          if isConst?(@opponent.trainertype,PBTrainers,:Leader_Brock)
            pbBGMPlay("LastPkMnGym",100,100)
            pbDisplayPaused(_INTL("Ah ha ha! It itches! It itches!"))
          end
          # For each defined trainer, add the ABOVE section for them
          @scene.pbHideOpponent
        end
      end

You are able to define any amount of trainers in the first if line, these are the ones that will allow the rest of the script to execute. The next line you should enter only a single trainer, no ors should be added - if you want more trainers you can add them.

Set for additional trainers

Lance

Example #2

This is not difficult to do, but you simply need to edit the script slightly. Your script should be something like:

        if isConst?(@opponent.trainertype,PBTrainers,:Leader_Brock) or isConst?(@opponent.trainertype,PBTrainers,:Leader_Misty) or isConst?(@opponent.trainertype,PBTrainers,:Champion_Lance)

This means that both Leader_Brock, Leader_Misty, and Champion_Lance can now activate the script, now you need to define individual text for them:

          if isConst?(@opponent.trainertype,PBTrainers,:internalname)
            pbBGMPlay("bgmtitle",100,100)
            pbDisplayPaused(_INTL("your message here"))
          end

This is the text that you can copy+paste, and then edit, to set messages for them.

          if isConst?(@opponent.trainertype,PBTrainers,:Leader_Brock)
            pbBGMPlay("LastPkMnGym",100,100)
            pbDisplayPaused(_INTL("Ah ha ha! It itches! It itches!"))
          end
          if isConst?(@opponent.trainertype,PBTrainers,:Leader_Misty)
            pbBGMPlay("LastPkMnGym",100,100)
            pbDisplayPaused(_INTL("Hmm... You're pretty good..."))
          end
          if isConst?(@opponent.trainertype,PBTrainers,:Champion_Lance)
            pbBGMPlay("LastPkMnChampion",100,100)
            pbDisplayPaused(_INTL("All right!\nI though this would never happen!"))
          end

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.