• We've opened up applications for site moderators! Head over to the announcement to learn more!

Making Custom Pokeball Script

DamonaArcana

Rookie
Member
Joined
Jan 1, 2019
Posts
1
I am making a new game where there are crystals instead of pokeballs and they have certain elements to them, but I have been working on the script for three days and I haven't been able to make a "masterball effect" to certain types and fail on others. Example I want a pokeball or crystal that 100% catches poison types but 100% fails in others. Do you guys have a script I can use?
 

Vendily

Cooltrainer
Member
Joined
May 16, 2017
Posts
154
Age
21
In that case, what you are looking for the IsUnconditional handler. While the master ball just returns true, no questions asked, we do get the battle and battler objects, so we can check the type.

Ruby:
BallHandlers::IsUnconditional.add(:POISONCRYSTAL,proc{|ball,battle,battler|
   next battler.pbHasType?(:POISON)
})
This would make it unconditional in the case of the pokemon having at least one type as poison. But you also want it to always fail if its not. We'd have to edit this bit here in PokeBattle_Battle to not do any shakes if x equals 0 or something. That way we can make a modify capture rate to always return 0 but because of the isUnconditional?, it will still activate properly.
Ruby:
if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
          shakes=4
        else
          x=1 if x<1
          y = ( 65536 / ((255.0/x)**0.1875) ).floor
          if USECRITICALCAPTURE && pbRandom(256)<c
            critical=true
            shakes=4 if pbRandom(65536)<y
          else
            shakes+=1 if pbRandom(65536)<y
            shakes+=1 if pbRandom(65536)<y && shakes==1
            shakes+=1 if pbRandom(65536)<y && shakes==2
            shakes+=1 if pbRandom(65536)<y && shakes==3
          end
        end
Change that to this instead
Ruby:
if x>255 || BallHandlers.isUnconditional?(ball,self,battler)
          shakes=4
        elsif x != 0
          x=1 if x<1
          y = ( 65536 / ((255.0/x)**0.1875) ).floor
          if USECRITICALCAPTURE && pbRandom(256)<c
            critical=true
            shakes=4 if pbRandom(65536)<y
          else
            shakes+=1 if pbRandom(65536)<y
            shakes+=1 if pbRandom(65536)<y && shakes==1
            shakes+=1 if pbRandom(65536)<y && shakes==2
            shakes+=1 if pbRandom(65536)<y && shakes==3
          end
        end
 

Ocwil

Rookie
Member
Joined
Nov 16, 2021
Posts
2
Age
29
I cleaner and simpler approach would be to do the following

ModifyCatchRate poison check:
BallHandlers::ModifyCatchRate.add(:POISONCRYSTAL,proc{|ball,catchRate,battle,battler|
a=battler.totalhp*3
b=battler.hp*2
catchRate= ((a*255.0) / (a-b)).ceil if battler.pbHasType?(:POISON)
next catchRate
})
 
Top