Habitats - B2W2 Habitat List for Essentials

Habitats - B2W2 Habitat List for Essentials 1.1

Pokémon Essentials Version
v17.2 ➖
Habitats
HabPreview1.png
HabPreview2.png
HabPreview3.png

A B2W2-alike Habitat List for Essentials, showing players a list of explored areas and the Pokémon available in them with Pokédex and Region Map integration.

Steps to Setup

Download the linked ZIP file. Extract this and move the Habitats folder to Graphics/Pictures.

Copy and add the script Habitats.rb above main (edit with Notepad if you don't have a script editor).

Then make these changes to PScreen_RegionMap:
UNDER this line:
Ruby:
@sprites["mapbottom"].mapdetails  = pbGetMapDetails(@mapX,@mapY)

Add this
Ruby:
# HABITAT START
    @sprites["habitat_button"] = IconSprite.new(Graphics.width-164, 2, @viewport)
    @sprites["habitat_button"].setBitmap("Graphics/Pictures/Habitats/menu_button")
    @sprites["habitat_button"].visible = $Trainer.pokedex && $Trainer.habitatData && $Trainer.habitatData.size > 0
    # END

ABOVE this line
Ruby:
 elsif Input.trigger?(Input::C) && mode==1 # Choosing an area to fly to

Add this
Ruby:
elsif Input.trigger?(Input::F5) && $Trainer.habitatData && $Trainer.pokedex
        playerpos = (!$game_map) ? nil : pbGetMetadata($game_map.map_id,MetadataMapPosition)
        if !playerpos
          mapindex = 0
        elsif @region>=0 && @region!=playerpos[0] && @mapdata[@region]
          mapindex = @region
        else
          mapindex = playerpos[0]
        end
        if $DEBUG && Input.trigger?(Input::CTRL)
          Kernel.pbMessage("Location: [#{mapindex}, #{@mapX}, #{@mapY}]")
        else
          find = HabitatConfig::RegionOverride.find { |key, value| key[0] == mapindex && key[1] == @mapX && key[2] == @mapY}
          if find.nil?
            hab = Habitats.getIndexByRegionCoords(@mapX,@mapY,mapindex,@mapdata)
          else
            hab = Habitats.getIndexByMapID(find[1])
          end
          if hab > -1
            pbPlayDecisionSE
            oldsprites = pbFadeOutAndHide(@sprites)
            ret = -1
            scene = HabitatDetailScene.new
            screen = HabitatDetailScreen.new(scene)
            ret = screen.pbStartScreenSingle(hab)
            pbFadeInAndShow(@sprites, oldsprites)
          else
            pbPlayBuzzerSE
          end
        end

Then lastly, make these changes to PScreen_PokedexMain
UNDER these lines
Ruby:
@sprites["searchcursor"] = PokedexSearchSelectionSprite.new(@viewport)
@sprites["searchcursor"].visible = false

Add this:
Ruby:
# HABITAT START
    @sprites["habitat_button"] = IconSprite.new(Graphics.width-58, 6, @viewport)
    @sprites["habitat_button"].setBitmap("Graphics/Pictures/Habitats/menu_button")
    @sprites["habitat_button"].visible = $Trainer.habitatData && $Trainer.habitatData.size > 0
    # END

Then ABOVE these lines:
Ruby:
elsif Input.trigger?(Input::C)
          if $Trainer.seen[@sprites["pokedex"].species]

Add this:
Ruby:
elsif Input.trigger?(Input::F5) && $Trainer.habitatData  && $Trainer.habitatData.size > 0
          pbLoadHabitatList

Config
There are 3 places at the top of the file to configure Habitats.

HabitatConfig::Types
These should not change much, unless you have other non-standard encounter types to enclude. These are groups of Encounter Types to include in each Habitat.

HabitatConfig::Habitats
Code:
[[49,50], [:grass,:surf,:fish]]
This is a an array with two arrays inside it. The first part is a list of Map IDs associated with the area. Please include all of them! The second is the list of Habitat Encounter types defined above. It's best not to mix Place and Grass as they use the same icon.

HabitatConfig::RegionOverride
Code:
[0,15,6] => 34,    # Ice Cave
A hash of overrides for the region map. This is for places that appear along a route, like Ice Cave in the demo project. The left hand side of the hash key is an array [regionNumber, regionMapX, regionMapY] and the right hand side is any one map from the Habitat.

To get the left hand side value quickly, press CTRL+F while on the region map view.

How to Use
Using is quite simple. Once the Trainer has been given the Pokedex, they can press F from the Pokedex List screen or on a square in the region map to view Habitat data if they have visited that area. Enjoy!

IMPORTANT: When changes have been made to the Habitat data, you'll need to add an NPC with a script command Habitats.setup for existing saves. This will refresh all the Habitats data, but reset the 'viewed' status for Habitats that have been viewed.

The only way to retain the viewed data for existing saves is to run Habitats.update - but the order of Habitats must be the same as it was before, otherwise errors will occur. New Habitats can be added onto the end of the list.

Customisation
This script supports extensions with Phenomenon. To use, just uncomment the lines associated.

Each region gets a unique thumbnail. These graphics are located in Graphics/Pictures/Habitats/mapthumbRegionX.png.
Credits
Credit must be given if used.

Please credit Boonzeet.
Author
boonzeet
Downloads
186
Views
241
First release
Last update
Rating
5.00 star(s) 1 ratings

More resources from boonzeet

Latest updates

  1. V1.1: Fixed issues with PNG Indexing

    Fixes issues with PNG indexing in all files causing engine errors for users of older RMXP editions.

Latest reviews

---------------------------
Error
---------------------------
Script 'BitmapCache' line 394: RuntimeError occurred.

Failed to load the bitmap located at: Graphics/Pictures/Habitat/stamp_seen

from 'BitmapCache' line 394 in `load_bitmap'
from 'Habitat Info' line 495 in `initialize'
from 'Habitat Info' line 598 in `new'
from 'Habitat Info' line 598 in `pbStartScene'
from 'Habitat Info' line 687 in `pbStartScreen'
from 'Habitat Info' line 697 in `pbLoadHabitatList'
from 'Habitat Info' line 694 in `pbFadeOutIn'
from 'Habitat Info' line 694 in `pbLoadHabitatList'
from 'PScreen_PokedexMain' line 1180 in `pbPokedex'
from 'PScreen_PokedexMain' line 1158 in `loop'
from 'PScreen_PokedexMain' line 1187 in `pbPokedex'
from 'PScreen_PokedexMain' line 1157 in `pbActivateWindow'
---------------------------
OK
---------------------------


This happened because you labelled your "Habitat" folder "Habitats" a simple fix by renaming the search code or the folder

Also you need to mention that this will crash unless you have Phenomenon Grass installed
boonzeet
boonzeet
I've fixed both of these a few minutes ago - uploaded an outdated version like a donut. Please download again and it should work!
Top