• 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] Storing opposing trainer's pkmn (17.2)

132
Posts
9
Years
  • I know I made this same request a while back, but since updating to Essentials 17.2, I've lost compatibility with some custom scripts. This script, made by tustin2121, is used to store off the opposing trainer's pokemon so that the player can then take them. Here is the main part of the script that is especially giving me trouble:
    Code:
    def pbSavePokemon
    if $PokemonTemp.lastTrainerPokemon && !pbBoxesFull?
    pbFadeOutIn(99999){
      #Open a party selection screen, with the opponent's party
      scene=PokemonScreen_Scene.new
      screen=PokemonScreen.new(scene,$PokemonTemp.lastTrainerPokemon)
      screen.pbStartScene(_INTL("Which Pok?mon would you like?"),false)
      loop do
        scene.pbSetHelpText(_INTL("Which Pok?mon would you like?"))
        chosen=screen.pbChoosePokemon
        if chosen>=0
          pokemon=$PokemonTemp.lastTrainerPokemon[chosen]
          if scene.pbDisplayConfirm(_INTL("Take {0}?", pokemon.name))
            # Add the foreign pokemon
            $Trainer.seen[pokemon.species]=true #Add to Pokedex
            $Trainer.owned[pokemon.species]=true
            pbStorePokemon(pokemon) #stores pokemon in party or boxes, if there's room
            break;
          end
        else
          #The player cancelled the selection
          break if scene.pbDisplayConfirm(_INTL("Decide against taking a Pok?mon?"))
        end
      end
      $PokemonTemp.lastTrainerPokemon=nil #clear out the stored party
      screen.pbEndScene
    }
    else
      #Either the player can't store any more pokemon, or the last opponent's party wasn't stored off properly.
      Kernel.pbMessage(_INTL("Can't select a Pok?mon!"))
    end
    end
    I think something's up with the scene=PokemonScreen_Scene.new and screen=PokemonScreen.new. Maybe it's a compatibility issue, or maybe something else. Here's the error log:

    Thanks!
     

    Ego13

    hollow_ego
    311
    Posts
    6
    Years
  • Some of the classes and script sections were renamed in Essentials v17.2 and this is one of them. I think the class referenced here is now
    Code:
    PokemonParty_Scene
    instead of
    Code:
    PokemonScreen_Scene

    and
    Code:
    PokemonPartyScreen
    instead of
    Code:
    PokemonScreen
     
    132
    Posts
    9
    Years
  • Thanks! After further futzing I got it to work. These new updates are proving to be pretty destructive towards a four-year-old game, but I'll manage :p
     
    Back
    Top