• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Encounter list UI (v19+)

Resource Encounter list UI (v19+) 1.1.0

PorousMist

Novice
Member
Joined
Aug 2, 2020
Posts
37
It's not a problem anyone has told me about before, so not common, no.
You'll have to tell me how you implemented the script/how you're trying to access the UI.
Oof, well it was because I tried to implement this script with Luka's Modular Pause Menu, and that gave me the black screen. The code for this was:

Encounter List:
#-------------------------------------------------------------------------------
#  Encounter List
#-------------------------------------------------------------------------------
ModularMenu.add_entry(:ENCOUNTERS, _INTL("Encounters"), "menuEncounter") do |menu|
  scene = EncounterList_Scene.new
  screen = EncounterList_Screen.new(scene)
  pbFadeOutIn(99999) {
    screen.pbStartScreen
  }
end
 

ThatWelshOne_

Champion
Member
Oof, well it was because I tried to implement this script with Luka's Modular Pause Menu, and that gave me the black screen. The code for this was:

Encounter List:
#-------------------------------------------------------------------------------
#  Encounter List
#-------------------------------------------------------------------------------
ModularMenu.add_entry(:ENCOUNTERS, _INTL("Encounters"), "menuEncounter") do |menu|
  scene = EncounterList_Scene.new
  screen = EncounterList_Screen.new(scene)
  pbFadeOutIn(99999) {
    screen.pbStartScreen
  }
end
I'm not entirely sure why it doesn't work the way you have it, but this works for me:
Ruby:
ModularMenu.add_entry(:ENCOUNTERS, _INTL("Encounters"), "menuEncounters") do |menu|
  pbFadeOutIn(99999) {
    scene = EncounterList_Scene.new
    screen = EncounterList_Screen.new(scene)
    screen.pbStartScreen
  }
end
 

PorousMist

Novice
Member
Joined
Aug 2, 2020
Posts
37
I'm not entirely sure why it doesn't work the way you have it, but this works for me:
Ruby:
ModularMenu.add_entry(:ENCOUNTERS, _INTL("Encounters"), "menuEncounters") do |menu|
  pbFadeOutIn(99999) {
    scene = EncounterList_Scene.new
    screen = EncounterList_Screen.new(scene)
    screen.pbStartScreen
  }
end
Your code works for me, thank you! I do not have a reason why my code does that depsite having the same functionality as yours.
 

RidgeBoy

Novice
Member
Joined
Apr 6, 2022
Posts
22
Thank you so much for this!

I saw under "Future Plans" that you might one day "Add an indicator of encounter rarity."

I'm wondering if this is till being considered? It would be really cool to have in my game(:
 

ThatWelshOne_

Champion
Member
Thank you so much for this!

I saw under "Future Plans" that you might one day "Add an indicator of encounter rarity."

I'm wondering if this is till being considered? It would be really cool to have in my game(:
It's certainly something I've been thinking about, but I'm not quite sure what the best way to show this would be. Any suggestions from yourself (or others) could give me some inspiration!
 

RidgeBoy

Novice
Member
Joined
Apr 6, 2022
Posts
22
It's certainly something I've been thinking about, but I'm not quite sure what the best way to show this would be. Any suggestions from yourself (or others) could give me some inspiration!
Idk exactly how to create stuff like this, so I'm not very sure about the coding side of things.
But perhaps you can mark them like Loot Drops from other games?

Common, Uncommon, Rare, etc.

And base that off of their percentage in /PBS/encounters.txt ?
Like, for a map, add up all the encounter rates. Then for each pokemon, divide their rate by the total in order to get the percentage chance to encounter that pokemon on this map.
Finally, match that percentage to a graphic that represents that rarity, and display is in the encounter-UI next to the pokemon Icon.

I tried making the example in Photoshop and attached it.

Just the first idea I had, so I don't know if it would even work, and there may be better ways to do it, but perhaps this is a potential solution!
 

Attachments

  • Encounter Suggestion.jpg
    Encounter Suggestion.jpg
    94.3 KB · Views: 164

PKMNTrainerGoose

