The demo uses the function pbCreatePokemon, found in the script section --PB2-- (now called PBUtilities.)
It is defined like this:
Code:
def pbCreatePokemon
party=[3,6,9,12,15,18] # Species IDs of the Pokemon to be created
for i in 0...party.length
species=party[i]
# Generate Pokemon with species and level 20
$Trainer.party[i]=PokeBattle_Pokemon.new(species,20,$Trainer)
$Trainer.seen[species]=true # Set this species to seen and owned
$Trainer.owned[species]=true
end
end
This function, not defined in the latest release, can make it easier to add Pokemon to a party:
Code:
def pbAddPokemon(species,level)
if $Trainer.party.length==6 && $PokemonStorage.full?
Kernel.pbDisplayMessage("There's no more room for Pokemon!\1")
Kernel.pbDisplayMessage("The Pokemon Boxes are full and can't accept any more!")
return false
end
speciesname=PBSpecies.getName(species)
Kernel.pbDisplayMessage("#{$Trainer.name} obtained #{speciesname}!\1")
pokemon=PokeBattle_Pokemon.new(species,level,$Trainer)
$Trainer.seen[species]=true
$Trainer.owned[species]=true
if Kernel.pbConfirmMessage("Would you like to give a nickname to #{speciesname}?")
helptext="#{speciesname}'s nickname?"
newname=pbEnterText(helptext,0,10)
pokemon.name=newname if newname!=""
end
if $Trainer.party.length<6
$Trainer.party[$Trainer.party.length]=pokemon
else
oldcurbox=$PokemonStorage.currentBox
storedbox=$PokemonStorage.pbStoreCaught(pokemon)
curboxname=$PokemonStorage[oldcurbox].name
boxname=$PokemonStorage[storedbox].name
if storedbox!=oldcurbox
Kernel.pbDisplayMessage("Box \"#{curboxname}\" on someone's PC was full.\1")
Kernel.pbDisplayMessage("#{pokemon.name} was transferred to box \"#{boxname}.\"")
else
Kernel.pbDisplayMessage("#{pokemon.name} was transferred to someone's PC.\1")
Kernel.pbDisplayMessage("It was stored in box \"#{boxname}.\"")
end
end
return true
end