- 314
- Posts
- 4
- Years
- Germany
- Seen Oct 27, 2024
Can you add new types of overworld spawns?
I assume that you use Pokemon Essentials V19.1 and Visible Overworld Wild Encounters Plugin Version V19.1.0.3.
If you want to include overworld versions for the default encounter types then you can simply include the plugin "Different Spawn And Normal Encounters - Overworld Encounters Add On" to your project. You can find it at https://github.com/VisibleOverworldWildEncounters/Visible-Overworld-Wild-Encounters
If you want to include your own new custom encounter types (for instance "desert") then you have to do the following:
- At first, you have to add your custom encounter type as usual to your project. If you are not familiar with that then you find an explaination in the following spoiler section
Spoiler:
Adding a custom encounter type is described in more detail in https://www.reddit.com/r/PokemonRMXP/comments/nac0zx/new_encounter_types_with_new_scripts_in_v19/ and https://essentialsdocs.fandom.com/wiki/Adding_new_encounter_methods
Basically it consists of the following steps
- Add a new environment (this is needed if the encounter happens on a new area, such as a desert). This might look something like this
Code:GameData::Environment.register({ :id => :Desert, :name => _INTL("Desert"), :battle_base => "desert" })
- Add a new terrain tag. This might look similar to this
Code:GameData::TerrainTag.register({ :id => :Desert, :id_number => 17, :battle_environment => :Desert # or an already existing environment such as :Grass if the encounter does not happen on a new area })
- Add new encounter types. This might be something like this
Code:GameData::EncounterType.register({ :id => :Desert, :type => :desert, # or an already existing type such as :land or :cave if the encounter does not happen on a new area :trigger_chance => 21, :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] })
- Overwrite the method encounter_type of class PokemonEncounters in script section /Scripts/012_Overworld/002_Battle triggering/003_Overworld_WildEncounters.rb to make encountering work. Probably, encounter_type will look similar to this
Code:def encounter_type time = pbGetTimeNow ret = nil if $PokemonGlobal.surfing ret = find_valid_encounter_type_for_time(:Water, time) else # Land/Cave (can have both in the same map) if has_land_encounters? && $game_map.terrain_tag($game_player.x, $game_player.y).land_wild_encounters ret = :BugContest if pbInBugContest? && has_encounter_type?(:BugContest) ret = find_valid_encounter_type_for_time(:Land, time) if !ret end # here the desert encounter is added --- if !ret && has_encounter_type?(:desert) && $game_map.terrain_tag($game_player.x, $game_player.y).battle_environment == :Desert ret = find_valid_encounter_type_for_time(:Desert, time) # -------------------------------------- if !ret && has_cave_encounters? ret = find_valid_encounter_type_for_time(:Cave, time) end end return ret end
- If the encounter should happen on a new area (as it is in our example "desert"), then set the terrain tag (in our example 17) onto all that tiles where you want the encounter to happen. Use the the debug section while running your game to do that. Note that the probabilities defined for each Pokemon in the encounters must be the same as the ':old_slots' defined in the 'EncounterType' script. Otherwise your game will raise an error.
- Add a new environment (this is needed if the encounter happens on a new area, such as a desert). This might look something like this
- Overwrite the method encounter_type_on_tile of class PokemonEncounters in the Visible Overworld Wild Encounters Plugin to make overworld encountering work. Probably, encounter_type_on_tile needs to be something like this
Code:def encounter_type_on_tile(x,y) time = pbGetTimeNow ret = nil if $game_map.terrain_tag(x,y).can_surf_freely ret = find_valid_encounter_type_for_time(:Water, time) else # Land/Cave (can have both in the same map) if has_land_encounters? && $game_map.terrain_tag(x, y).land_wild_encounters ret = :BugContest if pbInBugContest? && has_encounter_type?(:BugContest) ret = find_valid_encounter_type_for_time(:Land, time) if !ret end # here the desert encounter is added --- if !ret && has_encounter_type?(:desert) && $game_map.terrain_tag($game_player.x, $game_player.y).battle_environment == :Desert ret = find_valid_encounter_type_for_time(:Desert, time) # -------------------------------------- if !ret && has_cave_encounters? ret = find_valid_encounter_type_for_time(:Cave, time) end end return ret end
If you want new custom encounter types (such as "desert") where you have different pokemon for spawning and for instant battle then
- install the plugin "Different Spawn And Normal Encounters - Overworld Encounters Add On" from https://github.com/VisibleOverworldWildEncounters/Visible-Overworld-Wild-Encounters
- add your custom encounter types to your project as it is written in the spoiler section above.
- Add corresponding Overworld encounter types for all your custom encounter types. This might be something like this
Code:GameData::EncounterType.register({ :id => :OverworldDesert, :type => :desert, # or an already existing type such as :land or :cave if the encounter does not happen on a new area :trigger_chance => 21, :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1] })
- Overwrite the method encounter_type_on_tile of class PokemonEncounters in the "Different Spawn And Normal Encounters - Overworld Encounters Add On" plugin (and not in the "Visible Overworld Wild Encounters" Plugin) to make different overworld encountering work. Probably, encounter_type_on_tile needs to be something like this
Code:def encounter_type_on_tile(x,y) time = pbGetTimeNow ret = nil if $game_map.terrain_tag(x,y).can_surf_freely ret = find_valid_encounter_type_for_time(:OverworldWater, time) ret = find_valid_encounter_type_for_time(:Water, time) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN else # Land/Cave (can have both in the same map) if has_land_encounters? && $game_map.terrain_tag(x, y).land_wild_encounters ret = :OverworldBugContest if pbInBugContest? && has_encounter_type?(:OverworldBugContest) ret = :BugContest if pbInBugContest? && has_encounter_type?(:BugContest) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN ret = find_valid_encounter_type_for_time(:OverworldLand, time) if !ret ret = find_valid_encounter_type_for_time(:Land, time) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN end # here the desert encounter is added --- if !ret && has_encounter_type?(:desert) && $game_map.terrain_tag($game_player.x, $game_player.y).battle_environment == :Desert ret = find_valid_encounter_type_for_time(:OverworldDesert, time) ret = find_valid_encounter_type_for_time(:Desert, time) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN # -------------------------------------- if !ret && has_cave_encounters? ret = find_valid_encounter_type_for_time(:OverworldCave, time) ret = find_valid_encounter_type_for_time(:Cave, time) if !ret && VisibleEncounterSettings::LET_NORMAL_ENCOUNTERS_SPAWN end end return ret end
Last edited: