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

[Custom Feature Question] Just wondering if there's anyway to increase the base damage limit of moves from 255 to higher amounts.

15
Posts
3
Years
    • Seen Nov 1, 2020
    Just wondering if there's anyway to increase the base damage limit of moves from 255 to higher amounts.
    I got the error message I attached below when I made a move with over 255 base damage. If anyone is willing to help, that help would be greatly appreciated.
     

    Attachments

    • IMG_20200702_224347.jpg
      IMG_20200702_224347.jpg
      120.8 KB · Views: 10
    286
    Posts
    5
    Years
    • Seen May 9, 2024
    Perhaps you would want to delete this line in Compiler:
    Code:
    pbCheckByte(record[4],_INTL("Base damage"))

    Or maybe you are interested in changing the method itself (also in Compiler), but know that this method is also used with Accuracy, Total PP, and Additional Effect:
    Code:
    def pbCheckByte(x,valuename)
      if x<0 || x>255
        raise _INTL("The value \"{1}\" must be from 0 through 255 (0x00-0xFF in hex), got a value of {2}\r\n{3}",
           valuename,x,FileLineData.linereport)
      end
    end
    I'm just speculating though.
     
    15
    Posts
    3
    Years
    • Seen Nov 1, 2020
    Perhaps you would want to delete this line in Compiler:
    Code:
    pbCheckByte(record[4],_INTL("Base damage"))

    Or maybe you are interested in changing the method itself (also in Compiler), but know that this method is also used with Accuracy, Total PP, and Additional Effect:
    Code:
    def pbCheckByte(x,valuename)
      if x<0 || x>255
        raise _INTL("The value \"{1}\" must be from 0 through 255 (0x00-0xFF in hex), got a value of {2}\r\n{3}",
           valuename,x,FileLineData.linereport)
      end
    end
    I'm just speculating though.

    Thank you for the response but when testing out what you said, it looks like if you go over the base damage (255) it resets. Like when an attack I made has 299 damage it becomes 44 damage instead.
     
    233
    Posts
    5
    Years
    • Seen Oct 9, 2023
    Thank you for the response but when testing out what you said, it looks like if you go over the base damage (255) it resets. Like when an attack I made has 299 damage it becomes 44 damage instead.

    This happens because Essentials stores the base damage stat as a byte, which is a whole number that can only have a value in the range 0-255, so if you try to write something like 256, it will "wrap around" back to 0 in order to preserve that range. The edit that silverlime suggested lets you write any integer without having the compiler throw an error message, however it won't actually preserve it because of said wrap-around (but you still need his edit, so keep it anyways). What you need to do next is have Essentials store the base damage stat as something with a bigger range than a byte - possibly a half-word, which has the next largest range of 0-65535. Go to Compiler, under "def pbCompileMoves", and find this line:
    Code:
    ].pack("vCCCCCCvCvC")
    You should get two search results, both pretty close to each other. Change both of them to the following:
    Code:
    ].pack("vSCCCCCvCvC")
    Again, make sure to change BOTH lines that show up as search results. I changed the second character from C to S, which changes the base damage from a byte to a half-word (found that here: https://apidock.com/ruby/Array/pack). That should prevent the wrap-around from occurring now.
     
    15
    Posts
    3
    Years
    • Seen Nov 1, 2020
    This happens because Essentials stores the base damage stat as a byte, which is a whole number that can only have a value in the range 0-255, so if you try to write something like 256, it will "wrap around" back to 0 in order to preserve that range. The edit that silverlime suggested lets you write any integer without having the compiler throw an error message, however it won't actually preserve it because of said wrap-around (but you still need his edit, so keep it anyways). What you need to do next is have Essentials store the base damage stat as something with a bigger range than a byte - possibly a half-word, which has the next largest range of 0-65535. Go to Compiler, under "def pbCompileMoves", and find this line:
    Code:
    ].pack("vCCCCCCvCvC")
    You should get two search results, both pretty close to each other. Change both of them to the following:
    Code:
    ].pack("vSCCCCCvCvC")
    Again, make sure to change BOTH lines that show up as search results. I changed the second character from C to S, which changes the base damage from a byte to a half-word (found that here: https://apidock.com/ruby/Array/pack). That should prevent the wrap-around from occurring now.

    Thanks but for some reason this messes up the moves pp, damage and typing. Like a move that is a dark type which does 60 damage and had pp of 10 becomes a normal type that has 25 pp and does ??? Damage.
     
    233
    Posts
    5
    Years
    • Seen Oct 9, 2023
    Thanks but for some reason this messes up the moves pp, damage and typing. Like a move that is a dark type which does 60 damage and had pp of 10 becomes a normal type that has 25 pp and does ??? Damage.

    Sorry! I forgot one more change you need to make. Since you changed the way moves are stored, it messed up how they get read in during the game. So, just find all 3 instances of this line:
    Code:
    @basedamage = movedata.fgetb
    and replace each one with:
    Code:
    @basedamage = movedata.fgetw
    Also I said earlier that this is a "half-word" and not a byte, but apparently it's a full word (doesn't affect the code or anything).
     
    15
    Posts
    3
    Years
    • Seen Nov 1, 2020
    Sorry! I forgot one more change you need to make. Since you changed the way moves are stored, it messed up how they get read in during the game. So, just find all 3 instances of this line:
    Code:
    @basedamage = movedata.fgetb
    and replace each one with:
    Code:
    @basedamage = movedata.fgetw
    Also I said earlier that this is a "half-word" and not a byte, but apparently it's a full word (doesn't affect the code or anything).

    Sorry but this didn't fix much, the problems I stated before are still there but now I see the damage, which is not the amount I picked. Like I made a attack do 500 damage but it instead states it does 2553 damage
     
    233
    Posts
    5
    Years
    • Seen Oct 9, 2023
    Sorry but this didn't fix much, the problems I stated before are still there but now I see the damage, which is not the amount I picked. Like I made a attack do 500 damage but it instead states it does 2553 damage

    Okay, this time I went into an Essentials project and actually tried to implement these changes myself, and now I see the problem. You need to change three more lines (sorry):

    Find both instances of this:
    Code:
     movedata.pos = moveid*9
    and replace with
    Code:
     movedata.pos = moveid*10

    Find this:
    Code:
    movedata.pos = moveid*14
    and replace with:
    Code:
    movedata.pos = moveid*15
    keeping all other changes that I mentioned earlier. I actually tested this one so it should work now, just make sure to recompile everything again.
     
    15
    Posts
    3
    Years
    • Seen Nov 1, 2020
    Okay, this time I went into an Essentials project and actually tried to implement these changes myself, and now I see the problem. You need to change three more lines (sorry):

    Find both instances of this:
    Code:
     movedata.pos = moveid*9
    and replace with
    Code:
     movedata.pos = moveid*10

    Find this:
    Code:
    movedata.pos = moveid*14
    and replace with:
    Code:
    movedata.pos = moveid*15
    keeping all other changes that I mentioned earlier. I actually tested this one so it should work now, just make sure to recompile everything again.

    Thank you it works! Appreciate the help you gave out!
     
    Back
    Top