Rookie
Member
Joined
May 15, 2022
Posts
5
Hi! At the bottom of UI_Pokegear, you should see this:
Ruby:
class PokemonPokegearScreen
  def initialize(scene)
    @scene = scene
  end

  def pbStartScreen
    commands = []
    cmdMap     = -1
    cmdPhone   = -1
    cmdJukebox = -1
    commands[cmdMap = commands.length]     = ["map",_INTL("Map")]
    if $PokemonGlobal.phoneNumbers && $PokemonGlobal.phoneNumbers.length>0
      commands[cmdPhone = commands.length] = ["phone",_INTL("Phone")]
    end
    commands[cmdJukebox = commands.length] = ["jukebox",_INTL("Jukebox")]
    @scene.pbStartScene(commands)
    loop do
      cmd = @scene.pbScene
      if cmd<0
        break
      elsif cmdMap>=0 && cmd==cmdMap
        pbShowMap(-1,false)
      elsif cmdPhone>=0 && cmd==cmdPhone
        pbFadeOutIn {
          PokemonPhoneScene.new.start
        }
      elsif cmdJukebox>=0 && cmd==cmdJukebox
        pbFadeOutIn {
          scene = PokemonJukebox_Scene.new
          screen = PokemonJukeboxScreen.new(scene)
          screen.pbStartScreen
        }
      end
    end
    @scene.pbEndScene
  end
end
Replace that with this:
Ruby:
class PokemonPokegearScreen
  def initialize(scene)
    @scene = scene
  end

  def pbStartScreen
    commands = []
    cmdMap        = -1
    cmdPhone      = -1
    cmdJukebox    = -1
    cmdEncounters = -1 # Edit
    commands[cmdMap = commands.length]        = ["map",_INTL("Map")]
    if $PokemonGlobal.phoneNumbers && $PokemonGlobal.phoneNumbers.length>0
      commands[cmdPhone = commands.length]    = ["phone",_INTL("Phone")]
    end
    commands[cmdJukebox = commands.length]    = ["jukebox",_INTL("Jukebox")]
    commands[cmdEncounters = commands.length] = ["encounters",_INTL("Encounters")] # Edit
    @scene.pbStartScene(commands)
    loop do
      cmd = @scene.pbScene
      if cmd<0
        break
      elsif cmdMap>=0 && cmd==cmdMap
        pbShowMap(-1,false)
      elsif cmdPhone>=0 && cmd==cmdPhone
        pbFadeOutIn {
          PokemonPhoneScene.new.start
        }
      elsif cmdJukebox>=0 && cmd==cmdJukebox
        pbFadeOutIn {
          scene = PokemonJukebox_Scene.new
          screen = PokemonJukeboxScreen.new(scene)
          screen.pbStartScreen
        }
      # Edit
      elsif cmdEncounters>=0 && cmd==cmdEncounters
        pbFadeOutIn {
          scene = EncounterList_Scene.new
          screen = EncounterList_Screen.new(scene)
          screen.pbStartScreen
        }
      end
    end
    @scene.pbEndScene
  end
end
If you have made any other changes to the Pokégear script, then those will be overwritten. I marked the bits I added by # Edit if you want to add those in manually instead. Finally, you'll want a graphic called icon_encounters.png in Graphics\Pictures\Pokegear for your new button.
I tried to do this and it shows in the pokegear. I get the error "uninitialized constant PokemonPokegearScreen::EncounterList_scene" I have the plugin in the plugins folder, I hold ctrl but the debug menu never shows the plugin compiled. I'm running v19.1 and had it running before. Is there another way to force a recompile in essentials? I've tried deleting the plugin and/reinstalling the plugin to no avail. And sometimes when I remove a plugin it'll still be in essentials. I have no clue whats going on. Any help would be appreciated greatly.

EDIT: Temporary Fix is bypassing the Plugin and just manually inserting the script above [Main]
 
Last edited:

ThatWelshOne_

Champion
Member
I tried to do this and it shows in the pokegear. I get the error "uninitialized constant PokemonPokegearScreen::EncounterList_scene" I have the plugin in the plugins folder, I hold ctrl but the debug menu never shows the plugin compiled. I'm running v19.1 and had it running before. Is there another way to force a recompile in essentials? I've tried deleting the plugin and/reinstalling the plugin to no avail. And sometimes when I remove a plugin it'll still be in essentials. I have no clue whats going on. Any help would be appreciated greatly.

