• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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.

[Script] Animation Color Change

  • 1
    Posts
    4
    Years
    • Seen Jun 22, 2024
    First post on the forums 😃

    I'll do my best to explain exactly what I'm aiming to accomplish ~

    I have multiple tilesets which are copies, but in different hues/colors. I would like to make the rustling grass animation for each colored tileset have its own respected color. In my current case, purple grass and purple rustling grass animation.

    I have read a few threads on how to edit PField and PBTerrain scripts to register a new terrain tag and implement an elsif statement for my exception of the purple grass from normal. I cannot get the grass animation to change color - it stays green (default). A member said to remove the animationID placeholder and to input my actual animation ID for the purple grass animation, would that be 8?

    Edit- I am using Essentials v18.1

    I'll post some code, please point out if anything is obviously wrong ~

    PBTerrain
    Code:
    module PBTerrain
      Ledge           = 1
      Grass           = 2
      Sand            = 3
      Rock            = 4
      DeepWater       = 5
      StillWater      = 6
      Water           = 7
      Waterfall       = 8
      WaterfallCrest  = 9
      TallGrass       = 10
      UnderwaterGrass = 11
      Ice             = 12
      Neutral         = 13
      SootGrass       = 14
      Bridge          = 15
      Puddle          = 16
     [COLOR="Blue"] PurpleGrass     = 17[/COLOR]
    Code:
    def self.isGrass?(tag)
        return tag==PBTerrain::Grass ||
               tag==PBTerrain::TallGrass ||
               tag==PBTerrain::UnderwaterGrass ||
               tag==PBTerrain::SootGrass ||
              [COLOR="Blue"] tag==PBTerrain::PurpleGrass[/COLOR]
      end
    
      def self.isJustGrass?(tag)   # The Poké Radar only works in these tiles
        return tag==PBTerrain::Grass || 
               tag==PBTerrain::PurpleGrass ||
               tag==PBTerrain::SootGrass

    PField_Field
    Code:
    # Show grass rustle animation, and auto-move the player over waterfalls and ice
    Events.onStepTakenFieldMovement += proc { |_sender,e|
      event = e[0] # Get the event affected by field movement
      if $scene.is_a?(Scene_Map)
        currentTag = pbGetTerrainTag(event)
        if PBTerrain.isJustGrass?(pbGetTerrainTag(event,true)) # Won't show if under bridge
          $scene.spriteset.addUserAnimation(GRASS_ANIMATION_ID,event.x,event.y,true,1)
        [COLOR="Blue"]elsif pbGetTerrainTag(event,true)==PBTerrain::PurpleGrass
    $scene.spriteset.addUserAnimation(PURPLE_GRASS_ANIMATION_ID,event.x,event.y,true,8)[/COLOR]
        elsif event==$game_player
          if currentTag==PBTerrain::WaterfallCrest
            # Descend waterfall, but only if this event is the player
            pbDescendWaterfall(event)
          elsif PBTerrain.isIce?(currentTag) && !$PokemonGlobal.sliding
            pbSlideOnIce(event)
          end
        end
      end
     
    Last edited:
    Back
    Top