• 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?".
  • 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.

[Scripting Question] Obedience Check and Experience Gain Questions

25
Posts
8
Years
  • Age 33
  • Seen May 30, 2018
Hello,

I have the following questions about Pokémon Essentials:

1) For the Obedience Check script (within "PokeBattle_Battler"), does the number of badges part (ex: if @battle.pbPlayer.numbadges>=5) consider the order of badges ? Or is it just simply how many badges you have (order doesn't matter) ?

2) Is there a way to increase the probability of a Disobedient Pokémon ignoring orders ? If so, how is this done ?

3) Is there a way to slow down all Pokémon experience gain ? Like within the "PBExperience" script ?

Any help would be appreciated.
Thank you !
 
1,677
Posts
8
Years
  • Age 23
  • Seen today
Well, I know how to answer the first two questions, the third, I have ideas but no real answer.

1) The obedience check just checks the number of badges the player has, hence the variable being called numbadges.

2) You can change the probability by changing these calculations in def pbObedienceCheck?
Code:
    disobedient = false
    # Pokémon may be disobedient; calculate if it is
    badgelevel = 10*(@battle.pbPlayer.numbadges+1)
    badgelevel = PBExperience::MAXLEVEL if @battle.pbPlayer.numbadges>=8
    move = choice[2]
    if @pokemon.isForeign?(@battle.pbPlayer) && @level>badgelevel
      a = ((@level+badgelevel)*@battle.pbRandom(256)/256).floor
      disobedient |= (a>=badgelevel)
    end
    if self.respond_to?("pbHyperModeObedience")
      disobedient |= !self.pbHyperModeObedience(move)
    end
    return true if !disobedient
The short form is it calculates the level that pokemon obey for badges (10* [numbadges+1] or 100 if you have more than 8 badges). If you aren't the original trainer (@pokemon.isForeign?) and the pokemon's level is greater than the badge level, it does this formula:
Code:
 a = ((@level+badgelevel)*@battle.pbRandom(256)/256).floor
and if the result is greater than or equal the badge level, the pokemon is disobedient. (To step through it, The pokemon level + the badge level * [random number between 0 and 255] all divided by 256 and put to the lowest whole number. You can try running your own numbers through to see the results.)
Also, if the pokemon is in hyper mode, it has its own chance to disobey.
If you replace the above formula with your own, you can change the chance to disobey.

3) So the experience per level is in PBExperience in the big array at the start. I don't think you'll want to change the numbers directly because that would suck, and you would have to balance it and stuff.
You could change def pbGainExpOne to give less exp to the pokemon. that would technically work, and is much simpler than before. 1931 is the last line of calculation for exp before it is given to the pokemon, you could, IDK, divide it to make it smaller or whatever.
And there's always changing the base EXP of all of the pokemon to be lower in the PBS files, which depending on how you do it, can also suck.
 
25
Posts
8
Years
  • Age 33
  • Seen May 30, 2018
Thanks for the reply ! I have some follow-up questions. . . .

1) I plan on creating a Global Switch for the Obedience Check feature. The Global Switch I want to design should function to "LIFT" the Obedience Check feature. If I did this, would it be like:

Code:
 return false if $game_switches[NO_OBEDIENCE_CHECK]

If so, where exactly would that part go after:
Code:
def pbObedienceCheck?(choice)

2) I hadn't noticed the script part with:
Code:
badgelevel = PBExperience::MAXLEVEL if @battle.pbPlayer.numbadges>=8
If my game has 27 total badges, would I replace the "8" with "27"?

3) I'm doing all of this because essentially many players of my game are usually over-leveled by about 10-15 levels during each part of the game. My original thought was to modify the PBS files. But I don't want to increase Battle Trainer Pokémon levels since that might take too long. I did think about changing all Pokemon growth rates to "Slow" but that doesn't seem efficient via the PBS files.

