• 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!
Overworld Shadows EX

Resource Overworld Shadows EX 2.0.3

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319
Golisopod User submitted a new resource:

Overworld Shadows EX - Overworld Shadows for Essentials v19

TZLEhed-Ec-K-min.gif


Overworld Shadows EX
Overworld Shadows for Essentials v19

Overview:
Overworld Shadow's is an amazing feature that breathes life into maps and gives them some depth. However, older iterations of the script didn't work very well with v18, and are completely incompatible with v19. Moreover, it lacked compatibility with other event-based scripts...

Read more about this resource...
 

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319

Noxuya

Rookie
Member
Joined
Apr 18, 2022
Posts
1
Hi, so i incorporated this to my game, and realised that in my night cycle the shadow ends up being pit black, my day night sistem is managed in a common event, could you give me any advice on how i would manage it so that if it's day i have the shadow but if its night i dont?
(Dia means Day, Noche means Night, Horas means hours)
 

Attachments

  • cycle.png
    cycle.png
    9.9 KB · Views: 118

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319

Riddle

Novice
Member
Joined
Apr 22, 2017
Posts
20
The following error appears when compiling. Tested on a brand new version of Pokemon Essentials v20, with the Hotfix plugin installed.

[Pokémon Essentials version 20]
[v20 Hotfixes 1.0.2]
Exception: NameError
Message: uninitialized constant Sprite_OWShadow::Game_FollowingPkmn

Backtrace:
[Overworld Shadows EX] script.rb:17:in `initialize'
[Overworld Shadows EX] script.rb:146:in `new'
[Overworld Shadows EX] script.rb:146:in `initialize'
066:Spriteset_Map:58:in `new'
066:Spriteset_Map:58:in `block in initialize'
066:Spriteset_Map:57:in `each'
066:Spriteset_Map:57:in `initialize'
067:Sprite_AnimationSprite:50:in `initialize'
068:Sprite_DynamicShadows:197:in `initialize'
032:Scene_Map:23:in `new'
 

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319

Golisopod User

Elite Trainer
Member
Joined
May 11, 2020
Posts
319
Golisopod User updated Overworld Shadows EX with a new update entry:

Reoptimization and Bugfixes

  • Greatly optimized the script by recalculating shadow visibility only when needed, instead of every frame.
  • Misc. bugfixes.

I think it was irresponsible of me to not clarify this before, so I think I should do it now:
I will no longer be actively maintaining or updating this resource. The latest release of the resource will be left up for download, but will not be updated by me. The download links for all older versions of this resource will be deactivated. Feel free...

Read the rest of this update entry...
 

LinKazamine

Champion
Member
Joined
May 24, 2023
Posts
614
For anyone that wants to use this script alongside Advanced Items Field Moves, there's a sort of compatibility issue that causes the player character not to have a shadow until they go through a door. It can be solved by calling an event that makes the player's character invisible and turns them visible again. You can make the player invisible in the intro right before the command to transport the player to another map and make them visible again right after the same command.
 

Mashirosakura

