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

[Scripting Question] How to define "user", "target" and others for a capture system.

  • 107
    Posts
    4
    Years
    • Seen Apr 27, 2023
    I'm working on a new capture script, but I'm extremely new to Ruby and I'm having some difficulties.

    Basically, the idea is that after the third attempt to use Pokeball there are chances for the Pokemon to run away.
    But, if the user Pokémon has abilitys or puts the wild Pokémon under the effect of trapping moves, this chance decreases.

    In "def pbThrowPokeBall" I add a value to each Pokeball use with @turnCountBall +=1 and it worked fine.

    I believe the shift verification script should be in this method:
    def pbProcessTurn(choice,tryFlee=true)

    And yes, when doing the shift check, EVERYTHING worked, even putting the "user", "target", "move" and "hasActiveAbility?" to identify the abilitys and moves.
    Throughout the PokeBattle_Battler class these names are defined, but in def pbProcessTurn(choice,tryFlee=true) not yet, and I'm having a hard time defining this. Could someone give me a light?
    The script is as follows:
    Spoiler:


    I call pbBallCountforCatch in pbProcessTurn(choice,tryFlee=true).
    Credits are appreciated!
    Essentials v18.1
     
    Last edited:
    Back
    Top