Advertiser Content

Scripting Question Helping with typing ball

Started by ShinyObstagoon88 December 8th, 2019 2:43 AM
  • 635 views
  • 4 replies

ShinyObstagoon88

Male
Italy
Seen 13 Hours Ago
Posted 13 Hours Ago
55 posts
159 Days
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

Sir_Tman

Overworked game Dev

Non-binary
Australia
Seen December 10th, 2019
Posted December 9th, 2019
201 posts
4.6 Years
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

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
next (catchRate=0).floor
to
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.)
Advertiser Content