Jump to content

Help? Trying to catch trainers' pokemon in Reborn and Rejuvenation


Recommended Posts

Let me start by fully owning that I am a noob. I'm a fast learner with tech when I have a need to learn something, but I have never had any need to code anything before in my life. So I fully realize I'm almost certainly having an 1d10t error. 


That said, I've been following two guides that I've linked at the bottom, but I keep getting syntax errors which cause the game to not open.

 

I have a folder with pokemon essentials, copied over the reborn or rejuv data, replacing some of the generic files in the process. Replaced PE PBS for the correct PBS. Altered some of the balls in the PBS to be snagballs, and then went to change the scripts. 

 

I try changing "if @opponent && (!pbIsSnagBall?(ball) || !battler.isShadow?)" to "if @opponent && (!pbIsSnagBall?(ball)" That in itself causes a syntax error for both reborn and rejuv. I try editing the rest of the lines suggested in the pokecommunity tutorial. Still doesn't work. I try removing the extra lines that are between the various lines of the pokecommunity tutorial, still no dice. 

 

Here's the original code that I think I'm supposed to be editing. Any ideas? What other data might you need from me? Thanks in advance guys.

 

if @opponent && (!pbIsSnagBall?(ball) || !battler.isShadow?)
      @scene.pbThrowAndDeflect(ball,1)
      if $game_switches[290]==false 
        pbDisplay(_INTL("The Trainer blocked the Ball!\nDon't be a thief!"))
      else
        pbDisplay(_INTL("The Pokémon knocked the ball away!"))
      end
    else
      if $game_switches[290]==true
        pbDisplay(_INTL("The Pokémon knocked the ball away!"))
        return
      end
      pokemon=battler.pokemon
      species=pokemon.species
      if $DEBUG && Input.press?(Input::CTRL)
        shakes=4

 

https://www.pokecommunity.com/showthread.php?t=357057

 

 

Link to comment
Share on other sites

7 hours ago, Mindlack said:

I’m not sure, but it looks like your error is about parentheses. If I’m not mistaken, it should be “if @opponent && (!pbIsSnagBall?(ball))” or “if @opponent && !pbIsSnagBall?(ball)”. 

This worked in fixing the syntax error. Thanks! Unfortunately, the opponent is still able to knock the ball away. I'm assuming it's to do the the few lines of code right after that mention knocking the ball away. I tried replacing the lines after if @opponent && (!pbIsSnagBall?(ball)) with a copy of some of the code for catching pokemon, but that made the game throw the ball and then ignore it. I tried replacing it with a copy of all the ball throwing text, and then I got another syntax error.  Here's the code for ball throwing/catching pokemon if it's any use. 

 

@scene.pbThrow(ball,(critical) ? 1 : shakes,critical,critsuccess,battler.index,showplayer)
      
      case shakes
      when 0
        pbDisplay(_INTL("Oh no! The Pokémon broke free!"))
        BallHandlers.onFailCatch(ball,self,pokemon)
      when 1
        pbDisplay(_INTL("Aww... It appeared to be caught!"))
        BallHandlers.onFailCatch(ball,self,pokemon)
      when 2
        pbDisplay(_INTL("Aargh! Almost had it!"))
        BallHandlers.onFailCatch(ball,self,pokemon)
      when 3
        pbDisplay(_INTL("Shoot! It was so close, too!"))
        BallHandlers.onFailCatch(ball,self,pokemon)
      when 4
        pbDisplayBrief(_INTL("Gotcha! {1} was caught!",pokemon.name))
#        @scene.pbThrowSuccess
        if pbIsSnagBall?(ball) && @opponent
          pbRemoveFromParty(battler.index,battler.pokemonIndex)
          battler.pbReset
          battler.participants=[]
        else
          @decision=4
        end
        if pbIsSnagBall?(ball)
          pokemon.ot=self.pbPlayer.name
          pokemon.trainerID=self.pbPlayer.id
        end
        BallHandlers.onCatch(ball,self,pokemon)
        pokemon.ballused=pbGetBallType(ball)
        pokemon.pbRecordFirstMoves
        if !self.pbPlayer.owned[species]
          self.pbPlayer.owned[species]=true
          if $Trainer.pokedex
            pbDisplayPaused(_INTL("{1}'s data was added to the Pokédex.",pokemon.name))
            @scene.pbShowPokedex(species)
          end
        end
        @scene.pbHideCaptureBall
        if pbIsSnagBall?(ball) && @opponent
          pokemon.pbUpdateShadowMoves rescue nil
          @snaggedpokemon.push(pokemon)
        else
          pbStorePokemon(pokemon)

Link to comment
Share on other sites

16 hours ago, TrekkieGamer359 said:

This worked in fixing the syntax error.

 

Yeah, that was the point. If you've never done any before, code is really something meticulous and the slightest typo can make a program bug in interesting ways (see cass's dev blog posts on engine and AI -- I have my own stories but they're beginner level compared to what the dev team does). You got a syntax error for mismatching your parentheses, and thus you should double-check that for the other syntax error you got (when "replacing [the lines after "if @opponent && (!pbIsSnagBall?(ball))"] with a copy of some of the code for catching Pokemon", for instance). 

 

Other than that I'm afraid it's just too vague (and I don't know anything specific enough about that type of programming) to offer advice I'm sure about. 

Here are some thoughts, though I do not know if they are relevant:

 

1) Did you do the other steps previously outlined in the (first) tutorial (ie make a snag machine event and make some Pokeballs snag balls)? 

 

2) You should try and make sure to see which way the code gets into. So you should, each time you can (every time there's an "if" statement), make the game display (with, I presume, something like "pbDisplay(_INTL("Red five, standing by"))") a random message different each time. Try and display the values of the different relevant booleans, such as for instance:

if pbIsSnagBall?(ball)

  pbDisplay(_INTL("You're a wizard, Harry"))

else

  pbDisplay(_INTL("Oft evil will shall evil mar"))

end

This way you should have a better idea of what the code does and why. That's the most rudimentary debugging method, but it works pretty well when the project isn't too big and you don't want to learn something more advanced (which is my case, for instance). 

 

3) Make sure the game is running on the modified scripts! If none of your "fancy" messages from 2 show up, it might indicate that the game still uses the old scripts for whatever reason and in this case I'm not sure (well, even less sure) I'll be able to help you.  

 

 

Note that according to the second guide (the video), after the "shakes=4" part, you should have an "else" and then a bunch of code with formulas looking like you want to capture a pokemon (you don't need to know the entire formula, but if there is not something like "3*max hp-2*current hp" in the following 20-ish lines something may be not quite right).  

 

 

 

Link to comment
Share on other sites

11 hours ago, Mindlack said:

1) Did you do the other steps previously outlined in the (first) tutorial (ie make a snag machine event and make some Pokeballs snag balls)? 

 I got it working in Rejuv. Thanks. Another case of an 1D10T error. It was late at night when I was trying it in Rejuv because I was too lazy to put in a snag machine, and Rejuv gives you one, right? Guess which part of the game I tried it in? Yep. The one part with a broken snag machine... Anyways. Now that I've actually decided to use my brain it's working in Rejuv and I should have it up and running in Reborn quickly. All that's needed is the one edited line for anyone who's interested. You just need to make sure you ACTUALLY have a snag machine, not just assume you do like I did. *facepalm* Anyways, thanks for your help. I'm off to become a thief. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...