• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • 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

  • 115
    Posts
    15
    Years
    • 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
     
    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.
     
    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.
     
    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.
     
    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!
     
    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?
     
    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.
     
    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...
     
    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