Jump to content

Fixing Bugs when Catching Opponent's Pokemon?


Recommended Posts

Hey guys, so I have no idea if this is an appropriate discussion here, but if not, I'd love to be moved to wherever it is relevant.

I recently made a post on the Essentials forum of Pokecommunity and am not getting any replies despite hundreds of views, so I was hoping the talented creators here may already have the answers I seek.

I'm going to copy and paste that message here, so thanks in advance for reading!

____

Hey guys, this time last year I decided to try to find new ways to enjoy playing my favorite Pokemon fan games.
One of the coolest ideas I came up with was a "team rocket" run where you only use stolen pokemon.
I wasn't sure it was even possible at first, but I was able to make it work by changing the ball modifier on likely the Masterball to 3 instead of 4.
I was ABLE to catch the opposing pokemon, but it was very glitchy and likely would not have been sustainable for an entire playthrough.
I'm now looking to take this idea a bit more serious and would be interested in making a whole series around this topic, and am here pleading for help.
I know almost nothing about Pokemon Essentials beyond what I have learned here, so if anyone knows anything about this topic I will be very grateful.
So TL;DR - Looking for a way to iron out bugs that may occur when I edit the Balls to be Snagballs, thus allowing me to catch opposing Pokemon.
Any details on this process would be spectacular, especially from anyone who has done this themselves.
EDIT: so after tinkering, here is the main concern I run into.
As I said, I know nothing about this, so I don't know what causes it or if there is an easy way to fix it.
---------------------------
Pokemon Rejuvenation
---------------------------
Exception: NoMethodError
Message: undefined method `pokemonIndex=' for #<PokeBattle_Battler:0x13219eb0>
PokeBattle_Battle:932:in `pbRemoveFromParty'
PokeBattle_Battle:929:in `each'
PokeBattle_Battle:929:in `pbRemoveFromParty'
PokeBattle_Battle:928:in `each'
PokeBattle_Battle:928:in `pbRemoveFromParty'
PokeBattle_Battle:201:in `pbThrowPokeBall'
PokemonItemEffects:2218
PokemonItemEffects:2217:in `call'
PBEvent:150:in `trigger'
PokemonItems:231:in `triggerUseInBattle'
Further testing: tried battling again multiple times. Every time I try to catch her Shiftry, this error happens, regardless of when it comes out and whether I stole a previous pokemon. I am successfully able to steal and keep her opening pokemon Houndoom as well as her final pokemon Zweilous.
So it must have something to do with specific pokemon?
Here is the data for the battle:

XENOPERATIVE

