- 32
- Posts
- 9
- Years
- Seen Aug 16, 2016
as i'm a bit nerdy, it somehow bothered me, that a pokemon hatches from an egg and already has a pokeball. so i changed the hatching script so that it only hatches when you have pokeballs with you, and one of them gets deleted then and it works fine.
now i'd like to make it possible that other balls could be used as well, like if you don't have pokeballs but great balls instead, it would work too.
here's what i've got so far, it's at the end of the hatching script section:
now is there an elegant way to include other balls other than adding an || for every other ball type after the highlighted part?
i think the new update would change the balltype afterwards to the mother's balltype anyways (maybe i'll take that out then), but it's illogical that you can only use one kind of balls on your newly hatched pokemon and always have to carry that one kind with you...
EDIT: okay, i found a bug and if for some reason someone would like to implement this too, here's the fixed code:
and in the day care script there was also something missing, i don't know why the change in the inheriting ball script wasn't enough:
now i'd like to make it possible that other balls could be used as well, like if you don't have pokeballs but great balls instead, it would work too.
here's what i've got so far, it's at the end of the hatching script section:
Spoiler:
Events.onStepTaken+=proc {|sender,e|
next if !$Trainer
for egg in $Trainer.party
if egg.eggsteps>0
egg.eggsteps-=1
for i in $Trainer.party
if !i.egg? && (isConst?(i.ability,PBAbilities,:FLAMEBODY) ||
isConst?(i.ability,PBAbilities,:MAGMAARMOR))
egg.eggsteps-=1
break
end
end
if egg.eggsteps<=0 && $PokemonBag.pbQuantity[S-HIGHLIGHT](getConst(PBItems,:POKEBALL)[/S-HIGHLIGHT])>0
egg.eggsteps=0
pbHatch(egg)
$PokemonBag.pbDeleteItem[S-HIGHLIGHT](getConst(PBItems,:POKEBALL)[/S-HIGHLIGHT])
else egg.eggsteps=1
end
end
end
}
next if !$Trainer
for egg in $Trainer.party
if egg.eggsteps>0
egg.eggsteps-=1
for i in $Trainer.party
if !i.egg? && (isConst?(i.ability,PBAbilities,:FLAMEBODY) ||
isConst?(i.ability,PBAbilities,:MAGMAARMOR))
egg.eggsteps-=1
break
end
end
if egg.eggsteps<=0 && $PokemonBag.pbQuantity[S-HIGHLIGHT](getConst(PBItems,:POKEBALL)[/S-HIGHLIGHT])>0
egg.eggsteps=0
pbHatch(egg)
$PokemonBag.pbDeleteItem[S-HIGHLIGHT](getConst(PBItems,:POKEBALL)[/S-HIGHLIGHT])
else egg.eggsteps=1
end
end
end
}
now is there an elegant way to include other balls other than adding an || for every other ball type after the highlighted part?
i think the new update would change the balltype afterwards to the mother's balltype anyways (maybe i'll take that out then), but it's illogical that you can only use one kind of balls on your newly hatched pokemon and always have to carry that one kind with you...
EDIT: okay, i found a bug and if for some reason someone would like to implement this too, here's the fixed code:
Code:
Events.onStepTaken+=proc {|sender,e|
next if !$Trainer
for egg in $Trainer.party
if egg.eggsteps>0
egg.eggsteps-=1
for i in $Trainer.party
if !i.egg? && (isConst?(i.ability,PBAbilities,:FLAMEBODY) ||
isConst?(i.ability,PBAbilities,:MAGMAARMOR))
egg.eggsteps-=1
break
end
end
ball=newGetBall
[S-HIGHLIGHT] if egg.eggsteps<=0
if ball>0
egg.eggsteps=0
pbHatch(egg)
$PokemonBag.pbDeleteItem(ball)
else egg.eggsteps=1
break
end[/S-HIGHLIGHT]
end
end
end
}
Code:
def pbHatch(pokemon)
speciesname=PBSpecies.getName(pokemon.species)
pokemon.name=speciesname
pokemon.trainerID=$Trainer.id
pokemon.ot=$Trainer.name
pokemon.happiness=120
pokemon.timeEggHatched=pbGetTimeNow
pokemon.obtainMode=1 # hatched from egg
pokemon.hatchedMap=$game_map.map_id
[S-HIGHLIGHT] ball=newGetBall
pokemon.ballused=pbGetBallType(ball)[/S-HIGHLIGHT]
$Trainer.seen[pokemon.species]=true
$Trainer.owned[pokemon.species]=true
pbSeenForm(pokemon)
if !pbHatchAnimation(pokemon)
Kernel.pbMessage(_INTL("Huh?\1"))
Kernel.pbMessage(_INTL("...\1"))
Kernel.pbMessage(_INTL("... .... .....\1"))
Kernel.pbMessage(_INTL("{1} hatched from the Egg!",speciesname))
if Kernel.pbConfirmMessage(_INTL("Would you like to nickname the newly hatched {1}?",speciesname))
species=PBSpecies.getName(pokemon.species)
nickname=pbEnterPokemonName(_INTL("{1}'s nickname?",speciesname),0,10,"",pokemon)
pokemon.name=nickname if nickname!=""
end
end
end
Last edited: