• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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] Catching Opponent's Pokemon?

30
Posts
10
Years
    • Seen Apr 9, 2023
    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 not 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'

    Happened specifically after I "stole" one pokemon from the trainer Madelis, beat her second pokemon, then stole her third. The error occurred, but didn't stop me from continuing playing, however the pokemon doesn't go away and I'm left fighting the Ball that was left after catching it.

    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.
     
    Last edited:
    1,682
    Posts
    8
    Years
    • Seen today
    Are you using v16.2?
    If you are, you must have modified something, because your line numbers don't match.
    This issue is not in a clean v16.2, but it also does not allow you to catch regular pokemon (ie. not shadow) unless you change line 60 in PokeBattle_Battle from:
    Code:
        if @opponent && (!pbIsSnagBall?(ball) || !battler.isShadow?)
    to:
    Code:
        if @opponent && !pbIsSnagBall?(ball)

    What version are you using?
     
    30
    Posts
    10
    Years
    • Seen Apr 9, 2023
    Oh really, this is fixed in 16.2?
    I was concerned with doing that because the game I am currently editing to play this way was made before that update.

    But yes, I did change that code prior to doing this already. Sorry, I should have cleared that up.
    So you are saying that if I update to the latest version this problem will not happen 100 percent?
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    That particular error will definitely not occur in v16.2. I can't guarantee that the whole concept will work 100%, of course, because I haven't done much testing and neither has anyone else. It should still work better than what you currently have.

    If you update your game properly, that is. Many people can't, and I can only surmise it's because they can't read or follow instructions.
     
    30
    Posts
    10
    Years
    • Seen Apr 9, 2023
    Haha ya, I don't think I WOULD be able to update this, would I?
    I read through the instructions but its not my game. I don't know what to change in order to make it work with the project I am trying to edit.
    I added those files in the 16.2 download to replace the old ones (to constitute the update) and obviously things aren't working properly. After doing it, I can't even throw the master ball at the pokemon, it tries to use it on my own team lol!

    Any other things I may have missed to be able to update properly, or a way to work around this in what I assume is 16.0?
     
    38
    Posts
    8
    Years
    • Seen Nov 26, 2023
    Probably because after you update to 16.2 it overwrite your scripts data, so, every modification that you do before was lost.

    Probably you'll need to do the same process again ;)
     
    30
    Posts
    10
    Years
    • Seen Apr 9, 2023
    Probably because after you update to 16.2 it overwrite your scripts data, so, every modification that you do before was lost.

    Probably you'll need to do the same process again ;)

    Right, which I can't do because I didn't make the game I'd be updating so I don't know what would need to be changed.
    Oh well, I suppose I'll just have to suffer through the bugs if there is no way to fix it in the version the game is currently using.
     
    55
    Posts
    10
    Years
    • Seen Oct 8, 2019
    I was using Pokemon Essentials v15 when I created a Pokeball that catches the opponents Pokemon.
    It was fine with v.16 and v16.2 as well. It is quite easy and when you just updated the game and didn't do any changes follow these steps:
    1. create the item in your item.txt (pbs files)
    Code:
    528,SNAGBALL,Rocket Ball,Rocket Balls,3,10000,A dark ball that even catches Trainer's Pokémon,0,2,3,
    2. Add the right pictures in your icon-folder
    3. Go to the script section: "PITEM_Pokeballs"
    Around line 76 you can find the line:
    Code:
       23=>:SPORTBALL
    Change to:
    Code:
       23=>:SPORTBALL,
    (Add a comma after)
    After add:
    Code:
       24=>:SNAGBALL
    Search for "snagball" and replace the function with:
    Code:
    BallHandlers::ModifyCatchRate.add(:SNAGBALL,proc{|ball,catchRate,battle,battler|
       next (catchRate*3/2).floor
    })
    Done...It has the catchrate of a Greatball now.
     
    Back
    Top