EDIT: Temporary Fix is bypassing the Plugin and just manually inserting the script above [Main]
You need to make sure that the game window, not the debug console, is the active window when you're holding Ctrl to compile.
If you're struggling to get that to work, you can delete PluginScripts.rxdata from the Data folder to force your plugins to be compiled next time you launch your game in debug mode.
 

PKMNTrainerGoose

Rookie
Member
Joined
May 15, 2022
Posts
5
You need to make sure that the game window, not the debug console, is the active window when you're holding Ctrl to compile.
If you're struggling to get that to work, you can delete PluginScripts.rxdata from the Data folder to force your plugins to be compiled next time you launch your game in debug mode.
Thanks for the info on that. I ended up deleting the PluginScripts.rxdata. Now that I know how to do that though it should help out in the future. Appreciate that. <3
 

RidgeBoy

Novice
Member
Joined
Apr 6, 2022
Posts
22
Any chance this script might get updated for v20? Seems to not be working,but I really like it and would love to keep using it if possible!
 

Ashnixslaw

Novice
Member
Joined
Nov 20, 2018
Posts
17
Is there a way to display different background graphics for the different encounter types? Like having a grass background for land and a cave background for cave?
 

ThatWelshOne_

Champion
Member
Is there a way to display different background graphics for the different encounter types? Like having a grass background for land and a cave background for cave?
Of course!
One way to do it is to find this line:
name = USER_DEFINED_NAMES ? USER_DEFINED_NAMES[currKey] : GameData::EncounterType.get(currKey).real_name
And add this underneath it:
Ruby:
bg_new = "bg_"+currKey.to_s+".png"
if File.file?("Graphics/Pictures/EncounterUI/"+bg_new)
  @sprites["bg"].setBitmap("Graphics/Pictures/EncounterUI/"+bg_new)
else
  @sprites["bg"].setBitmap("Graphics/Pictures/EncounterUI/bg.png")
end
Then, in Graphics/Pictures/EncounterUI, you'll need your background graphics to be called, for example, bg_Land.png, bg_Cave.png, bg_Water.png (one image for every encounter type you have defined in your game). If you wanted all Land encounters to use the same graphic, that should be easy to do as well. With the code above, you would need, for example, bg_Land.png and bg_LandNight.png as separate images. The default white background is used otherwise.
 

Ashnixslaw

Novice
Member
Joined
Nov 20, 2018
Posts
17
Of course!
One way to do it is to find this line:
name = USER_DEFINED_NAMES ? USER_DEFINED_NAMES[currKey] : GameData::EncounterType.get(currKey).real_name
And add this underneath it:
Ruby:
bg_new = "bg_"+currKey.to_s+".png"
if File.file?("Graphics/Pictures/EncounterUI/"+bg_new)
  @sprites["bg"].setBitmap("Graphics/Pictures/EncounterUI/"+bg_new)
else
  @sprites["bg"].setBitmap("Graphics/Pictures/EncounterUI/bg.png")
end
Then, in Graphics/Pictures/EncounterUI, you'll need your background graphics to be called, for example, bg_Land.png, bg_Cave.png, bg_Water.png (one image for every encounter type you have defined in your game). If you wanted all Land encounters to use the same graphic, that should be easy to do as well. With the code above, you would need, for example, bg_Land.png and bg_LandNight.png as separate images. The default white background is used otherwise.
Amazing, thank you so much! Works brilliantly!
 

MishaKozlovacki

Novice
Member
Joined
Dec 11, 2020
Posts
23
Since this is integrated into Voltseon's Pause Menu, how do I call on it to make sure it works (whether is done via the Menu or Pokegear)? Just wanted to make sure
 

ThatWelshOne_

Champion
Member
Since this is integrated into Voltseon's Pause Menu, how do I call on it to make sure it works (whether is done via the Menu or Pokegear)? Just wanted to make sure
You should have an "Encounters" option in the pause menu or Pokégear if you've added it there instead.
You can test if it works by using pbViewEncounters as a script command in an event.
 

VoxITH

Trainer
Member
Joined
Dec 22, 2021
Posts
92
Is it possible to use it like a script in the overworld (pb...)? I'd like to put it on a sign in every route.
 
Back
Top