However, going back to the PBExperience, I also thought about just replacing all the numbers in the "@PBExpTable=[" with the numbers for the "Slow" growth rate.
I'm assuming that would effectively change ALL Pokemon growth rates to "Slow" despite what their PBS data says.

B/t that method and the one you mentioned with the "def pbGainExpOne" part, which could potentially be more effective at trying to close that 10-15 level gap ?

PS: Would turning "USESCALEDEXPFORMULA" to 'true' also help things out ?

Thanks for the help !
 
Last edited:
87
Posts
7
Years
  • Age 34
  • Seen Nov 22, 2023
While you're waiting, If you're still wanting to modify the growth rates, you can get a program like Notepad++.
Do a ctrl + f and click on "Replace".
Type these in the "find what" and replace each of them with "SLOW".
Fast
Medium
Parabolic
Erratic
Fluctuating
 
1,403
Posts
9
Years
  • Seen yesterday
Thanks for the reply ! I have some follow-up questions. . . .

1) I plan on creating a Global Switch for the Obedience Check feature. The Global Switch I want to design should function to "LIFT" the Obedience Check feature. If I did this, would it be like:

Code:
 return false if $game_switches[NO_OBEDIENCE_CHECK]

If so, where exactly would that part go after:
Code:
def pbObedienceCheck?(choice)

I think you want to say "return true if ...", because it looks like true means "obey" ("return true if !disobedient" is true if not disobedient, i.e. disobedient is false). Should be fine to just stick it at the top of the function.

2) I hadn't noticed the script part with:
Code:
badgelevel = PBExperience::MAXLEVEL if @battle.pbPlayer.numbadges>=8
If my game has 27 total badges, would I replace the "8" with "27"?

That sounds about right.
 
Last edited:
25
Posts
8
Years
  • Age 33
  • Seen May 30, 2018
Hello, thanks again for the replies.

1) Ideally, I want the "Default" state of my game to enforce the Obedience Check. So I'm just confused why I should change "return false" to "return true". . . .
For example, Mega Evolution is by "Default" allowed in Essentials. The same for Z-Moves when you add it in.

And when I check the scripts that negate those two features, they both use "return false if . . . ."
Thus, wouldn't it also be "return false" for Obedience ?

And by at the "top" of the function, do you mean right below?:
Code:
def pbObedienceCheck?(choice)

And would it go above or below?:
Code:
    return true if choice[0]!=1
Or perhaps it doesn't matter, lol . . . .

2) Would turning "USESCALEDEXPFORMULA" to 'true' also help things out for my level scaling problem ? The scripts state:
# * Whether the Exp gained from beating a Pokémon should be scaled depending on
# the gainer's level as in Gen 5 (true), or not as in other Gens (false).

So is Gen 5 experience gain slower than all other gens ?

I think the answers to these questions will help me finalize what changes I want to make to my game :)
 
1,677
Posts
8
Years
  • Age 23
  • Seen today
If you return false, that means that the pokemon has disobeyed the trainer and does it's own thing.
So, if you want to just skip the check and have all pokemon obey, return true. Want all to disobey, return false, but you should make your effect happen before you kick it to return false.

It should go below all of these checks
Code:
return true if choice[0]!=1
    return true if [email protected]
    return true if [email protected]?(@index)
For the record, it just check if the player is using a move (if not, return true), I'm not sure what internal battle is, but if it's not one, return true, and if the pokemon does not belong to the player, return true.
We probably don't want to override any of those checks.

USESCALEDEXPFORMULA just tells essentials to use this formula
Delta_exp_gen5.png
instead of this one
Delta_exp_gen6.png

Bulbapedia does a better job of explaining the parts of the formula than I can. You can try making two graphs in a graphing program (Desmos is pretty good) and pick the one that gives less experience overall.
 
25
Posts
8
Years
  • Age 33
  • Seen May 30, 2018
Thanks everyone for the replies ! I believe I have been able to make the changes I wanted. I ended up using a combination of what every poster replied with.

I hope this thread helps someone else in the future {:3}
 
Back
Top