Help - Search - Members - Calendar
Full Version: questions about hanzos ultimate overlay script
RPG RPG Revolution Forums > Scripting > Script Development and Support > RGSS2
demonprince27
sorry to bother u guys but the other day i downloaded a demo for (Hanzo Kimura's ultimate map overlay) and it seem s perfect for what im trying to do the problem is i am not a scripter and in the demo it show's a image file saying how the layers should be named but i do not understand how to make it work for diffrent maps i can only seem to get it to work on my first map how/where do i add in the [map id] to choose between diffrent maps do i add lines of code per map to the script?and how would i have to name each overlay? i am totaly lost plz help i think i would be able to figure this out if his demo had 2 maps with overlays but woth it not im clueless.

says files names should be like so

layers in order from top to bottom

lightlayer (filename:light[map id].jpg

shadow layer (filename:shadow[map id].jpg

parallax layer (filename:par[map id].png

ground layer (filename:ground[map id].png


looking at the script i figured the setup would look like this

lightmap=(name of light overlay u want)+[map id].jpg = display lightoverlay on map
so
lightmap ( map2light )[map2] is what comes into my head but where do i put this? in the script under filenames?

like i said not a scripter so dont like changing scripts unless i know what im doing this time its beond me only been messing with script and coding for a little while and self taught so sorry if im a idiot atm

i would give examples of the other 3 layers but im pretty sure if i can get 1 layer to work i can get the rest


here is hanzo's overlay code all credits to hanzo kimura the demo was distriputed freely so i dont think any 1 will get upset if i post this here and i dont think it violates forum rules i hope not

CODE
#==============================================================================
#              U L T I M A T E    O V E R L A Y    M A P P I N G
#                           Script By: Hanzo Kimura
#                            Date Created: 08/11/10
#==============================================================================
module HK_UOM
  
#=================================== SET UP ===================================#
# SCREEN SETUP
  Width   = 544           # The Size of Resolution (Screen's Width)  544/640
  Height  = 416           # The Size of Resolution (Screen's Height) 416/480
# SWITCHES
  LightSwitch = 1         #Switch to Activate Light Overlays
  ShadowSwitch = 2        #Switch to Activate Shadow Overlays
  ParSwitch = 1           #Switch to Activate Parallax Overlays
  GroundSwitch = 1        #Switch to Activate Ground Overlays
# FILENAMES
  LightMap = "Light"      #The name of the file for Light Overlays
  ShadowMap = "Shadow"    #The name of the file for Shadow Overlays
  ParMap = "Par"          #The name of the file for Parallax Overlays
  GroundMap = "Ground"    #The name of the file for Ground Overlays

#================================ END OF SET UP ===============================#
end


# OVERLAY SCRIPT STARTS HERE #
module Cache
  def self.overlay(filename)
    load_bitmap("Overlays/", filename)
  end
end
class Spriteset_Map
  include HK_UOM
  alias hk_uom_initialize initialize
  def initialize
    @GroundON = FileTest.exist?("Overlays/" + "ground" + $game_map.map_id.to_s + ".png")
    hk_uom_initialize
    update
  end
  alias hk_uom_create_parallax create_parallax
  def create_parallax
    if @GroundON
      @ground = Sprite.new(@viewport1)
      @ground.z = 1
      @ground.bitmap = Cache.overlay("ground" + $game_map.map_id.to_s)
    end
    hk_uom_create_parallax
  end
  alias hk_uom_dispose_parallax dispose_parallax
  def dispose_parallax
    if @ground != nil
     @ground.dispose
   end
    hk_uom_dispose_parallax
end
   alias hk_uom_update_parallax update_parallax
   def update_parallax
    if @ground != nil
        @ground.visible = $game_switches[GroundSwitch]
    end
    if @ground != nil
        @ground.tone = $game_map.screen.tone
        @viewport1.ox = $game_map.screen.shake  #update shake screen
        @viewport1.color = $game_map.screen.flash_color #update flash screen
        if @ground.ox != -$game_map.display_x / 256 or @ground.oy != -$game_map.display_y / 256 or @ground.ox == 0 or @ground.oy == 0
          @ground.ox = $game_map.display_x / 8
          @ground.oy = $game_map.display_y / 8
        end
      end
    hk_uom_update_parallax
    end
end
#==============================================================================
# Scene Map
#==============================================================================
class Scene_Map < Scene_Base
  alias hk_uom_start start
  def start
    hk_uom_start
    $OverlayMap = Overlay_Map.new
  end
  def terminate
    super
    if $scene.is_a?(Scene_Battle)
      @spriteset.dispose_characters
    end
    snapshot_for_background
    @spriteset.dispose
    @message_window.dispose
    $OverlayMap.dispose
    if $scene.is_a?(Scene_Battle)
      perform_battle_transition
    end
  end
  def update
    super
    $game_map.interpreter.update
    $game_map.update
    $game_player.update
    $game_system.update
    @spriteset.update
    @message_window.update
    $OverlayMap.update
    unless $game_message.visible
      update_transfer_player
      update_encounter
      update_call_menu
      update_call_debug
      update_scene_change
    end
  end
  def update_transfer_player
    return unless $game_player.transfer?
    fade = (Graphics.brightness > 0)
    fadeout(30) if fade
    @spriteset.dispose
    $game_player.perform_transfer
    $game_map.autoplay
    $game_map.update
    Graphics.wait(15)
    @spriteset = Spriteset_Map.new
    $OverlayMap.dispose
    $OverlayMap = Overlay_Map.new
    fadein(30) if fade
    Input.update
  end
end
#==============================================================================
# Overlay
#==============================================================================
class Overlay_Map
include HK_UOM
  def initialize
    check_file
    display_overlay
  end
  def check_file
    @LightON = FileTest.exist?("Overlays/" + LightMap + $game_map.map_id.to_s + ".jpg")
    @ShadowON = FileTest.exist?("Overlays/" + ShadowMap + $game_map.map_id.to_s + ".jpg")
    @ParON = FileTest.exist?("Overlays/" + ParMap + $game_map.map_id.to_s + ".png")
    @GroundON = FileTest.exist?("Overlays/" + GroundMap + $game_map.map_id.to_s + ".png")
  end
  
  # Displaying Overlays SET UP #
  def display_overlay
    if @LightON
      @light_viewport = Viewport.new(0, 0, Width, Height)
      @light_viewport.z = 10
      @light = Sprite.new(@light_viewport)
      @light.bitmap = Cache.overlay(LightMap + $game_map.map_id.to_s)
      @light.z = 10
      @light.opacity = 115
      @light.blend_type = 1
      @light.visible = $game_switches[LightSwitch]
    end
    if @ShadowON
      @shadow_viewport = Viewport.new(0, 0, Width, Height)
      @shadow_viewport.z = 9
      @shadow = Sprite.new(@shadow_viewport)
      @shadow.bitmap = Cache.overlay(ShadowMap + $game_map.map_id.to_s)
      @shadow.z = 9
      @shadow.opacity = 85
      @shadow.blend_type = 2
      @shadow.visible = $game_switches[ShadowSwitch]
      end
    if @ParON
      @par_viewport = Viewport.new(0, 0, Width, Height)
      @par_viewport.z = 8
      @par = Sprite.new(@par_viewport)
      @par.z = 8
      @par.bitmap = Cache.overlay(ParMap + $game_map.map_id.to_s)
      @par.tone = $game_map.screen.tone
      @par.opacity = 255
      @par.blend_type = 0
      @par.visible = $game_switches[ParSwitch]
    end
    update
  end
  
  # Update Overlays SET UP #
  def update
      if @light != nil
        @light.visible = $game_switches[LightSwitch]
      end
      if @shadow != nil
        @shadow.visible = $game_switches[ShadowSwitch]
      end
      if @par != nil
        @par.visible = $game_switches[ParSwitch]
      end
      if @light != nil
        @light.tone = $game_map.screen.tone #update screentone
        @light_viewport.ox = $game_map.screen.shake #update shake screen
        @light_viewport.color = $game_map.screen.flash_color #update flash screen
        if @light.x != $game_map.display_x / 256 or @light.y != $game_map.display_y / 256 or @light.x == 0 or @light.y == 0
          @light.ox = $game_map.display_x / 8
          @light.oy = $game_map.display_y / 8
        end #./
      end #./
      if @shadow != nil
        @shadow.tone = $game_map.screen.tone #update screentone
        @shadow_viewport.ox = $game_map.screen.shake #update shake screen
        @shadow_viewport.color = $game_map.screen.flash_color #update flash screen
        if @shadow.x != $game_map.display_x / 256 or @shadow.y != $game_map.display_y / 256 or @shadow.x == 0 or @shadow.y == 0
          @shadow.ox = $game_map.display_x / 8
          @shadow.oy = $game_map.display_y / 8
        end #./
      end #./
      if @par != nil
        @par.tone = $game_map.screen.tone #update screentone
        @par_viewport.ox = $game_map.screen.shake  #update shake screen
        @par_viewport.color = $game_map.screen.flash_color #update flash screen
        if @par.ox != $game_map.display_x / 256 or @par.oy != $game_map.display_y / 256 or @par.ox == 0 or @par.oy == 0
          @par.ox = $game_map.display_x / 8
          @par.oy = $game_map.display_y / 8
        end #./
      end #./
  end #def end
  def dispose
      if @light != nil
        @light_viewport.dispose
        @light.dispose
      end
      if @shadow != nil
        @shadow_viewport.dispose
        @shadow.dispose
      end
      if @par != nil
        @par_viewport.dispose
        @par.dispose
      end
  end
end
Night5h4d3
You put the overlay in the Overlays folder (create a new folder at the projects base folder, not in graphics) then you name it like so:
Light*.png
The star (map id) is the maps 'number, if you right click the map in the editor, then choose properties, it should be something like map001 so youd put light1.png.
Hope that helps!
demonprince27
problem solved deleted thx alot
demonprince27
okay im a moron thx alot guys for sum reason the script wouldnt exept my map id 003 but instead i had to rename shadow light par ground files to
there name with just 3 behind it like so map id is map003 but only works if i name the files shadow 3, light3,par3,ground,3 not shadow003, light003
and so on dont know why that matters but it does its fixed now though sweet thx alot.
Night5h4d3
For future reference, the reason why it wouldn't work is because ruby interprets 003 as an octal number (base 8) and expects you to include 0o as a prefix.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.