Madelis,1
5,HYPERPOTION
HOUNDOOM,42,,FLAMETHROWER,DARKPULSE,IRONTAIL,THUNDERFANG,,,,,,30
SKUNTANK,43,,FLAMETHROWER,TOXICSPIKES,NIGHTSLASH,THUNDERFANG,,,,,,30
SHIFTRY,42,,LEAFBLADE,XSCISSOR,ROCKSLIDE,HIDDENPOWERWAT,,,,,,30
SHARPEDO,43,,AQUAJET,NIGHTSLASH,DIVE,EARTHQUAKE,,,,,,30
ZWEILOUS,44,,CRUNCH,HEADBUTT,DRAGONRUSH,INCINERATE,,,,,,30
Nothing stands out that is different between Shiftry and Zweilous.
Further testing reveals that when this error occurs, if I just throw another ball it will actually be caught and go away, but when I did this the trainer did not send out one of its Pokemon before the battle ended. Have also had this happen more than once. Attempt to catch > Error/failure I described. Attempt to catch again > Error/Failure. Attempt to catch a third time, success. TWO pokemon are eliminated from the team (trainer only sends out 4 pokemon despite having 6.) Could this be an issue with actually SENDING OUT the pokemon, and not the one being captured?
Another error I have received:
---------------------------
Pokemon Rejuvenation
---------------------------
Exception: NoMethodError
Message: undefined method `itemInitial' for nil:NilClass
PokeBattle_Battle:3579:in `pbSymbiosisCheck'
PokeBattle_Battle:3578:in `each'
PokeBattle_Battle:3578:in `pbSymbiosisCheck'
PokeBattle_Battle:3544:in `pbAttackPhase'
PokeBattle_Battle:3277:in `pbStartBattleCore'
PokeBattle_Battle:3276:in `logonerr'
PokeBattle_Battle:3276:in `pbStartBattleCore'
PokeBattle_Battle:3264:in `loop'
PokeBattle_Battle:3285:in `pbStartBattleCore'
PokeBattle_Battle:3001:in `pbStartBattle'
Against Crawli, a gym leader. This error did not stop me from completing the battle or catching the Pokemon.
Edited by MetrololAce
Link to comment
Share on other sites

It seems like there's something missing or wrong in the "PokeBattle_Battle" or in the "PokeBattle_Battler" scripts.

I don't know what your scripts look like or if it is set up correctly but on those two script categories, try Ctrl+F and check the undefined methods ('example').

If after a few tests/adjustments and it -still- doesn't work, it might be the version of Essentials being blind at locating texts.

You could try backing up your files and test your scripts in Essentials's Test Game (or on older versions).

Link to comment
Share on other sites

Errors are like stop signs. We don't know why they're there until we see the other roads and such. These errors likely come from your script changes as catching an enemies Pokemon should read pretty much like the Shadow Pokemon code (which is probably what you should or could use). Describing your code really can't help us help you in this situation. This is all hypothetical and can't be taken into consideration but:

The first error has to do with the opponent's party as catching one of them mean they have one less Pokemon. It's trying to read it as more Pokemon than it really is (since I'm guessing it checks for the number of fainted Pokemon). The second error is an item error...which could mean a number of things for Rejuvenation. No idea what it means though. You'd have to look at the items and check all of that off.

And instead of straight up asking for help, you can sometimes find the answer you're looking for such as I did here (which took me two minutes).

Edit: Since you are needing the shadow code due to rejuv's design, you will need to make an || statement checking for when the Pokemon is not a shadow in the thread I linked

Link to comment
Share on other sites

Errors are like stop signs. We don't know why they're there until we see the other roads and such. These errors likely come from your script changes as catching an enemies Pokemon should read pretty much like the Shadow Pokemon code (which is probably what you should or could use). Describing your code really can't help us help you in this situation. This is all hypothetical and can't be taken into consideration but:

The first error has to do with the opponent's party as catching one of them mean they have one less Pokemon. It's trying to read it as more Pokemon than it really is (since I'm guessing it checks for the number of fainted Pokemon). The second error is an item error...which could mean a number of things for Rejuvenation. No idea what it means though. You'd have to look at the items and check all of that off.

And instead of straight up asking for help, you can sometimes find the answer you're looking for such as I did here (which took me two minutes).

Edit: Since you are needing the shadow code due to rejuv's design, you will need to make an || statement checking for when the Pokemon is not a shadow in the thread I linked

Thanks for the reply!
Just so we are clear (which I wasn't before, my bad) I have done everything in those threads. If I DIDN'T I wouldn't even be able to throw the ball.
The problem I'm having comes after I catch the pokemon (or attempt to at least.)
I should have been more specific on that, my bad.
I frankly don't know anything about coding or scripting or whatever you'd consider that, but all I have done is made the one script change from Rejuvenation's package to what was described in that thread you linked there.
Anyway, there is the PokeBattle_Battle script, the only thing I edited.
Does that help?
I really appreciate the replies either way, as it seems the actual creator of Essentials says the only way to fix it is to update to 16.2, which Jan personally told me he wont be doing any time soon.
And I wouldn't know enough about the changes to do that myself.
I was hoping there was a way to simply change a thing or two like I had in order to be able to catch them in the first place, but if that isn't possible I understand.
Link to comment
Share on other sites

To be very specific. Problem A is caused if you do not call the script I have below:

0252c2db695f6d510c5c01787732222d.png

Problem B and what should be done from my guessing it to call catching a trainer Pokemon only using Snag Balls though. So for the first part we have to remove checks for the ball being caught such as this one:

if @opponent && (!pbIsSnagBall?(ball) || !battler.isShadow?) #I think this is fixed by removing the latter half of the Or Statement

Just glancing at the code, that is all you should need to do though reborn is a bit more complicated as you'd have to even acquiring the snag machine by calling that script/item in doing so. Only issue is if you catch all of the opponents Pokemon. So you may want to add to the opponent side as part of the If statement: @opponent.party >= 1 (it's getting late so that's probably a little bit off but you get the idea. As that will prevent another glitch from happening. You will need to make sure that the script is called for above when capturing said Pokemon which is the bulk issue.

While you can look for help with coding, just copy and pasting what somebody does rarely works out in the long run. I can't promise that what I suggested will fix any of your errors, but I would have to read through all the Shadow Pokemon scripts to be able to give all the answers which I won't. Another error could be in regards to the nickname since when catching the Pokemon you wouldn't be able to nickname a shadow Pokemon.

As for the second error, I'm not sure if it has to do with a Pokemon having an item, but probably for the lack of hold item which can be fixed but you'd need to look at hold item scripts. Dunno what's causing it from your info though.

Link to comment
Share on other sites

Wow awesome! The second error is minimally invasive. It occurs, but hasn't stopped me from playing in any way.

So what do I need to do to "call" that script? I see it in the Battler script, but if its there why wouldn't this happen by default?

Thanks for all your help along the way. Very impressed you have taken the time to explain these things so thoroughly.

EDIT: Just to be clear, the part you included in the second Spoiler tag I have done a long time ago. If I didn't, I wasn't able to even throw the ball.

The line now reads:

if @opponent && !pbIsSnagBall?(ball)

Edited by MetrololAce
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...