• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • 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.

[Scripting Question] Help adding new encounter method (Essentials 20.1)

MythicMerc

Dragon Master & PokéDad
  • 6
    Posts
    1
    Years
    • Seen Jul 28, 2023
    I am attempting to add a "desert" encounter method in my game for specific sandy tiles within my desert map (using Essentials v20.1.). I followed all the instructions on the Wiki page for "Adding new encounter methods," but it's still not working for some reason.

    Here is what I'm working with...
    Within EncounterType, I added the following:
    Code:
    GameData::EncounterType.register({
      :id             => :Desert,
      :type           => :none,
      :trigger_chance => 21
    })

    This encounter type should work based on the "taking a step" method, i.e. encounters are only possible when stepping on the specific sandy tiles, so I have the following in Overworld_WildEncounters:
    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
          if !ret && has_cave_encounters?
            ret = find_valid_encounter_type_for_time(:Cave, time)
          end   
          if !ret && has_desert_encounters?
            ret = find_valid_encounter_type_for_time(:Desert, time)
          end 
          if !ret && has_swamp_encounters?
            ret = find_valid_encounter_type_for_time(:Swamp, time)
          end       
        end
        return ret
      end

    As for the specific tiles that should trigger the encounter, I have labeled them as Terrain Tag #18 within the tileset, and I have added the following to the TerrainTag script section:
    Code:
    GameData::TerrainTag.register({
      :id                     => :Desert,
      :id_number              => 18,
      :battle_environment     => :Desert,
      :shows_reflections      => false
    })

    Within encounters.txt, I have the listed possible encounters like so:
    Code:
    Desert,21
        20,SANDILE,30,36
        20,HIPPOPOTAS,30,36
        10,TRAPINCH,30,36
        10,CACNEA,30,36
        10,PHANPY,30,36
        10,VULLABY,30,36
         5,BALTOY,30,36
         5,SILICOBRA,30,36
         4,KROKOROK,30,36
         4,VIBRAVA,30,36
         1,GIBLE,30,36
         1,SANDACONDA,30,36

    Am I missing something? I thought I had done all the necessary steps, but when I walk on the tiles, battles never trigger. They show up fine, I can walk on them fine....just no wild battles triggering.

    Thanks in advance for any help!!
     
    I think the problem is on the line: ":type => :none".
    It shouldn't be "none", as all the "none" types are moves that trigger a battle and not a step trigger. Try "land", I think it should work.
     
    Back
    Top