• 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.

Allowing wild encounters with an empty party

129
Posts
14
Years
  • Age 24
  • Seen Sep 4, 2023
Hello everyone,

Does anyone knows where in the scripts can I find the part where it prevents you from having an encounter if you have no pokemon with you? How would I go to relax this condition if a certain switch was on?

Thank you in advance!

Giu
 
64
Posts
10
Years
  • Age 36
  • Seen May 29, 2020
If I remember correctly, there is a definition called 'pbOnStepTaken' or something probably in PokemonField. I recon that's where you will find your answer. Let me know if you can find it, because I've seen this part of the script somewhere and I might be able to have a look for you.
 

Nickalooose

--------------------
1,309
Posts
16
Years
  • Seen Dec 28, 2023
Dexter is right, almost.
Code:
def pbBattleOnStepTaken
  if $Trainer.party.length > 0
    encounterType=$PokemonEncounters.pbEncounterType
    if encounterType>=0
      encounter=$PokemonEncounters.pbGenerateEncounter(encounterType)
      if $PokemonEncounters.isEncounterPossibleHere?()
        encounter=EncounterModifier.trigger(encounter)
        if $PokemonEncounters.pbCanEncounter?(encounter)
          if $PokemonGlobal.partner
            encounter2=$PokemonEncounters.pbEncounteredPokemon(encounterType)
            pbDoubleWildBattle(encounter[0],encounter[1],encounter2[0],encounter2[1])
          else
            pbWildBattle(encounter[0],encounter[1])
          end
        end
        EncounterModifier.triggerEncounterEnd()
      end
    end
  end
end
In PokemonField.
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
That's definitely not the only thing you'd need to play with in order to actually make the battle work. A Pokémon battle very much depends on the player having a Pokémon they can use, and if you don't, there's going to be so many bits of code which don't work. I can't imagine what you want to do with such a feature will be worth the effort of making it work.

The "easiest" solution is to turn such wild battles into Safari Zone battles, but then you'll run into different issues relating to how Safari Zone battles trigger, occur and appear (e.g. Safari Zone battles are hardcoded to use Safari Balls). Not as many issues as above, but they'd still need to be resolved.

It may be easier to just turn your starter selection process into a mini-Safari Zone itself, rather than trying to take some aspects from it or make something new.
 
129
Posts
14
Years
  • Age 24
  • Seen Sep 4, 2023
That's definitely not the only thing you'd need to play with in order to actually make the battle work. A Pokémon battle very much depends on the player having a Pokémon they can use, and if you don't, there's going to be so many bits of code which don't work. I can't imagine what you want to do with such a feature will be worth the effort of making it work.

The "easiest" solution is to turn such wild battles into Safari Zone battles, but then you'll run into different issues relating to how Safari Zone battles trigger, occur and appear (e.g. Safari Zone battles are hardcoded to use Safari Balls). Not as many issues as above, but they'd still need to be resolved.

It may be easier to just turn your starter selection process into a mini-Safari Zone itself, rather than trying to take some aspects from it or make something new.

I think Nickalooose's part of the code is what I'm looking for.
Maruno, that's exactly what I'm trying to do. The problem is that Safari Zone Battles doesn't trigger unless you have at least one pokemon.
Thank you all for your help!
 

Nickalooose

--------------------
1,309
Posts
16
Years
  • Seen Dec 28, 2023
In the past I started a battle with 0 Pokémon, script, was meant to be used for the "old man" skit, I'm pretty sure I gave Maruno the scripts I used... But it works anyway... Why do you want such a battle?
 
129
Posts
14
Years
  • Age 24
  • Seen Sep 4, 2023
My plan was to make a little Safari Game before you receive a pokemon.
 

Nickalooose

--------------------
1,309
Posts
16
Years
  • Seen Dec 28, 2023
So, is that how you catch your starter?
Because with this information, we can help a lot more, since I don't know about Maruno, but I thought you just wanted your player to get ambushed and beat up lol.
 

Maruno

Lead Dev of Pokémon Essentials
5,285
Posts
16
Years
I'd already guessed he wanted a Safari area for catching a starter in, and I've mentioned a few things he'll need to consider.
 
1
Posts
10
Years
  • Age 64
  • Seen Sep 30, 2013
So is there a way to end a safari game after one pokemon has been catched, or reduce the balls amount to 1 while increasing their catch rate to 100%? I'm interested in this as well, at the moment I'm trying to produce a script checking for your party members, then removing all your steps left after you got your first pokemon...
 

Nickalooose

--------------------
1,309
Posts
16
Years
  • Seen Dec 28, 2023
Modifying the capture rate is easiest and is located in PokemonBalls;
Code:
BallHandlers::ModifyCatchRate.add(:SAFARIBALL,proc{|ball,catchRate,battle,battler|
   next (catchRate*3/2).floor
})
Make it look something like
Code:
BallHandlers::ModifyCatchRate.add(:SAFARIBALL,proc{|ball,catchRate,battle,battler|
   catchRate=(catchRate*3/2).floor
   catchRate=255 if $game_switches[[COLOR="red"]x[/COLOR]]
   next catchRate
})
This should make your SafariBall catch any Pokémon, providing you turn switch X, on... X is the switch number you set it as.

Ending the "safari game" in PokeBattle_Battle would be easiest, around line 210, make the if pbIsSnagBall?, part, look like this:
Code:
          if pbIsSnagBall?(ball) && @opponent
            pokemon.pbUpdateShadowMoves rescue nil
            @snaggedpokemon.push(pokemon)
          else
            pbStorePokemon(pokemon)
            pbSafariState.decision=1 if $game_switches[[COLOR="red"]x[/COLOR]]
          end
Again, X, is the same switch as you set earlier... This is untested.
 
Back
Top