• Hi, Guest!
    Some images might be missing as we move away from using embedded images, sorry for the mess!
    From now on, you'll be required to use a third party to host images. You can learn how to add images here, and if your thread is missing images you can request them here.
    Do not use Discord to host any images you post, these links expire quickly!
Polished Floors

v20.1 Polished Floors 2022-12-24

This resource pertains to version 20.1 of Pokémon Essentials.
Pokémon Essentials Version
v20.1 ➖
polished.gif

Script to make ripples a property of terrain tags separate from shows_reflections, for reflective floors.​

Code​

Paste as a new script section above Main, or download as a Plugin here.
Ruby:
module GameData
  class TerrainTag
    attr_reader :ripples
  
    alias oldinitialize initialize
    def initialize(hash)
      oldinitialize(hash)
      @ripples           = hash[:ripples]            || true
    end
  
  end
end
  
class Sprite_Reflection

  def update
    return if disposed?
    shouldShow = @rsprite.visible
    if !shouldShow
      # Just-in-time disposal of sprite
      if @sprite
        @sprite.dispose
        @sprite = nil
      end
      return
    end
    # Just-in-time creation of sprite
    @sprite = Sprite.new(@viewport) if !@sprite
    if @sprite
      x = @rsprite.x - @rsprite.ox * TilemapRenderer::ZOOM_X
      y = @rsprite.y - @rsprite.oy * TilemapRenderer::ZOOM_Y
      y -= Game_Map::TILE_HEIGHT * TilemapRenderer::ZOOM_Y if @rsprite.character.character_name[/offset/i]
      @height = $PokemonGlobal.bridge if !@fixedheight
      y += @height * TilemapRenderer::ZOOM_Y * Game_Map::TILE_HEIGHT / 2
      width  = @rsprite.src_rect.width
      height = @rsprite.src_rect.height
      @sprite.x        = x + (width / 2) * TilemapRenderer::ZOOM_X
      @sprite.y        = y + (height + (height / 2)) * TilemapRenderer::ZOOM_Y
      @sprite.ox       = width / 2
      @sprite.oy       = (height / 2) - 2   # Hard-coded 2 pixel shift up
      @sprite.oy       -= @rsprite.character.bob_height * 2
      @sprite.z        = -50   # Still water is -100, map is 0 and above
      @sprite.z        += 1 if @event == $game_player
      @sprite.zoom_x   = @rsprite.zoom_x
      @sprite.zoom_y   = @rsprite.zoom_y
      frame = (Graphics.frame_count % 40) / 10
      ripples = @event.terrain_tag.ripples if @event
      @sprite.zoom_x   *= [1.0, 0.95, 1.0, 1.05][frame] if ripples
      @sprite.angle    = 180.0
      @sprite.mirror   = true
      @sprite.bitmap   = @rsprite.bitmap
      @sprite.tone     = @rsprite.tone
      if @height > 0
        @sprite.color   = Color.new(48, 96, 160, 255)   # Dark still water
        @sprite.opacity = @rsprite.opacity
        @sprite.visible = !Settings::TIME_SHADING   # Can't time-tone a colored sprite
      else
        @sprite.color   = Color.new(224, 224, 224, 96)
        @sprite.opacity = @rsprite.opacity * 3 / 4
        @sprite.visible = true
      end
      @sprite.src_rect = @rsprite.src_rect
    end
  end
end

This script does some rewriting in the Sprite_Reflection class - if you're concerned about any incompatibilities, you can rewrite it directly yourself, it's pretty simple. Just replace this line:
Ruby:
@sprite.zoom_x   *= [1.0, 0.95, 1.0, 1.05][frame]
with
Ruby:
      ripples = @event.terrain_tag.ripples if @event
      @sprite.zoom_x   *= [1.0, 0.95, 1.0, 1.05][frame] if ripples

Using this script​

Just create a new terrain tag in the script section TerrainTag, and set shows_reflections to true and ripples to false. (ripples defaults to true, so you don't have to worry about changing the existing water tags)
Credits
Credit to TechSkylander1518, please!
Author
TechSkylander1518
Downloads
515
Views
2,315
First release
Last update
Rating
0.00 star(s) 0 ratings

More resources from TechSkylander1518

Back
Top