With my wishes frozen in time and long forgotten
Discord Mod
This script can work on v21.1, with a few tweaks. Thanks to Darkonius Mavakar pointing out the error on the Discord, @D0vid and I figured out that it occurred due to how jumping is coded now, and we set out to figure out a fix. D0vid is better at the maths side so all of the calcs are on him. I just found what the new names for stuff were.
We ended up with this:
If you want to use this, download it like normal and replace the plugin's script.rb file with this:
#-------------------------------------------------------------------------------
# New Class for Shadow object
#-------------------------------------------------------------------------------
class Sprite_OWShadow
  attr_reader :visible
  #-----------------------------------------------------------------------------
  # Initialize a shadow sprite based on the name of the event
  #-----------------------------------------------------------------------------
  def initialize(sprite, event, viewport = nil)
    @rsprite  = sprite
    @event    = event
    @viewport = viewport
    @sprite   = Sprite.new(viewport)
    @disposed = false
    @remove   = false
    name      = ""
    if !defined?(Game_FollowingPkmn) || !@event.is_a?(Game_FollowingPkmn)
      if @event != $game_player
        name = $~[1] if @event.name[/shdw\((.*?)\)/]
      else
        name = OWShadowSettings::PLAYER_SHADOW_FILENAME
      end
    end
    name = OWShadowSettings::DEFAULT_SHADOW_FILENAME if nil_or_empty?(name)
    @ow_shadow_bitmap = AnimatedBitmap.new("Graphics/Characters/Shadows/" + name)
    RPG::Cache.retain("Graphics/Characters/Shadows/" + name)
    update
  end
  #-----------------------------------------------------------------------------
  # Override the bitmap of the shadow sprite
  #-----------------------------------------------------------------------------
  def set_bitmap(name)
    if !pbResolveBitmap("Graphics/Characters/Shadows/" + name)
      echoln("The Shadow File you are trying to set it absent from /Graphics/Characters/Shadows/")
      return
    end
    @ow_shadow_bitmap = AnimatedBitmap.new("Graphics/Characters/Shadows/" + name)
    RPG::Cache.retain("Graphics/Characters/Shadows/" + name)
    @sprite.dispose if @sprite && !@sprite.disposed?
    @sprite = nil
    @sprite = Sprite.new(@viewport)
    @sprite.bitmap  = @ow_shadow_bitmap.bitmap
    update
  end
  #-----------------------------------------------------------------------------
  # Dispose the shadow bitmap
  #-----------------------------------------------------------------------------
  def dispose
    return if @disposed
    @sprite.dispose if @sprite
    @sprite = nil
    @disposed = true
  end
  #-----------------------------------------------------------------------------
  # Check whether the shadow has been disposed
  #-----------------------------------------------------------------------------
  def disposed?; return @disposed; end
  #-----------------------------------------------------------------------------
  # Calculation of shadow size when jumping
  #-----------------------------------------------------------------------------
  def jump_sprite
    return unless @sprite
    zoom_level = -Math.sin(Math::PI * @event.jump_fraction) + 1
    @sprite.zoom_x = zoom_level
    @sprite.zoom_y = zoom_level
    @sprite.x = @event.screen_x
    @sprite.y = @event.screen_y
    @sprite.z = @rsprite.z - 1
    #if @event.jump_fraction >= 1 && @event.jump_fraction < @event.jump_peak
    #  @sprite.zoom_x += 0.1
    #  @sprite.zoom_y += 0.1
    #elsif @event.jump_fraction >= @event.jump_peak
    #  @sprite.zoom_x -= 0.05
    #  @sprite.zoom_y -= 0.05
    #end
    #@sprite.zoom_x = 1 if @sprite.zoom_x > 1
    #@sprite.zoom_x = 0 if @sprite.zoom_x < 0
    #@sprite.zoom_y = 1 if @sprite.zoom_y > 1
    #@sprite.zoom_y = 0 if @sprite.zoom_y < 0
    #if @event.jump_fraction == 1
    #  @sprite.zoom_x = 1.0
    #  @sprite.zoom_y = 1.0
    #end
    #@sprite.x = @event.screen_x
    #@sprite.y = @event.screen_y
    #@sprite.z = @rsprite.z - 1
  end
  #-----------------------------------------------------------------------------
  # Calculation of shadow size when jumping
  #-----------------------------------------------------------------------------
  def update
    return if disposed? || !$scene.is_a?(Scene_Map)
    return jump_sprite if @event.jumping?
    @sprite = Sprite.new(@viewport) if !@sprite
    @ow_shadow_bitmap.update
    @sprite.bitmap  = @ow_shadow_bitmap.bitmap
    @sprite.x       = @rsprite.x
    @sprite.y       = @rsprite.y
    @sprite.ox      = @ow_shadow_bitmap.width / 2
    @sprite.oy      = @ow_shadow_bitmap.height - 2
    @sprite.z       = @event.screen_z(@ow_shadow_bitmap.height) - 1
    @sprite.zoom_x  = @rsprite.zoom_x
    @sprite.zoom_y  = @rsprite.zoom_y
    @sprite.opacity = @rsprite.opacity
    @sprite.visible = @rsprite.visible && @event.shows_shadow?
  end
  #-----------------------------------------------------------------------------
end

#-------------------------------------------------------------------------------
# New Method for setting shadow of any event given the map id and event id
#-------------------------------------------------------------------------------
def pbSetOverworldShadow(name, event_id = nil, map_id = nil)
  return if !$scene.is_a?(Scene_Map)
  return if nil_or_empty?(name)
  if !event_id
    $scene.spritesetGlobal.playersprite.ow_shadow.set_bitmap(name)
  else
    map_id = $game_map.map_id if !map_id
    $scene.spritesets[map_id].character_sprites[(event_id - 1)].ow_shadow.set_bitmap(name)
  end
end


