Introduction + Code
Wild Pokemon you can't catch are a pretty novel concept, and can make for an interesting story experience; for example, it can be partially involved with recreating the Totem Pokemon Battles from Sun and Moon! The tutorial itself is rather simple to work with, so lets dive right into it! I've isolated the code itself from all the additional flavor I've made for this, so if you just want the code, you don't need to leave this tab at all.
First things first, we're gonna have to move PokeBattle_Battle When you're there, do a search for this bit of code:
Right after the else, we're going to insert this chunk of code:
As you can see, we make use of a global switch to determine whether or not this Pokemon can be caught. This switch is important to rememberand i really should have made it an option in settings but i digress, so make sure you create the relevant switch!
Flavor Edits
So, you want a little more. That's cool, so did I. That's why I made more. The following changes make it so that it displays strings for the special type of encounter.
First off, go to PokeBattle_Battler and search for the following bit of code (which should be around line 548 in an unmodified Essentials 16.2)
We're going to modify it so that it has another option to display. For this example, we're going to refer to them as "Territorial Battles"- Pokemon you can't catch, but can still fight. Take the code we just found, and go to where it says if @battle.opponent. Make that if statement an "elsif", and above it paste the following lines:
Next up, go back to PokeBattle_Battle and do a search for this:
Like the above examples, we're going to insert the relevant code into this. Make the if @opponent into an elsif statement, and then above that paste the following:
The next change will require you to search for:
Look for the following line,
And replace it with:
And replace it with:
And that should be all the flavor! A video of what it looks like can be seen here:
Wild Pokemon you can't catch are a pretty novel concept, and can make for an interesting story experience; for example, it can be partially involved with recreating the Totem Pokemon Battles from Sun and Moon! The tutorial itself is rather simple to work with, so lets dive right into it! I've isolated the code itself from all the additional flavor I've made for this, so if you just want the code, you don't need to leave this tab at all.
First things first, we're gonna have to move PokeBattle_Battle When you're there, do a search for this bit of code:
Code:
if @opponent && (!pbIsSnagBall?(ball) || !battler.isShadow?)
@scene.pbThrowAndDeflect(ball,1)
pbDisplay(_INTL("The Trainer blocked the Ball!\nDon't be a thief!"))
else
Code:
if $game_switches[xxx] # Pokemon can't be caught switch
pbDisplay(_INTL("It dodged the thrown Ball! It looks like it's refusing to be caught! We have to knock it out!"))
return
end
As you can see, we make use of a global switch to determine whether or not this Pokemon can be caught. This switch is important to remember
Flavor Edits
So, you want a little more. That's cool, so did I. That's why I made more. The following changes make it so that it displays strings for the special type of encounter.
First off, go to PokeBattle_Battler and search for the following bit of code (which should be around line 548 in an unmodified Essentials 16.2)
Code:
################################################################################
# About this battler
################################################################################
def pbThis(lowercase=false)
if @battle.pbIsOpposing?(@index)
if @battle.opponent
return lowercase ? _INTL("the opposing {1}",self.name) : _INTL("The opposing {1}",self.name)
else
return lowercase ? _INTL("the wild {1}",self.name) : _INTL("The wild {1}",self.name)
end
elsif @battle.pbOwnedByPlayer?(@index)
return _INTL("{1}",self.name)
else
return lowercase ? _INTL("the ally {1}",self.name) : _INTL("The ally {1}",self.name)
end
end
We're going to modify it so that it has another option to display. For this example, we're going to refer to them as "Territorial Battles"- Pokemon you can't catch, but can still fight. Take the code we just found, and go to where it says if @battle.opponent. Make that if statement an "elsif", and above it paste the following lines:
Code:
if $game_switches[xxx] # Territorial Battles
return lowercase ? _INTL("the territorial {1}",self.name) : _INTL("The territorial {1}",self.name)
Next up, go back to PokeBattle_Battle and do a search for this:
Code:
# Only used for Wish
def pbThisEx(battlerindex,pokemonindex)
party=pbParty(battlerindex)
if pbIsOpposing?(battlerindex)
if @opponent
return _INTL("The foe {1}",party[pokemonindex].name)
else
return _INTL("The wild {1}",party[pokemonindex].name)
end
else
return _INTL("{1}",party[pokemonindex].name)
end
end
Like the above examples, we're going to insert the relevant code into this. Make the if @opponent into an elsif statement, and then above that paste the following:
Code:
if $game_switches[xxx]
return _INTL("The territorial {1}",party[pokemonindex].name)
The next change will require you to search for:
Code:
#========================
# Initialize wild Pokémon
#========================
if !@opponent
if @party2.length==1
if @doublebattle
raise _INTL("Only two wild Pokémon are allowed in double battles")
end
wildpoke=@party2[0]
@battlers[1].pbInitialize(wildpoke,0,false)
@peer.pbOnEnteringBattle(self,wildpoke)
pbSetSeen(wildpoke)
@scene.pbStartBattle(self)
pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
elsif @party2.length==2
if !@doublebattle
raise _INTL("Only one wild Pokémon is allowed in single battles")
end
@battlers[1].pbInitialize(@party2[0],0,false)
@battlers[3].pbInitialize(@party2[1],0,false)
@peer.pbOnEnteringBattle(self,@party2[0])
@peer.pbOnEnteringBattle(self,@party2[1])
pbSetSeen(@party2[0])
pbSetSeen(@party2[1])
@scene.pbStartBattle(self)
pbDisplayPaused(_INTL("Wild {1} and\r\n{2} appeared!",
@party2[0].name,@party2[1].name))
else
raise _INTL("Only one or two wild Pokémon are allowed")
end
Look for the following line,
Code:
pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
And replace it with:
Code:
if $game_switches[xxx]
pbDisplayPaused(_INTL("The territorial {1} attacked!",wildpoke.name))
else
pbDisplayPaused(_INTL("Wild {1} appeared!",wildpoke.name))
end[code]
In that same chunk of code, do the same to this line,
[code] pbDisplayPaused(_INTL("Wild {1} and\r\n{2} appeared!",
@party2[0].name,@party2[1].name))
And replace it with:
Code:
if $game_switches[xxx]
pbDisplayPaused(_INTL("The territorial {1} and\r\n{2} attacked!",
@party2[0].name,@party2[1].name))
else
pbDisplayPaused(_INTL("Wild {1} and\r\n{2} appeared!",
@party2[0].name,@party2[1].name))
end
And that should be all the flavor! A video of what it looks like can be seen here:
- Credits
- I'm not going to ask for credit here because I can't remember if I came up with it myself or not. I was inspired by someone's Ghost code though, I think. So give credit to Desbrina tbh.