• 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] Helping with typing ball

  • 87
    Posts
    5
    Years
    Hi, I know it doesn't make much sense, but I want to insert that pokeball into my game; what I would like to do is make the pokeball have a 100% capture rate only if the pokemon name is spelled correctly.

    I'm doing this because I want to make a safri zone like where the pokemon have the name censored.

    Can you help me?

    p.s.: I'm using the 17.2
     
    What part of this are you struggling with? Do you know how to adjust the capture rate if some condition is true? If not, look at something like Net Ball. Do you know how to get the name of the Pokémon? Do you know how to get the name of its species? Do you know how to compare things?
     
    So the theory of this would be.
    You get the wild pokemon's name with PBSpecies
    Then you would have to have the player type out the name.
    This gives you two strings, the real name and the name the player gave you.

    This then goes one of two ways.

    If you want to make the capture rate vary on how close the player got, then - Really Hard
    Then you are going to have to learn how to do string manipulation to figure out the length of the species name and then running it through a loop compare correct letters and their positions to figure out a capture rate.

    However if you want to take the much easier route and have the ball have a 0% capture rate and only 100% if the name is correct then. - Easy...er
    playerinput == PBSpecies.getName(), then this is easier because it's one check compared to doing string maths.

    Let us just start simple and make a new ball type in PItem_PokeBalls
    You want to start with finding $BallTypes and adding the ball to the list with the others. (You also need to create the ball as an actual Item in PBS item.txt you can copy another pokeball and renumber, name and flavor text it.)

    Next comes defining the ball handler...
    Spoiler:


    Actually we don't have to do any maths for the implementation.
    After the last ballhandler in PItem_PokeBalls

    Code:
    BallHandlers::ModifyCatchRate.add(:#REPLACEWITHBALL#,proc{|ball,catchRate,battle,battler|
       next (catchRate=0).floor
    })

    What we have here is a ball with a 0 catchRate, good luck catching anything with this.

    If we wanted to make the ball like a masterball or 100% catch rate you would change
    Code:
    next (catchRate=0).floor
    to
    Code:
    next (catchRate=256).floor
    In Essentials 17 the way an instant catch is caculated is if the ball is 'isUnconditional' or x>255 (x is a number calculated on some things.)
     
    Back
    Top