Advertiser Content

Scripting Question Base stats above 255?

Started by BlowDryMan November 9th, 2018 12:03 PM
  • 5 replies



Larua Region
Seen 8 Hours Ago
Posted 4 Weeks Ago
303 posts
2.2 Years
There actually is no way to change the base stat over 255 via pokemon.txt you can only do it by code which could be quite a lot of code. If it's just for one species it should be fine though.
Looking for spriters to help with

Pokemon Hollow on
Seen September 2nd, 2019
Posted September 2nd, 2019
4 posts
284 Days
I've been having this problem for a while now and want to make another post asking this now that I've gotten more information.

Whenever I edit the base stats in "pokemon.txt" to go above 255, the base stats loop through (meaning an input of 256 registers as 1). I have a feeling that this happens in the "Compiler" script. At line: 1600 is where the compiler reads the "pokemon.txt" PBS file. I was wondering if anybody who has more knowledge than I could understand what causes this and a way to allow for base stats to go above 255 without damaging everything else. Any help is appreciated and thanks in advance.

Well you are right on the money when it comes to this being caused by the Compiler, but it goes a lot deeper than that. See the compiler just writes the bytes into the proper format, but you'll also have to change every place that reads the bytes for the base stats, and the offsets too.
Now I'm not going to go into a full step by step of all the changes, but I will bring up the big ones. First the Compiler, quick rundown.
"BaseStats" => [10,"uuuuuu"],
So the 10 is the offset and the "uuuuuu"s is the format that it's expecting. Now, def pbCompilePokemonData has its own format for these strings, but "u" is a single byte positive integer. Now for larger than 255, you need a second byte, and you can get it by changing those "u"s to "w", for Positive double byte integers.
DON'T DO THAT RIGHT AWAY. See the problem here is the next field, Rareness, is at offset 16, and we will run into it if we just blindly change it directly. Now you have two options, shuffle everything down (very bad idea, because you will need to change every single place the game checks for data) or move the base stats somewhere else. Bytes 59 though 75 are free, so that's a good place to put it. So change the 10 to 59, or whatever, so long as you have 12 bytes of room.
Repeat these changes for def pbCompilePokemonForms.

Now part two, the base stats. There are at least 3 different places that need to change, maybe more. Finding any of the others is on you, I'm only gonna talk about the main part of the change.
So this method is from class PokeBattle_Pokemon, but the idea is more or less the same regardless of where you find it.
def baseStats
dexdata.fgetb, # HP
dexdata.fgetb, # Attack
dexdata.fgetb, # Defense
dexdata.fgetb, # Speed
dexdata.fgetb, # Special Attack
dexdata.fgetb # Special Defense
return ret
So, first things first, pbDexDataOffset(dexdata,self.fSpecies,10). Don't worry about the first variable, the second is just the species, but the third is what's really important. Remember that 10 in compiler? Well, here it is again. Change that to whatever your new offset is. 59, whatever, I don't care.
Now the other bit is the fgetb. This grabs a single byte. We don't want that. So change it to fgetw, which grabs two bytes. (You'll see it in def baseExp and if you check the compiler BaseEXP is a "w")

(Two other sections like this that I found include PBattle_OrgBattleRules and PMinigame_TripleTriad)

I'm not too sure of any other changes that would need to be done. Possibly formulas expecting the base stats to be capped at 255. I won't get into that, as that's beyond the scope at this point.


Seen 58 Minutes Ago
Posted 6 Hours Ago
957 posts
4.2 Years
Oh hey, that's me!

Advertiser Content