• 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!
  • Which Pokémon Masters protagonist do you like most? Let us know by casting a vote in our Masters favorite protagonist poll here!
  • Red, Hilda, Paxton, or Kellyn - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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 allow player to jump up ledges + steal Pokemon from other Trainers if outfit is set to 1 [v18.1]

  • 40
    Posts
    4
    Years
    • Seen Jan 13, 2022
    I am planning a game where the player joins Team Rocket and obtains a uniform for the team, setting their outfit to 1.
    I want to make two things only accessible to this outfit: stealing Pokemon from NPC Trainers, and jumping up ledges that you normally can only jump down.
    Any help is appreciated, and I think I am already slowly figuring out the theft aspect. I will provide the code I have for the theft aspect so far, and you can point out what I did wrong.

    Code:
    if trainerBattle? && !pbIsSnagBall?(ball)
          @scene.pbThrowAndDeflect(ball,1)
          pbDisplay(_INTL("The Trainer blocked your Poké Ball! Don't be a thief!"))
          return
        end
        if trainerBattle? && (pbIsSnagBall?(ball) && $Trainer.outfit=1)
          idxTarget = idxBattler
          idxBattler = idxBattler.index if idxBattler.respond_to?("index")
          pkmn = battler.pokemon
          @criticalCapture = false
          numShakes = pbCaptureCalc(pkmn,battler,rareness,ball)
          PBDebug.log("[Threw Poké Ball] #{itemName}, #{numShakes} shakes (4=capture)")
          return
        end

    NOTE: It is all positioned correctly in the scripts.
     
    Last edited:
    I am planning a game where the player joins Team Rocket and obtains a uniform for the team, setting their outfit to 1.
    I want to make two things only accessible to this outfit: stealing Pokemon from NPC Trainers, and jumping up ledges that you normally can only jump down.
    Any help is appreciated, and I think I am already slowly figuring out the theft aspect. I will provide the code I have for the theft aspect so far, and you can point out what I did wrong.

    Code:
    if trainerBattle? && !pbIsSnagBall?(ball)
          @scene.pbThrowAndDeflect(ball,1)
          pbDisplay(_INTL("The Trainer blocked your Poké Ball! Don't be a thief!"))
          return
        end
        if trainerBattle? && (pbIsSnagBall?(ball) && $Trainer.outfit=1)
          idxTarget = idxBattler
          idxBattler = idxBattler.index if idxBattler.respond_to?("index")
          pkmn = battler.pokemon
          @criticalCapture = false
          numShakes = pbCaptureCalc(pkmn,battler,rareness,ball)
          PBDebug.log("[Threw Poké Ball] #{itemName}, #{numShakes} shakes (4=capture)")
          return
        end

    NOTE: It is all positioned correctly in the scripts.

    looking at your code, both conditions would return true, and that might be a problem. try this instead:
    Code:
        if trainerBattle? && !pbIsSnagBall?(ball)
         if $Trainer.outfit==1
          idxTarget = idxBattler
          idxBattler = idxBattler.index if idxBattler.respond_to?("index")
          pkmn = battler.pokemon
          @criticalCapture = false
          numShakes = pbCaptureCalc(pkmn,battler,rareness,ball)
          PBDebug.log("[Threw Poké Ball] #{itemName}, #{numShakes} shakes (4=capture)")
          return
         else
          @scene.pbThrowAndDeflect(ball,1)
          pbDisplay(_INTL("The Trainer blocked your Poké Ball! Don't be a thief!"))
          return
         end
        end
     
    looking at your code, both conditions would return true, and that might be a problem. try this instead:
    Code:
        if trainerBattle? && !pbIsSnagBall?(ball)
         if $Trainer.outfit==1
          idxTarget = idxBattler
          idxBattler = idxBattler.index if idxBattler.respond_to?("index")
          pkmn = battler.pokemon
          @criticalCapture = false
          numShakes = pbCaptureCalc(pkmn,battler,rareness,ball)
          PBDebug.log("[Threw Poké Ball] #{itemName}, #{numShakes} shakes (4=capture)")
          return
         else
          @scene.pbThrowAndDeflect(ball,1)
          pbDisplay(_INTL("The Trainer blocked your Poké Ball! Don't be a thief!"))
          return
         end
        end

    Thanks, the corrected code works out.
     
    Back
    Top