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

Adding compiler script for third Pokémon type

  • 18
    Posts
    9
    Years
    • Seen Jun 22, 2015
    I want to add a third type and have done so with moderate success. However, when editing the compiler script I gave type3 the value of 10 which is the same as the value for the base stat of HP effectively changing the base HP stat for all Pokemon to the number of their third type. Which is an issue.
    Spoiler:
    Spoiler:


    The spoilers have the specific points in the code that I am talking about. So my issue now is that I need a new value to assign to type3. Is there a value that is already set to the defacto type3 written into the generation 6 version of essentials that I should use? Or will I need to assign a new value? If a new value what should I assign?

    I also know that a part of this will be editing other places in the script to understand this, I know some of those places such as pokebattle_pokemon but if you know of other places feel free to let me know to help keep me from missing any. Thanks in advance.
     
  • 824
    Posts
    9
    Years
    I wanted to do something similar in my game, and even figured out a value that the PBS file wasn't already using (I think I had it somewhere in the 40s?). Unfortunately Maruno said it's harder than it looks to change what can and can't be defined in a PBS file.

    My game only has four Pokemon - in two evolutionary families - that are triple-typed naturally. I just wrote a portion of my script that checks to see if the pokemon in question is one of those four. If it is, it spits up the third type. If not, it spits up a nil value.
     
  • 18
    Posts
    9
    Years
    • Seen Jun 22, 2015
    Thanks. I actually used 11 and it was open as far as I can tell at this point. The only issue I have now is that when a Pokemon has a 3 times resistance it is instead turning into being immune.

    Is there a place in the code that tells says something along the lines of:
    if typemod < 1
    typemod = 0

    I can't find anywhere in the code that is causing this issue. Where should I be looking?
     
  • 824
    Posts
    9
    Years
    Thanks. I actually used 11 and it was open as far as I can tell at this point. The only issue I have now is that when a Pokemon has a 3 times resistance it is instead turning into being immune.

    Is there a place in the code that tells says something along the lines of:
    if typemod < 1
    typemod = 0

    I can't find anywhere in the code that is causing this issue. Where should I be looking?

    More than likely typemod needs to stay a whole number, so if it gets below 1 it automatically becomes 0. Don't think it's a problem in my game because the three types I'm mixing in each case don't ever have more than two resists together. I do have one threesome that all are weak to the same thing, but that's not an issue.

    You should be looking for something along the lines of "typemod.floor"





    EDIT: found it. PokeBattle_Move, around line 521. It's probably code that was added by the Gen VI project, though, since it deals with Trick-or-Treat and Forest's Curse adding a third pseudo-type.

    Code:
        if mod2>2 && mod3>2
          mod2=((mod2+mod3)/2)[COLOR="Red"].floor[/COLOR] #coerce mod3 into mod2
        else
          mod2=((mod2*mod3)/2)[COLOR="red"].floor[/COLOR] #coerce mod3 into mod2
        end

    You might want to ask them, though, what happens if those are removed.



    SECOND EDIT: Turns out I was wrong. My suggestion is to go through everything and multiply any checks for typemod by 4 (allowing for that fourth type added by Forest's Curse and Trick-or-Treat.) It's hard to explain what I just did. Basically if something says "if typemod>4", change it to "if typemod>16", if it says "damage=damage*typemod/4.0", change it to "damage=damage*typemod/16.0). Then remove the division by 2 in your type effectiveness code.
    Turns out I had to do this myself because if certain type-combinations got hit by Forest's Curse, they would start triple-resisting Water.
     
    Last edited:
  • 18
    Posts
    9
    Years
    • Seen Jun 22, 2015
    Yeah I found all of those spots as well.

    I found a solution this afternoon. I added this line of code into the pokebattle_move and pokebattle_AI scripts at the end of the pbtypemodifier script:

    return 0.5 if (mod1==1 && mod2==1 && mod3==1)
     

    Maruno

    Lead Dev of Pokémon Essentials
  • 5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    There are a number of unused Pokémon data bytes. 54-75, for a start. You can use one of those.

    No Pokémon, even in Gen 6, has a third type. There are a couple of Gen 6 moves which temporarily add an effect to a Pokémon in battle that mimics the existence of a third type, but that is absolutely not the same thing as a genuine third type. So no, the third type is not defined in Essentials and is not supported.

    Thanks. I actually used 11 and it was open as far as I can tell at this point.
    Data byte 11 is the Pokémon's base Attack stat.

    BaseStats is a set of 6 u's. Each one is a byte, starting with the byte of the number given. Therefore base stats use up bytes 10, 11, 12, 13, 14 and 15. The same applies for other properties that have multiple letters representing them. Also remember that some letters (capital E, f and w) mean the data is 2 bytes rather than 1. So WildItemCommon will use up both bytes 48 and 49.
     
    Last edited:
    Back
    Top