• 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] How do I change non-critical hit moves' crit ratio to 0?

79
Posts
8
Years
    • Seen Jan 12, 2024
    So, in Pokebattle_Move, under def pbIsCritical?
    Code:
        ratios=(USENEWBATTLEMECHANICS) ? [16,8,2,1,1] : [16,8,4,3,2]
    I'm assuming the 16,8,2,1 means the crit stages are 1/16, 1/8, 1/2 and 100%, however, I want the first stage to be a 0% chance (This means that non crit moves like tackle will never crit unless things like Focus Energy or Scope lens are used). How would I go about doing this? I don't want to break the universe by dividing by 0

    Thanks!
     
    1,682
    Posts
    8
    Years
    • Seen yesterday
    Well, for starters, there's no division involved, it'd just end up calling rand(0), which picks a random floating point between 0 (inclusive) and 1 (exclusive). though you could instead put a line above the return that returns false if ratios[c] is 0. that'd be simplest.
    return false if ratios[c]==0
     
    79
    Posts
    8
    Years
    • Seen Jan 12, 2024
    Well, for starters, there's no division involved, it'd just end up calling rand(0), which picks a random floating point between 0 (inclusive) and 1 (exclusive). though you could instead put a line above the return that returns false if ratios[c] is 0. that'd be simplest.
    return false if ratios[c]==0

    When you say above the return, do you mean above return @battle.pbRandom(ratios[c])==0? So like:

    Spoiler:
     
    Back
    Top