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

[Scripting Question] Alternate wild encounters?

  • 72
    Posts
    6
    Years
    • Seen Jan 24, 2021
    I'm trying to create alternate wild encounters. The idea is that when a switch is activated, the game would take encounters from a different file in the PBS than
    "encounters.txt". There seemed to have been a tutorial on the Pokémon Essensials Wiki before that explained this, but I can't read it now. Does anyone know how this is done? My first guess at this looked like this


    Code:
     if $game_switches[100]
        FileLineData.file = "PBS/alternate_encounters.txt"
        File.open("PBS/alternate_encounters.txt","rb"){|f|
      else
        FileLineData.file = "PBS/encounters.txt"
        File.open("PBS/encounters.txt","rb"){|f|
      end

    But I get a syntax error that way. I also tried duplicating the section that reads "encounters.txt" and substituting "alternate_encounters.txt", and adding
    "if $game_switches[100]" to it. That method doesn't give syntax errors, but nothing happens.

    Thanks for any help in advance.
     
    You're kinda on the right track, but as you noticed you can't have |f| at the end of a line without its associated block of code, try something like:

    Code:
    if $game_switches[100]
      filename = "PBS/alternate_encounters.txt"
    else
      filename = "PBS/encounters.txt"
    end
    FileLineData.file = filename
    File.open(filename,"rb"){|f|
     
    Last edited:
    Thank you for the help, mcgriffin. The fix did stop the syntax errors. I was shown the tutorial by someone, and now have alternate encounters working.
    Thanks for the reply.
     
    Thank you for the help, mcgriffin. The fix did stop the syntax errors. I was shown the tutorial by someone, and now have alternate encounters working.
    Thanks for the reply.

    Oh, can you share to us? :D
     
    The solution I provided was one I found on an archived copy of the essentials wiki, which I was uncertain about posting publicly. But now that the new Essentials wiki is up and also links to an archived copy here and there, I figure there's less harm in posting it here.
    This is the link I shared with Arachnee: a tutorial posted by Vendily, originally for v16.2.
     
    Back
    Top