#-------------------------------------------------------------------------------
# Referencing and initializing Shadow Sprite in Sprite_Character
#-------------------------------------------------------------------------------
class Sprite_Character
  attr_accessor :ow_shadow
  #-----------------------------------------------------------------------------
  # Initializing Shadow with Character
  #-----------------------------------------------------------------------------
  alias __ow_shadow__initialize initialize unless private_method_defined?(:__ow_shadow__initialize)
  def initialize(*args)
    __ow_shadow__initialize(*args)
    @ow_shadow = Sprite_OWShadow.new(self, args[1], args[0])
    update
  end
  #-----------------------------------------------------------------------------
  # Disposing Shadow with Character
  #-----------------------------------------------------------------------------
  alias __ow_shadow__dispose dispose unless method_defined?(:__ow_shadow__dispose)
  def dispose(*args)
    __ow_shadow__dispose(*args)
    @ow_shadow.dispose if @ow_shadow
    @ow_shadow = nil
  end
  #-----------------------------------------------------------------------------
  # Updating Shadow with Character
  #-----------------------------------------------------------------------------
  alias __ow_shadow__update update unless method_defined?(:__ow_shadow__update)
  def update(*args)
    __ow_shadow__update(*args)
    return if !@ow_shadow
    @ow_shadow.update
  end
end

#-------------------------------------------------------------------------------
# Adding shadow checking method to Game_Event
#-------------------------------------------------------------------------------
class Game_Character
  attr_reader :jump_fraction
  attr_reader :jump_distance
  attr_reader :jump_fraction
  attr_reader :jump_peak
  #-----------------------------------------------------------------------------
  # Initializing Shadow with event
  #-----------------------------------------------------------------------------
  alias __ow_shadow__initialize initialize unless private_method_defined?(:__ow_shadow__initialize)
  def initialize(*args)
    __ow_shadow__initialize(*args)
    @shows_shadow = false
  end
  #-----------------------------------------------------------------------------
  # Updating Shadow with Character
  #-----------------------------------------------------------------------------
  alias __ow_shadow__calculate_bush_depth calculate_bush_depth unless method_defined?(:__ow_shadow__calculate_bush_depth)
  def calculate_bush_depth(*args)
    __ow_shadow__calculate_bush_depth(*args)
    @shows_shadow = shows_shadow?(true)
  end
  #-----------------------------------------------------------------------------
  # Check whether the character should have a shadow
  #-----------------------------------------------------------------------------
  def shows_shadow?(recalc = false)
    return @shows_shadow if !recalc
    return false if nil_or_empty?(self.character_name) || self.transparent
    if OWShadowSettings::CASE_SENSITIVE_BLACKLISTS
      return false if OWShadowSettings::SHADOWLESS_CHARACTER_NAME.any?{ |e| self.character_name[/#{e}/] }
      return false if self.respond_to?(:name) && OWShadowSettings::SHADOWLESS_EVENT_NAME.any? { |e| self.name[/#{e}/]}
    else
      return false if OWShadowSettings::SHADOWLESS_CHARACTER_NAME.any?{ |e| self.character_name[/#{e}/i] }
      return false if self.respond_to?(:name) && OWShadowSettings::SHADOWLESS_EVENT_NAME.any? { |e| self.name[/#{e}/]}
    end
    terrain = $game_map.terrain_tag(self.x, self.y)
    return false if OWShadowSettings::SHADOWLESS_TERRAIN_NAME.any? { |e| terrain == e } if terrain
    return true
  end
  #-----------------------------------------------------------------------------
  # Updating Shadows when transparency is changed
  #-----------------------------------------------------------------------------
  alias __ow_shadow__transparent_set transparent= unless method_defined?(:__ow_shadow__transparent_set)
  def transparent=(*args)
    __ow_shadow__transparent_set(*args)
    @shows_shadow = shows_shadow?(true)
  end
  #-----------------------------------------------------------------------------
end

#-------------------------------------------------------------------------------
# Updating Shadow with Character
#-------------------------------------------------------------------------------
class Game_Event
  alias __ow_shadow__refresh refresh unless method_defined?(:__ow_shadow__refresh)
  def refresh(*args)
    ret = __ow_shadow__refresh(*args)
    @shows_shadow = shows_shadow?(true)
    return ret
  end
end

class Game_Player
  #-----------------------------------------------------------------------------
  # Updating Shadow with Player's Movement
  #-----------------------------------------------------------------------------
  alias __ow_shadow__set_movement_type set_movement_type unless method_defined?(:__ow_shadow__set_movement_type)
  def set_movement_type(*args)
    ret = __ow_shadow__set_movement_type(*args)
    @shows_shadow = shows_shadow?(true)
    return ret
  end
  #-----------------------------------------------------------------------------
end

#-------------------------------------------------------------------------------
# Adding accessors to the Scene_Map class
#-------------------------------------------------------------------------------
class Scene_Map
  attr_accessor :spritesets
end

#-------------------------------------------------------------------------------
# Adding accessors to the Game_Character class
#-------------------------------------------------------------------------------
class Spriteset_Map
  attr_accessor :character_sprites
end
 

REALMUGEN

Trainer
Member
Joined
Jan 23, 2020
Posts
69
Does it happen to anyone else that when starting the map, the shadows appear after the characters and remain when they delete their graphic or change opacity to 0? I am using 21.1
 
Back
Top