Age 30
Male
Toronto, Canada
Seen April 16th, 2015
Posted June 15th, 2013
9 posts
8.8 Years
Hey guys, I wanted to ask how to place the Player's party Pokémon in a temporary location. I have a situation where the player must select a Pokémon from a predetermined set, and battle with one of them rather than the Player's party.

Here's what I've figured out so far:

First I looked into the Bug Catching Contest to see what happens there.

Spoiler:
chosenpkmn=$Trainer.party[@chosenPokemon]
    for i in 0...$Trainer.party.length
      if [email protected]
        @otherparty.push($Trainer.party[i])
      end
    end

...

    $Trainer.party=[chosenpkmn]

...

    for poke in @otherparty
      $Trainer.party.push(poke)
    end


So, first it pushes the player's other party Pokemon into a separate array, and sets the player's party to just the one they selected. It then adds them back at the end of the contest.

I then checked out the wiki and found that there's a handy script that adds a pokemon to the party.

Spoiler:
pbAddToPartySilent(PBSpecies::species,level)


Looks like that will do the trick.

Now, even with all this knowledge, I still have no idea what I'm doing. I tried making a simple event that calls a script that, like the Bug Catching Contest, adds the player's current party to a temporary array, then adds the selected Pokemon.

Script:
Spoiler:
def pbStorePokemon(variable)
  @otherparty=[]
    for i in 0...$Trainer.party.length
      @otherparty.push($Trainer.party[i])
    end
end


Event Page 1:
Spoiler:
@>Text: Choose a Pokemon. I'll hold the rest.
@>Script:pbStorePokemon(1)
@>Show Choices: Mew, Mewtwo
  : When [Mew]
   @>Conditional Branch: Script: pbAddToParty(PBSpecies::MEW,50)
      @>Text: Excellent.
      @>
   :  Else
      @>
   :  Branch End
  @>
  : When [Mewtwo]
   @>Conditional Branch: Script: pbAddToParty(PBSpecies::MEWTWO,50)
      @>Text: Excellent.
      @>
   :  Else
      @>
   :  Branch End
   @>
 :  Branch End
@>


Of course, it doesn't work, and I get NoMethod errors when I view the party or take a step. I know I'm doing this completely wrong. Does anyone else have any ideas?

Sometimes the mind, for reasons we don't necessarily understand, just decides to go to the store for a quart of milk.
-Diane Frolov and Andrew Schneider

FL

Pokémon Island Creator

Male
Online now
Posted 1 Week Ago
1,875 posts
10.2 Years
Your idea is right, but you can use something like:
otherparty=$Trainer.party
pok=PokeBattle_Pokemon.new(PBSpecies::MEWTWO,70,$Trainer)
$Trainer.party=[pok]
To return your old party, just use "$Trainer.party=otherparty". Remember to input the otherparty in some class and put this in save method or when you save and load you can't load the values on otherparty.
One more tip: Look at Battle Tower script (to make this working see my fix on Bugs & Error Reporting)