• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • 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] Help on creating a new Pokeball?

  • 85
    Posts
    7
    Years
    • Seen Nov 24, 2023
    I want to make a pokeball that has a 100% catch rate on a pokemon that hasn't been recorded in the pokedex yet, but will always fail if it was already recorded. Here is the code that I have:
    Code:
    BallHandlers::ModifyCatchRate.add(:BALL,proc{|ball,catchRate,battle,battler|
       if battle.pbPlayer.seen[battler.species]
         next (catchRate*0).floor
       else
         next true
       end
    })

    This doesn't crash the game, but it seems to act more like a normal pokeball when I use it in battle regardless on wheter I use it on a pokemon that I've already encountered or not.

    Can anyone help me out?
     
    You really should be making the check in isUnconditional, like a masterball.
    Also every mon you encounter in battle is automatically seen, so, yeah...
    also the catch rate is set to 1 if it's less than 1 (that's not the right term for it, but the catch rate feeds into the number.)
    x=1 if x<1 this is the capping code
     
    Well, we can't allow x to be less than 1 in the not unconditional check, because otherwise we get a divide by 0 error.
    But we should be able to do an elsif

    Okay here's the steps. We need both isUnconditional and modify catch rate. the modify will always set the rate to 0, but it doesn't matter because the isUnconditional will ignore all that catch rate stuff.
    Then we find this bit
    Code:
            if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
              shakes=4
            else
    and change it to
    Code:
            if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
              shakes=4
            elsif isConst?(ball,PBItems,:BALL)
              # NOP
            else
    So now ball will fail unless the unconditional goes through. You still need to figure out the condition, but this should act like an always fail otherwise.
     
    So now ball will fail unless the unconditional goes through. You still need to figure out the condition, but this should act like an always fail otherwise.

    I understand. Thanks a lot for the help!
     
    Back
    Top