Resource icon

Disable Experience Gain Depending on Pokemon's Level

Pokémon Essentials Version
v17.2 ✅
This script will allow you to use switch to determine level capacity for pokemons without making them disobedient. Once the switch is activated, the player's pokemon wont gain any experience if they're above the specified level. You can put the wanted level depending on what you want to do with this.
This script will work on Pokemon Essentials 16.2 as well :)

First I have to say thank you to Mamba in Pokecommunity who helped in a thread and gave me what I needed to make this work please check credits.
Second, I have to thanks MGriffin who helped a lot by suggesting another way to make it work !

So there will be two versions, for two slightly different purposes :

First version using switchs with defined level capacitys. That's useful for example if like me you have a specific building in which your player can farm experience but you don't want him to train too hard. You can gradually unlock the level cap in the specific building while letting the remaining level available for him to train low level pokemons.
To use the switch version, do the following.
Use Ctrl + Maj + F looking for "# Now calculate EXP for the participants " and just after this :
Code:
if haveexpall
            showmessage=true
Paste this :

Code:
 #Disable Experience message depending on level
            if $game_switches[252]==true
              showmessage=false
            end
            if $game_switches[253]==true
              showmessage=false
            end
            if $game_switches[254]==true
              showmessage=false
            end
            if $game_switches[255]==true
              showmessage=false
            end
This will disable the "Gardevoir gains 5000XP" message after making a foe faints.
Note : You can change the switches numbers, and you can remove or add any switch you want. Just keep in mind each switch function start with the "If" and ends with "end" if you're cutting one.

Then, look for "growthrate=thispoke.growthrate " and after this :
Code:
newexp=PBExperience.pbAddExperience(thispoke.exp,exp,growthrate)
    exp=newexp-thispoke.exp
Paste this :

Code:
  #Disable Exp Gain depending on level
    if $game_switches[252]==true && thispoke.level>9
        exp=0
      end
      if $game_switches[253]==true && thispoke.level>19
        exp=0
      end
      if $game_switches[254]==true && thispoke.level>29
        exp=0
      end
      if $game_switches[255]==true && thispoke.level>39
        exp=0
      end
      #--------------------------------------------------
This way, if switch 252 is ON and your battler is above level 9 (so 10 or higher) it wont gain any exp by battling. As above, you can add or modify any switch to scale your level capacity as you like. Just edit the level or add another switch. You can name them whatever you want, but if you add a switch in the list, make sure to both disable the experience gain message and the experience gained. So you need to copy, paste and edit two things.

If you're using it in a training building like me, you'll have to event it like this :

-> Ask the player to choose a level cap using a conditional branch. Depending on the choice, you'll activate the needed switch.
-> In each trainer event, you'll need one page for each level the player can train on. For example if you have level 10,20,30,40 you'll need 4 pages with the same trainer, but changing the switch condition for it to appear with the switch you created. Then you have to edit the trainer itself and match his team with the level capacity.
-> At the end of the training room, in the event that will teleport the player back to the main room, add an event that turn every level cap switches off.

Bonus: If you want your NPC trainers to reset themselves after the player leaves the room, instead on turning on their self switch, put this :
Code:
setTempSwitchOn("A")
In a script and use switch 21 "s:tsOn?("A") to make it unable to battle again. That will reset the self switch when the player is gonna leave the room and he will be able to battle them again if he returns.

Now for the second method. It's using a variable you can customize as you like during the whole game. It's better used to easily determine a level capacity that will evolve with plot checkpoints such as badges, as it will take only 1 variable and 1 switch to control your whole game.

Again, Use Ctrl + Maj + F looking for "# Now calculate EXP for the participants " and just after this :
Code:
if haveexpall
            showmessage=true
But this time, Paste this :

Code:
   if $game_switches[268]==true && thispoke.level>$game_variables[262]
         showmessage=false
         end
It's the same process as mentionned above. You define a switch (268 in the example, which you can change to a free switch you have) and if the switch is activated and the pokemon level is above the number contained in the variable (You can change the variable's number by anything you want as well), the experience message won't be displayed.
Now look for "growthrate=thispoke.growthrate " and after this :
Code:
newexp=PBExperience.pbAddExperience(thispoke.exp,exp,growthrate)
    exp=newexp-thispoke.exp
Paste this :

Code:
   if $game_switches[268]==true && thispoke.level>$game_variables[262]
         exp=0
         end
Same customizations available as above, but this time it's for avoiding the experience gained.
Once you pasted that, you'll follow those steps:

- When your game start, you have to activate the switch through an event, and add a value to the variable through an event as well.
- At each plot checkpoint, you have to modify the variable's value by an event. For example if it changes with the badge, don't forget to change the value of the variable in the same event in which the player is receiving the badge.

Hope it will help !
Credits
Mamba from Pokecommunity
https://www.pokecommunity.com/showpost.php?p=9962175&postcount=16
Mgriffin from Pokecommunity
https://www.pokecommunity.com/showpost.php?p=10000673&postcount=4
Credits to me aren't necessary this is just a short edit.
Author
Simeo
First release
Last update
Rating
0.00 star(s) 0 ratings
Top