• Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Trading Card Game 2 protagonist in the poll by clicking here.
  • 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.

Terrain Encounter Areas

Merovin

Dragon Master!
  • 193
    Posts
    19
    Years
    Please Note, I did not make this, Give Credit to SephirothSpawn from RMXP.net, I thought it would be helpful for everyone, so here it is :D

    Terrain Encounter Areas
    Version: 1


    Introduction

    Lets you define encounter groups based off the terrain tags

    Features
    • Set Terrain Tags to have defaults
    • Different Terrain Tags for each map id (Optional)

    #==============================================================================
    # ** Terrain Encounters
    #------------------------------------------------------------------------------
    # SephirothSpawn
    # Version 1
    # 2006-03-19
    #==============================================================================

    #------------------------------------------------------------------------------
    # * SDK Log Script
    #------------------------------------------------------------------------------
    SDK.log('Terrain Encounters', 'SephirothSpawn', 1, '2006-03-19')

    #------------------------------------------------------------------------------
    # * Begin SDK Enable Test
    #------------------------------------------------------------------------------
    if SDK.state('Terrain Encounters') == true

    #==============================================================================
    # ** Scene_Map
    #==============================================================================

    class Scene_Map
    #--------------------------------------------------------------------------
    # * Default Terrain Tags
    # ~ terrain_value = [troop_id, ... ]
    #--------------------------------------------------------------------------
    DEFAULT_TERRAIN_TAG_GROUPS = {
    0 => [1, 2],
    1 => [3, 4],
    2 => [5, 6],
    3 => [7, 8],
    4 => [9, 10],
    5 => [11, 12],
    6 => [13, 14],
    7 => [15, 16]
    }
    #--------------------------------------------------------------------------
    # * Map Defined Terrain Tags
    # ~ map_id = > {terrain_tag => [troop_id, ...] }
    #--------------------------------------------------------------------------
    MAP_DEFINED_TAG_GROUPS = {
    1 => {
    },
    2 => {
    },
    }
    #--------------------------------------------------------------------------
    # * Alias Listings
    #--------------------------------------------------------------------------
    alias seph_terrainencounters_scenemap_callbattle call_battle
    #--------------------------------------------------------------------------
    # * Battle Call
    #--------------------------------------------------------------------------
    def call_battle
    # Get Terrain Tag
    terrain = $game_player.terrain_tag
    # Old Encouncter Group
    enc_group = [$game_temp.battle_troop_id]
    # Default Encounter Group
    if DEFAULT_TERRAIN_TAG_GROUPS.has_key?(terrain)
    enc_group = DEFAULT_TERRAIN_TAG_GROUPS[terrain]
    end
    # Defined Encounter Group
    if MAP_DEFINED_TAG_GROUPS.has_key?($game_map.map_id)
    map_terrain = MAP_DEFINED_TAG_GROUPS[$game_map.map_id]
    if map_terrain.has_key?(terrain)
    unless map_terrain[terrain].empty?
    enc_group = map_terrain[terrain]
    end
    end
    end
    # Confirm troop
    troop_id = enc_group[rand(enc_group.size)]
    # If troop is valid
    if $data_troops[troop_id] != nil
    # Set battle calling flag
    $game_temp.battle_troop_id = troop_id
    end
    # Original Call Battle Method
    seph_terrainencounters_scenemap_callbattle
    end
    end

    #--------------------------------------------------------------------------
    # * End SDK Enable Test
    #--------------------------------------------------------------------------
    end

    Instructions

    Place the script below the SDK, and above Main

    Setting Default Encounter Groups (Global)

    Find the line DEFAULT_TERRAIN_TAG_GROUPS = {

    Below that, define a terrain tag, and a encounter group of all the troop id's allowed in this area.

    Basic Syntax: terrain_value = [troop_id, ... ]

    Example:
    DEFAULT_TERRAIN_TAG_GROUPS = {
    0 => [1, 2],
    1 => [3, 4],
    2 => [5, 6],
    3 => [7, 8],
    4 => [9, 10],
    5 => [11, 12],
    6 => [13, 14],
    7 => [15, 16]
    }

    Any undefined terrain tags, will result in the Random Encounters Setup under Map Properties

    Setting Map Dependent Terrain Groups

    Find this line MAP_DEFINED_TAG_GROUPS = {

    Below that, deine a mpa id, then terrain tag and encounter group


    Basic Syntax: map_id = > {terrain_tag => [troop_id, ...] }

    Example:
    MAP_DEFINED_TAG_GROUPS = {
    1 => {
    0 => [],
    1 => [4, 7],
    6 => [1, 6]
    },
    2 => {
    1 => [2, 5]
    },
    }

    Any Undefined Terrain Tags in this, will rely on the defaults.

    How it works
    Gets Random Encounter from Map Properties
    Checks for default terrain tag for player (Changes Encounter Group if Terrain Defined)
    Checks for Map ID defined
    (If It Is)
    Checks for terrain tag for player (Changes Encounter Group if Terrain Defined)
    Pics new troop
    Any Empty Arrays will then rely on the previos default

    FAQ

    None Thus Far

    Compatibility

    SDK Compliant & Compatable

    Author's Notes

    Enjoy!


    I am not sure how to use it, but im sure most epople will be able to figure it out, It basicly lets random encouners appear on the certain terrain like the grass for wild pokemon :D if you know how to use it lol!
     
    Back
    Top