Resource icon

How to add Field Effects to your game

Pokémon Essentials Version
v17.2 ✅
Have you ever wanted to have Field Effects in your game?
It's personaly, one of my favorite mechanics of any fangame, so I'll teach you too how to do it too.

What are Field Effects?
If you have played Gen 6 or Gen 7, then you probably know about Terrains (Electric Terrain, Psychic Terrain ...)
Field Effects, are in a way, the exact same thing, but they are present from the very start of the battle, and are map based.
Because of this, it can be used to make fights more interesting, and based on what kind of effects those fields have, they can make the game more strategic.

What I will teach you will be:
How to make it be active from the get go-
How to let background change based on the field-
How to implement battle start up messages-
How to buff overall move types, specific moves, specific move kind-
and a couple other stuff...

Step 1: Implementing an automatic background changer:

This step is mostly for future use, it will not do anything on its own, but we will need it later on.
I will explain what it does when we get there.
In PokeBattle_Battle search for def pbCommonAnimation(name,attacker,opponent,hitnum=0)

It should look like this:

After the second end, we will define a new method,
let's call it pbChangeBGSprite

Inside of it, we will create a new variable, you can call it whatever you want, but you must remember it, as it will be the thing we will use the most.
Personally, I use $fieldeffectsbg , and I will do so for this tutorial too.

Once this new case has been created we will add 2 new cases, one for what I will call "Interior Field", which won't have anything special on it, it will be the default battle.
And, lets make, like, a Snow Field for example.
Default Essentials already comes with Backgrounds and Battle Bases for these two, so let's use those.

So, to define the background and battlebase for these fields, we will do it like this:

def pbChangeBGSprite
        case $fieldeffectsbg
          when 0 # Interior Field
          when 1 # Snow Field
This way, everytime we have to change to one of these fields, the game will know what background and battle bases to load.

And thats pretty much it for how this part, if you want to add more field effects, you just have to continue adding more when x, where x is the number of the field, its very important that the field always has that number, as it will now be defined as such.

Step 2: Basic Battle Boosts

In this step I will teach you how to boost specific types of moves, specific kind of moves (physical or special) and specific moves.

Since we went with a Snow Field for our example, I will continue to use that one, though I will take some creative liberty, so I can teach you how to do all of those kinds of things.

Let's start with Type Boosts, since we are on a Snow Field, lets boost Ice Type moves.

In PokeBattle_Move search for this piece of code:

Directly under it, lets start our Case $fieldeffectsbg.

Since Interior Field has no boosts or anything special about it, it won't appear anywhere if you're wondering.

Okay, so, once that is done, lets boost Ice type moves.

case $fieldeffectsbg
       when 1 # Snow Field
         if isConst?(type,PBTypes,:ICE)
              @battle.pbDisplay(_INTL("The cold powered up the attack!",opponent.pbThis))
The first line directly under when 1, checks the type of the move, in this case ICE, the line under that will multiply that moves power by x1.5, and the last line will pop up a message whenever that happens.
These messages don't really have any impact, and I guess you can delete them, but I feel like they are fairly important as it helps knowing what is being boosted or not.

Now, this code will boost any Ice Type moves, lets get a bit creative shall we?
Lets make grass moves weaker in this field, but ONLY, if the Pokémon using the Grass Type Move is grounded.

case $fieldeffectsbg
       when 1 # Snow Field
         if isConst?(type,PBTypes,:ICE)
              @battle.pbDisplay(_INTL("The cold powered up the attack!",opponent.pbThis))
         if !attacker.isAirborne? && isConst?(type,PBTypes,:GRASS)
               @battle.pbDisplay(_INTL("The snow field made the attack weaker!",opponent.pbThis))
What we are doing here is basicaly checking if the used is Airborne, this mean checking if its a Flying Type, has the Levitate ability, is levitating because of moves like Magnet Rise, etc...

This way we have Ice Moves that have a 50% power boost, Grass moves on non-airborne Pokémon that have a 50% power decrease.
Now let's do Move category specific, either Physical or Special, you should be able to do it on your own now:
But here's my example, in this case Im buffing Special Water Type Moves, and decreasing physical Flying type moves.

         if isConst?(type,PBTypes,:FLYING) &&
              @battle.pbDisplay(_INTL("The field weakened the attack!",opponent.pbThis))
         if isConst?(type,PBTypes,:WATER) &&
              @battle.pbDisplay(_INTL("The attack got cold!",opponent.pbThis))
So that was the code for specific Move category and specific move types.
But now, lets go for specific moves.

In PokeBattle_Move search for:

Directly under it, start the $fieldeffectsbg case again.
For this part, lets buff all the "Wind" related moves I can think of.

With this all Wind moves are boosted by 50%, you can use the same method to make moves weaker too.

PS: If you're using default Essentials, your game probably doesn't have Fairy Wind, so it might cause an error pop up while testing, either add the move to the moves.txt pbs file, or delete that part from my example!

That should be it for this part then!

Step 3: Starting the field ingame

None of the first two steps will do anything without this one, I guess this should've been the second step then oops.

Anyway, this step is still kinda of confusing for me, but lets do this then.

In PokeBattle_Battle search for the line # Initialize Battle.
You should have this:

For this part, we will need to know the code number for the maps you want this field to be in, I'm using default essentials, so I'm gonna use Route 1 for this.

To know the Number of your map, right click its name, then Map Properties.
This map is the number 5,

So let's start then:

Under end put:

This code tells the game what map will have the effect, AND, also tell it when it should use it, so with this method, it will only start the field, if you are on Tall Grass, Normal walking grass, or anything else that is considered "none".

So, as you see, it will not start the field if you are surfing for example. But will everywhere else, so, this part is really confusing, because Im not just using Terrain Tags, Im also using Environments, making it honestly really hard to make work, specialy on maps where there will be more than 1 field.
Ill try to find better solutions as I go, but as of right now, I know for a fact, a minimum of 2 fields per map is 100% possible.
Being a water one when surfing, and a land one everywhere else.

Now, lets start the background drop shall we?

Theres 2 methods for this: I use the second one because it looks a lot cleaner,

Method 1: Doing it through code:
For the game to load the Snow background in this map, we have to add this line pbChangeBGSprite. Like this:

Then, just go ingame, and test it yourself, and it should work, but theres one massive flaw with this method and its why I dont use it, the game loads first the default background, and then when the battle is fully loaded, it transforms the background into the Snow backdrop, and I don't really like that sudden change, I feel like it needs to start up from the beguinning with the correct backdrop.

Method 2: Change the maps metadata directly:

Like this, as simple as it can be. This will automatically make the map use that backdrop.

And it should be good to go!

Now all you have to do is test some moves, to see if it all works correctly.

That's all I can think of doing for now, if theres other specific things that could be interesting to do Ill update this post.

Thank you!
Blind Guardian
First release
Last update
0.00 star(s) 0 ratings