• 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 Conquest 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.

[Essentials v16.2+] Overworld Shadows

WolfPP

Spriter/ Pixel Artist
  • 1,308
    Posts
    6
    Years
    [PokeCommunity.com] [Essentials v16.2+] Overworld Shadows

    I made a new Shadow Overworld, fixing '$game_switches' and dependent events bugs. Let's go!

    First, save this image (called by shadow) inside Character folder:
    [PokeCommunity.com] [Essentials v16.2+] Overworld Shadows


    If you are using v16.2 check here.

    Now, find 'Sprite_WaterReflection' script and below that script, add a new script called "Sprite_ShadowOverworld" (or whatever you want) and paste this code inside the new script:
    Spoiler:


    Now, find 'Sprite_Character' script. Then:
    Spoiler:


    To the event doesn't works (won't show the shadow effect) you need to put a Comment NoShadow inside the event, to each page. Example to (healing balls events, inside Poke Center Map):
    Spoiler:


    JUST A P.S. DON'T COPY:
    That is the code to check if event are walking into surfing base or grass tile or water reflection tile (to remove the shadow effect). You can add more if you want to:
    Code:
        currentTag = pbGetTerrainTag(event)
        if PBTerrain.isGrass?(currentTag) || PBTerrain.hasReflections?(currentTag) ||
          PBTerrain.isSurfable?(currentTag)
          # Just-in-time disposal of sprite 
          if @sprite
            @sprite.dispose
            @sprite = nil
          end
          return
        end

    Thanks Marin for the code about jump scene.
    Thanks MGriffin for help me about jump scene.

    Give credits to me (WolfPP) and Marin (because i copied his "jump scene" into Shadow Overworld script) if use.

    Cya!
     
    Last edited:
    Getting a syntax error on line 82. Though I don't seem to find anything wrong.

    Any idea why that might be happening?
     
    Getting a syntax error on line 82. Though I don't seem to find anything wrong.

    Any idea why that might be happening?

    A single '(' into the beginning:

    Code:
    if [B][I][U][SIZE="2"]([/SIZE][/U][/I][/B]PBTerrain.isGrass?(currentTag) || PBTerrain.hasReflections?(currentTag) ||
          PBTerrain.isSurfable?(currentTag)

    I already removed into the main code. Copy and paste again.
     
    You should make a code like this for Foot prints also!
    My best wishes 👍👍
     
    Could you help me
    currentTag = pbGetTerrainTag(event)
    if PBTerrain.isGrass?(currentTag) || PBTerrain.hasReflections?(currentTag) ||
    PBTerrain.isSurfable?(currentTag)
    # Just-in-time disposal of sprite
    if @sprite
    @sprite.dispose
    @sprite = nil
    end
    return
    end

    Where should I put this script part?
     
    Could you help me


    Where should I put this script part?
    Code:
    [B][I][U]That is the code to check if event are walking into surfing base or grass tile or water reflection tile (to remove the shadow effect). You can add more if you want to:[/U][/I][/B]

    Nowhere. I just explained if you want to put more terraing tag to the shadow effects disappears.
     
    ATT:
    Inside 'def update', remove 'return if event!=$game_player && pbEventCommentInput(event,0,"NoShadow")' and then, paste '@sprite.visible=false if event!=$game_player && pbEventCommentInput(event,0,"NoShadow")' below 'if @sprite'.

    Atted the main script.

    EDIT: Better one. Inside 'def update', just replace for the code:
    Code:
        if event.character_name =="" || event.character_name == "nil" ||
          (PBTerrain.isGrass?(currentTag) || PBTerrain.hasReflections?(currentTag) || 
          event!=$game_player && PBTerrain.isSurfable?(currentTag)) [B][I][U]||
          event!=$game_player && pbEventCommentInput(event,0,"NoShadow")[/U][/I][/B]
          # Just-in-time disposal of sprite 
          if @sprite
            @sprite.dispose
            @sprite = nil
          end
          return
        end
     
    Last edited:
    ATT:
    Inside 'def update', remove 'return if event!=$game_player && pbEventCommentInput(event,0,"NoShadow")' and then, paste '@sprite.visible=false if event!=$game_player && pbEventCommentInput(event,0,"NoShadow")' below 'if @sprite'.

    Atted the main script.

    EDIT: Better one. Inside 'def update', just replace for the code:
    Code:
        if event.character_name =="" || event.character_name == "nil" ||
          (PBTerrain.isGrass?(currentTag) || PBTerrain.hasReflections?(currentTag) || 
          event!=$game_player && PBTerrain.isSurfable?(currentTag)) [B][I][U]||
          event!=$game_player && pbEventCommentInput(event,0,"NoShadow")[/U][/I][/B]
          # Just-in-time disposal of sprite 
          if @sprite
            @sprite.dispose
            @sprite = nil
          end
          return
        end

    Great, now it works perfectly, thanks :D
     
    WolfPP can you post the Marin overworld shadow codes that we should remove from the pokemon following script, if we want to use yours instead? Some guys and me don't understand well what lines should be removed. And when i've tried alone, i've got errors, because, maybe i don't removed it well. Sorry for the trouble. XD
     
    WolfPP can you post the Marin overworld shadow codes that we should remove from the pokemon following script, if we want to use yours instead? Some guys and me don't understand well what lines should be removed. And when i've tried alone, i've got errors, because, maybe i don't removed it well. Sorry for the trouble. XD

    Everything.
     
    I noticed a bug. You see the lower part of the shadows?
    Spoiler:
     
    Last edited:
    You need to change the priority on the database editor (the one for changing the flags, the terrain codes of the tilesets etc.).


    EDIT: The shadow appears only on tiles that have a priority of 1. All tiles where you can step have a priority of 1. Since you can't walk into the walls, Essentials set the priority of 1 where you can't walk or appear (the last tilesets of the house have a priority of 2 or 3, so the player will be under the tileset, and with a priority of 1 he will be over the tileset).
     
    Last edited:
    Ooof, some things are changed from old versions of Essentials, I'm sorry. SO, you need to set the priority of the internal house tilesets to 1.
     
    Ok. Thanks!

    EDIT: By the way, I included the functionality of Marin that automatically deactivates shadow if the name of the event contains a string that you define:
    Code:
    # In order for the shadow to be invisible, the name of the event must 
    # contain a string that is defined in No_Shadow_If_Event_Name_Has, or having 
    # a comment containing the exact string NoShadow (case sensitive for the comment).
    
    # Extending so we can access some private instance variables.
    class Game_Character
      attr_reader :jump_count
      attr_reader :name 
    end
    
    class Sprite_ShadowOverworld
      attr_reader :visible
      attr_accessor :event
        
      def initialize(sprite,event,viewport=nil)
        @rsprite  = sprite
        @sprite   = nil
        @event    = event
        @viewport = viewport
        @disposed = false
        @shadowoverworldbitmap = AnimatedBitmap.new("Graphics/Characters/shadow")
        @cws = @shadowoverworldbitmap.height*2
        @chs = @shadowoverworldbitmap.height*2
        update
      end
    
      def dispose; if !@disposed; @sprite.dispose if @sprite; @sprite = nil; @disposed = true; end; end
    
      def disposed?; @disposed; end
        
      No_Shadow_If_Event_Name_Has = [
        "door",
        "nurse",
        "healing balls",
        "Mart",
        "boulder",
        "tree",
        "HeadbuttTree",
       # etc
      ]
      
      def ShouldGetShadow?
        return false if event.character_name =="" || event.character_name == "nil" ||
                       (PBTerrain.isGrass?(pbGetTerrainTag(event)) || 
                       PBTerrain.hasReflections?(pbGetTerrainTag(event)) || 
                       PBTerrain.isSurfable?(pbGetTerrainTag(event)) || 
                       PBTerrain.isIce?(pbGetTerrainTag(event))) ||
                      (event!=$game_player && pbEventCommentInput(event,0,"NoShadow"))
        if event.name != nil
          name=event.name.dup
          name.downcase!
          No_Shadow_If_Event_Name_Has.each do |e|
            e.downcase!
            return false  if name.include?(e)
          end
        end
        return true
      end
        
      def jump_sprite
        return unless @sprite
        x = (@event.real_x - @event.map.display_x + 3) / 4 + (Game_Map::TILEWIDTH / 2)
        y = (@event.real_y - @event.map.display_y + 3) / 4 + (Game_Map::TILEHEIGHT)
        @totaljump = @event.jump_count if !@totaljump
        case @event.jump_count
        when 1..(@totaljump / 3); @sprite.zoom_x += 0.1; @sprite.zoom_y += 0.1
        when (@totaljump / 3 + 1)..(@totaljump / 3 + 2); @sprite.zoom_x += 0.05; @sprite.zoom_y += 0.05
        when (@totaljump / 3 * 2 - 1)..(@totaljump / 3 * 2); @sprite.zoom_x -= 0.05; @sprite.zoom_y -= 0.05
        when (@totaljump / 3 * 2 + 1)..(@totaljump); @sprite.zoom_x -= 0.1; @sprite.zoom_y -= 0.1
        end
        if @event.jump_count == 1; @sprite.zoom_x = 1.0; @sprite.zoom_y = 1.0; @totaljump = nil; end
        @sprite.x = x; @sprite.y = y; @sprite.z = @rsprite.z - 1
      end
    
      def visible=(value); @visible = value; @sprite.visible = value if @sprite && [email protected]?; end
    
      def update
        return if disposed? || !$scene || !$scene.is_a?(Scene_Map)
        return jump_sprite if event.jumping?
        if !ShouldGetShadow?
          # 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
          @sprite.bitmap = @shadowoverworldbitmap.bitmap; cw = @cws; ch = @chs
          @sprite.x       = @rsprite.x
          @sprite.y       = @rsprite.y
          @sprite.ox      = cw/2 -1
          @sprite.oy      = ch - 15  # original:  @sprite.oy      = ch - 18
          @sprite.z       = @rsprite.z-1
          @sprite.zoom_x  = @rsprite.zoom_x
          @sprite.zoom_y  = @rsprite.zoom_y
          @sprite.tone    = @rsprite.tone
          @sprite.color   = @rsprite.color
          @sprite.opacity = @rsprite.opacity
        end
      end
    end
     
    Last edited:
    I think this code will lag a little more the game, you know?
    Code:
    if event.name != nil
          name=event.name.dup
          name.downcase!
          No_Shadow_If_Event_Name_Has.each do |e|
            e.downcase!
            return false if name.include?(e)
          end
        end

    I will work into other script for that case. Thanks anyway!

    Done. Replace the script for:
    Spoiler:


    ATTED THE MAIN POST.
     
    Last edited:
    Man, that doesn't work. I believe that is because you are checking character_name, which is not the name of the event.
     
    Last edited:
    Back
    Top