• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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] Custom Terrain Types

91
Posts
10
Years
  • So, I have a sprite I want Pokemon to appear on, on a mountain tile of grass. The tile itself works well, but nothing is happening on the tile itself (I'm using the Overworld Pokemon Encounters, but I don't think that's relevant).

    This is what i've done so far:

    Encounter Type:

    GameData::EncounterType.register({
    :id => :Mountain,
    :type => :mountain,
    :trigger_chance => 21,
    :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1]
    })


    Terrain Tag:

    GameData::TerrainTag.register({
    :id => :Mountain,
    :id_number => 17,
    :shows_grass_rustle => true,
    :mountain_wild_encounters => true,
    :battle_environment => :mountain
    })


    Environment:

    GameData::Environment.register({
    :id => :Mountain,
    :name => _INTL("mountain"),
    :battle_base => "rock"
    })

    Everything is set up in-game, such as the terrain tags and Pokemon that should appear. I'm just lost at why it's not working. The game compiles and plays fine, they just won't show up.

    I'm using version 19.1.

    I'm also on Discord if you wanna message me: Jared#1627
     
    4
    Posts
    2
    Years
    • Seen Nov 21, 2023
    I once created an encounter type too. I think what your missing is to tell the game when to use that encounter type.

    If you go to Overworld_WildEncounters and search "def encounter_type", that's where you will have to change something. (What I did was make my encounter
    ":type => :land" and add below the the bugcontest line

    ret = :Name if $game_map.terrain_tag($game_player.x, $game_player.y).id_number == Number

    Where Name is the id of the encounter (Mountain in your case) and Number is the terrain tag number (17 in your case)


    I think this should work, but I'm not that great at scripting so something may be missing
     
    91
    Posts
    10
    Years
  • I once created an encounter type too. I think what your missing is to tell the game when to use that encounter type.

    If you go to Overworld_WildEncounters and search "def encounter_type", that's where you will have to change something. (What I did was make my encounter
    ":type => :land" and add below the the bugcontest line

    ret = :Name if $game_map.terrain_tag($game_player.x, $game_player.y).id_number == Number

    Where Name is the id of the encounter (Mountain in your case) and Number is the terrain tag number (17 in your case)


    I think this should work, but I'm not that great at scripting so something may be missing

    Thank you so much for responding.

    I went to def enounter_type, but all I can find is this:

    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
    if !ret && has_cave_encounters?
    ret = find_valid_encounter_type_for_time(:Cave, time)
    end
    end
    return ret
    end


    ---

    So, would i probably add Mountain to the " if has_land_encounters? && $game_map.terrain_tag($game_player.x, $game_player.y).land_wild_encounters"
    and " ret = find_valid_encounter_type_for_time(:Land, time) if !ret"

    ?

    Sorry, this is super confusing for me.
     
    4
    Posts
    2
    Years
    • Seen Nov 21, 2023
    Mine looks like this (as you can see I added a new encounter type called Landrare)

    # Returns the encounter method that the current encounter should be generated
    # from, depending on the player's current location.
    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 = :Landrare if $game_map.terrain_tag($game_player.x, $game_player.y).id_number == 17 # New Line
    ret = find_valid_encounter_type_for_time(:Land, time) if !ret
    end
    if !ret && has_cave_encounters?
    ret = find_valid_encounter_type_for_time(:Cave, time)
    end
    end
    return ret
    end

    ---------------

    For this to work you need to change in your encounter type definition
    ":type => :mountain,"
    to
    ":type => :land,"

    this way it will behave like a new type of grass encounter (which should be okay with you since you said it would be like mountain grass).

    You shouldn't need to do anything else than that since
    "if has_land_encounters? && $game_map.terrain_tag($game_player.x, $game_player.y).land_wild_encounters" only checks to see if you have any :land type encounter in your tile


    And don't worry, when I was trying to do it myself I was also super confused, just somehow made it work
     
    91
    Posts
    10
    Years
  • Mine looks like this (as you can see I added a new encounter type called Landrare)

    # Returns the encounter method that the current encounter should be generated
    # from, depending on the player's current location.
    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 = :Landrare if $game_map.terrain_tag($game_player.x, $game_player.y).id_number == 17 # New Line
    ret = find_valid_encounter_type_for_time(:Land, time) if !ret
    end
    if !ret && has_cave_encounters?
    ret = find_valid_encounter_type_for_time(:Cave, time)
    end
    end
    return ret
    end

    ---------------

    For this to work you need to change in your encounter type definition
    ":type => :mountain,"
    to
    ":type => :land,"

    this way it will behave like a new type of grass encounter (which should be okay with you since you said it would be like mountain grass).

    You shouldn't need to do anything else than that since
    "if has_land_encounters? && $game_map.terrain_tag($game_player.x, $game_player.y).land_wild_encounters" only checks to see if you have any :land type encounter in your tile


    And don't worry, when I was trying to do it myself I was also super confused, just somehow made it work

    I did everything you said to a T, but still now there are no Pokemon showing up :(




    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 = :Mountain if $game_map.terrain_tag($game_player.x, $game_player.y).id_number == 17 # New Line
    ret = find_valid_encounter_type_for_time(:Land, time) if !ret
    end




    GameData::EncounterType.register({
    :id => :Mountain,
    :type => :land,
    :trigger_chance => 21,
    :old_slots => [20, 20, 10, 10, 10, 10, 5, 5, 4, 4, 1, 1]
    })
     
    Last edited:
    4
    Posts
    2
    Years
    • Seen Nov 21, 2023
    I was reviewing what I had done and I think I found the problem. On your terrain tag you need to add

    :land_wild_encounters => true,

    (looks like I was wrong about the "if has_land_encounters? && $game_map.terrain_tag($game_player.x, $game_player.y).land_wild_encounters" line, it also checks if the terrain tag has that flag)
    If it's not that, I don't really know how I made it work
     
    Back
    Top