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

Pokeballs after battle - Like in LGPE

#Not Important

All hail the wishmaker
  • 910
    Posts
    5
    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:
    Hello!

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

    How could I change that?
     
    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!
     
    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
     
    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!
     
    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