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

pokemon.type3 not functional in version 13

64
Posts
10
Years
    • Seen May 29, 2020
    Dear all,

    In the 12th version of essentials I had a third, fourth and fifth type per pokemon working. All it did was add STAB to moves of the 3rd through 5th type, effectiveness remained unedited. Now in the 13th version of essentials it's not working anymore.

    I think 4 major script sections are involved (tell me if I'm missing something):

    It starts in the compiler:

    Spoiler:

    Then it goes to PokemonMap, to the small def pbDexDataOffset:
    Spoiler:

    Next comes the part (PokeBattle_Pokemon) where it *seems* to go wrong, but the error would be hard to miss if it indeed goes wrong here:
    Spoiler:

    Finally, to check the type, here is the part of the PokemonSummary, in def drawPageOne (note that type 5 is NOT shown in the summary, this type has a special purpose that is not important here):
    Spoiler:

    The way it works now, is that it shows only the first two types. For example, zubat shows POISON FLYING, while it should be POISON FLYING SOUND AIR.

    If I force the summary to show all types, I get POISON FLYING POISON POISON.

    If I then change the pbDexDataOffset numbers in PokeBattle_Pokemon of type 2 to those of type 3 and vice versa, I get POISON SOUND POISON POISON.

    This last test indicates that the compiler and the pbDexDataOffset do their work right, but the def Pokemon.type3 is not working. Somewhere, the types 3 and 4 (and 5) seem to be overwritten after they are loaded.

    Questions that may help me if answered:
    - is there some important piece of code I'm missing here?
    - is there a new piece of code in essentials 13 that messes with the pokemon types?
    - is there a reason why a 3rd type would not be 'picked up', because of, for example, a piece of code telling it that any pokemon cannot have more than 2 types?

    For the record:
    - it did work in version 12 and it still does.
    - I tried looking for differences in the code of version 12 and version 13, but found none.
    - it doesn't show in the summary, but it also doesn't work in battle. That means the summary itself is probably not at fault.
    - Obviously, I did add all extra types in the PBS text-files, and these extra types work as long as they are type 1 or type 2.
    - The fifth type is only present to be able to give every pokemon the invisible type 'AIRBORNE'. Basically, AIRBORNE works as LEVITATE. Now all pokemon that seem to float or fly cannot be hit by ground-type moves. The functionality of AIRBORNE is handled in the def pbTypeModifier, and displays '[move] doesn't effect [pokemon]...' like all other imune moves.

    Thank you for looking into this complex matter, I would appreciate any comment that can point me in the right direction. But at the moment I'm just clueless :S

    dexter1o6
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Obviously you've found out how Pokémon data is compiled (the 76 bytes per species thing). What you haven't noticed, though, is that a number of those bytes are not used (about byte 55 and upwards, plus a few others). You should simply save your additional types to some of those unused bytes, rather than renumbering everything else just to have them next to types 1 and 2 (which isn't necessary). All that renumbering will cause a huge headache when making sure that every other bit of data works after it's been renumbered.

    Have you fully recompiled your game?
     
    64
    Posts
    10
    Years
    • Seen May 29, 2020
    First of all, thanks for the reply.

    I had purposely chosen to renumber everything because using the search function all the bits that have to be changed can be found 'rather easily', and I found that a safer way to go than hoping that those emty bytes weren't used elsewhere (I don't know if that is even possible, but I decided to go for the safest option. And as long as I drink no coffee, I won't get a headache :P ). About the renumbering: if the renumbering would be wrong, wouldn't it be most likely that other things of the data are messed up too? I will double-check the renumbering tomorrow to be sure, but I think it is safe to assume the numbers are right.

    Yes, I have made sure the game compiled (by changing one of those PBS text files and running the game).
     
    1,224
    Posts
    10
    Years
  • First of all, thanks for the reply.

    I had purposely chosen to renumber everything because using the search function all the bits that have to be changed can be found 'rather easily', and I found that a safer way to go than hoping that those emty bytes weren't used elsewhere (I don't know if that is even possible, but I decided to go for the safest option. And as long as I drink no coffee, I won't get a headache :P ). About the renumbering: if the renumbering would be wrong, wouldn't it be most likely that other things of the data are messed up too? I will double-check the renumbering tomorrow to be sure, but I think it is safe to assume the numbers are right.

    Yes, I have made sure the game compiled (by changing one of those PBS text files and running the game).

    This doesn't help your situation, but you can make the game compile without changing anything by holding CTRL as you start it.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    I strongly recommend that you undo all the renumbering you did, and to simply use 55-57 for your extra types instead. I guarantee that they are free for use. If you're worried about potential new features being added later that might clash (as incredibly unlikely as that is), then use 73-75 instead. It may be "rather easy" to search for all instances of pbDexDataOffset and to change the numbers there, but that's many dozens of instances to change, and if you use the numbers I recommend, you don't have to touch any of them at all. It's much easier to not cause errors by not touching something than it is to be vigilant about the changes you do make to that something.

    I can't see anything wrong with the code you've provided. There's nothing in the summary screen that would prevent more than 2 types. Something is causing those types to appear as type1, and I have no idea what. I'm sure you're omitting a lot of other changes, and it could be in there.

    All I can suggest is to start from scratch, and do what I said two paragraphs above for much simplicity.
     
    64
    Posts
    10
    Years
    • Seen May 29, 2020
    I will try starting from scratch then, while keeping the current version as a backup. The first change I'll make is the type 3, 4 and 5 addition.

    I'll post again when I'm done (whether it works or not).

    EDIT: I've changed my mind. I think it's only the code I need to have a clean version of, I can keep the rest, with the only exception being pokemon.txt, because otherwise the old script may not be able to read the file.

    EDIT: So far so good. The semi-clean version of essentials didn't run because of changes in PokemonEncounter, but after re-making those changes, it worked. After adding the extra types in only the compiler, PokeBattle_Pokemon and PokemonSummary following Maruno's advise, it did indeed show up in the summary of a quick debug-cheat-zubat. Before changing everything else to the current version of my game, I will do one last attempt to get it to work in the old non-clean version by changing back all pbDexDataOffset numbers and then doing the extra type implementation Maruno's way.

    EDIT: Maruno's idea did not solve the problem, but I did find some place where I forgot to change the pbDexDataOffset number, so I didn't waste my time in changing it back to Maruno's way. Also, starting with a clean version was a good idea, it allowed me to put back in all pieces of the code one by one, and I found the following in PokemonMultipleForms (I never would have thought the error would be there):

    Spoiler:
    Obviously, from type 3 onwards, there shouldn't be a type1 in the code. I feel really stupid now, but this stuff just happens every now and then while programming.

    Anyways, thanks for the help!
     
    Last edited:
    Back
    Top