• 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.

Pokeballs after battle - Like in LGPE

#Not Important

All hail the wishmaker
910
Posts
4
Years
  • Makes trainers give you pokeballs after you beat them...
    Short script

    Make sure that any trainer you want to give balls out has pbTrainerEnd at the end of its event

    Code:
    #-------------------------------------------------------------------------------
    #     Pokeballs after battle script by #NI
    #
    #     No need to credit
    #
    #-------------------------------------------------------------------------------
    ACTIVE = true #if the script is active...
    #-------------------------------------------------------------------------------
    #                                  </>
    module InterpreterFieldMixin
      def pbTrainerEnd
        pbGlobalUnlock
        e = get_character(0)
        e.erase_route if e
        if ACTIVE
          amt = rand(3)
          Kernel.pbItemBall(:POKEBALL,amt)
        end
      end
    end
     
    Last edited:

    #Not Important

    All hail the wishmaker
    910
    Posts
    4
    Years
  • Just those?
    Change Kernel.pbItemBall... to Kernel.pbItemBall(rand([:POKEBALL,:GREATBALL,:ULTRABALL]),amt)
     
    62
    Posts
    6
    Years
    • Seen Aug 11, 2022
    Hello!

    Is it normal that I get the pokéballs even when the player has lost the battle?

    How could I change that?
     
    163
    Posts
    7
    Years
    • Seen May 3, 2024
    Hi! Nice work!

    A question...

    How i can reduce the chances that a trainer gives you a ball...
    Like, the 20% of the trainers that you defeat...

    Thank you so much!
     

    #Not Important

    All hail the wishmaker
    910
    Posts
    4
    Years
  • Change to this:
    Code:
    CHANCE = 20 #The chance that the player will get the pokéballs (/100)
    module InterpreterFieldMixin
      def pbTrainerEnd
        pbGlobalUnlock
        e = get_character(0)
        e.erase_route if e
        if ACTIVE
          chance = rand(10)
          schance = (CHANCE/10).floor
          amt = rand(3)
          Kernel.pbItemBall(:POKEBALL,amt) if chance<=schance
        end
      end
    end
     
    62
    Posts
    6
    Years
    • Seen Aug 11, 2022
    Hello
    I have already asked the question but no one has answered.
    Is it possible that the player does not win Pokéball when he loses the battle?
    And, is it possible to create an exception for certain trainer classes such as Rival or Gyms Leaders ?

    Tanks!
     
    163
    Posts
    7
    Years
    • Seen May 3, 2024
    Change to this:
    Code:
    CHANCE = 20 #The chance that the player will get the pokéballs (/100)
    module InterpreterFieldMixin
      def pbTrainerEnd
        pbGlobalUnlock
        e = get_character(0)
        e.erase_route if e
        if ACTIVE
          chance = rand(10)
          schance = (CHANCE/10).floor
          amt = rand(3)
          Kernel.pbItemBall(:POKEBALL,amt) if chance<=schance
        end
      end
    end

    Thank you so much :D
     
    Back
    Top