• 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] Start terrains based on map or terraintag (Solved)

  • 12
    Posts
    9
    Years
    • Seen Feb 1, 2025
    So, the gen 8 project for essentials came with a feature in SWSH that starts one of the four terrains as soon as the battle begins if a specific weather is up in the overworld (I think it is storm and fog for electric and mystic terrain respectively)

    I was wondering if it is possible to do de same but for entire maps without having to rely on weather, for example a gym having grassy terrain up all the time, or a forest or something but without using the weather so that is still free for something else.

    Or if it is possible to assign them to terrain tags, so on land while the player is on a terrain tag 0 I have grassy terrain and while surfing since I'm on another terrain tag (7 I believe) having idk psychic terrain

    Pretty sure is just having a call for the tags to check in which is the player standing but I have no idea how to do it, so any help would be appreciated

    Edit: After tinkering with the scripts I found a way to check the environment and the terrain tag and call a terrain for that. So, if anyone is interesed

    In
    Code:
    Overworld_BattleStarting
    look for
    Code:
    if battleRules["defaultTerrain"].nil?
        if Settings::SWSH_FOG_IN_BATTLES
          case $game_screen.weather_type
          when :Storm
            battle.defaultTerrain = :Electric
          when :Fog
            battle.defaultTerrain = :Misty
          end
         else
          battle.defaultTerrain = battleRules["defaultTerrain"]
        end
      end
    Wich should be arround line 110

    Then, before the "else" add this:
    Code:
    case battle.environment = pbGetEnvironment
          when :Grass
            battle.defaultTerrain = :Electric
          when :TallGrass
            battle.defaultTerrain = :Psychic
          when :"Environment"
            battle.defaultTerrain = :"Your terrain ID"
          end
    This code checks in what environment is the battle taking place and starts your terrain accordingly. I just put Electric and Psychic to test if the terrain changed

    Now, if you want to have a terrain based of what terrain tag the player is standing, before this before else add this:
    Code:
    case $game_player.terrain_tag.id
          when :Sand
            battle.defaultTerrain = :Grassy
          when :"Terrain tag name"
            battle.defaultTerrain = :"Your terrain ID"
          end
    This code checks the terrain tag and actives the terrain accordingly, same as before but since this are TerrainTagsID you can use them for having multiple terrains in one map depending on where the player is standing... although you can create a new environment and have it as the default environment for the tag and using only that, but it never hurts to have more options

    If you decided to use both options (like i did for testing purposes) it should look like this:
    Code:
    if battleRules["defaultTerrain"].nil?
        if Settings::SWSH_FOG_IN_BATTLES
          case $game_screen.weather_type
          when :Storm
            battle.defaultTerrain = :Electric
          when :Fog
            battle.defaultTerrain = :Misty
          end
          case battle.environment = pbGetEnvironment
          when :Grass
            battle.defaultTerrain = :Electric
          when :TallGrass
            battle.defaultTerrain = :Psychic
          end
          case $game_player.terrain_tag.id
          when :Sand
            battle.defaultTerrain = :Grassy
          end
        else
          battle.defaultTerrain = battleRules["defaultTerrain"]
        end
    end
     
    Last edited:
    Back
    Top