赞 | 1 |
VIP | 16 |
好人卡 | 23 |
积分 | 0 |
经验 | 49509 |
最后登录 | 2016-1-9 |
在线时间 | 2459 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 48
- 在线时间
- 2459 小时
- 注册时间
- 2011-12-18
- 帖子
- 1484
|
本帖最后由 a364774426 于 2012-9-23 10:12 编辑
说起来,也就是那样的效果了。给你两个脚本。
脚本一:- #==============================================================================
- # ** Spriteset_Map
- #------------------------------------------------------------------------------
- # This class brings together map screen sprites, tilemaps, etc. It's used
- # within the Scene_Map class.
- #==============================================================================
- class Spriteset_Map
- #--------------------------------------------------------------------------
- # * Object Initialization
- #--------------------------------------------------------------------------
- def initialize
- #GROUND OVERLAY#
- @GroundON = FileTest.exist?("Overlays/" + "ground" + $game_map.map_id.to_s + ".png")
- create_viewports
- create_tilemap
- create_parallax
- create_characters
- create_shadow
- create_weather
- create_pictures
- create_timer
- update
- end
- #--------------------------------------------------------------------------
- # * Create Viewport
- #--------------------------------------------------------------------------
- def create_viewports
- @viewport1 = Viewport.new(0, 0, 800, 480)
- @viewport2 = Viewport.new(0, 0, 800, 480)
- @viewport3 = Viewport.new(0, 0, 800, 480)
- @viewport2.z = 50
- @viewport3.z = 100
- @viewport7 = Viewport.new(0, 0, 800, 480)
- end
- #--------------------------------------------------------------------------
- # * Create Tilemap
- #--------------------------------------------------------------------------
- def create_tilemap
- @tilemap = Tilemap.new(@viewport1)
- @tilemap.bitmaps[0] = Cache.system("TileA1")
- @tilemap.bitmaps[1] = Cache.system("TileA2")
- @tilemap.bitmaps[2] = Cache.system("TileA3")
- @tilemap.bitmaps[3] = Cache.system("TileA4")
- @tilemap.bitmaps[4] = Cache.system("TileA5")
- @tilemap.bitmaps[5] = Cache.system("TileB")
- @tilemap.bitmaps[6] = Cache.system("TileC")
- @tilemap.bitmaps[7] = Cache.system("TileD")
- @tilemap.bitmaps[8] = Cache.system("TileE")
- @tilemap.map_data = $game_map.data
- @tilemap.passages = $game_map.passages
- end
- #--------------------------------------------------------------------------
- # * Create Parallax
- #--------------------------------------------------------------------------
- def create_parallax
- if @GroundON
- @ground = Plane.new(@viewport1)
- @ground.z = 255
- @ground.bitmap = Cache.overlay("ground" + $game_map.map_id.to_s)
- end
- #end HANZO
- @parallax = Plane.new(@viewport1)
- @parallax.z = -100
- end
- #--------------------------------------------------------------------------
- # * Create Character Sprite
- #--------------------------------------------------------------------------
- def create_characters
- @character_sprites = []
- for i in $game_map.events.keys.sort
- sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
- @character_sprites.push(sprite)
- end
- for vehicle in $game_map.vehicles
- sprite = Sprite_Character.new(@viewport1, vehicle)
- @character_sprites.push(sprite)
- end
- @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
- end
- #--------------------------------------------------------------------------
- # * Create Airship Shadow Sprite
- #--------------------------------------------------------------------------
- def create_shadow
- @shadow_sprite = Sprite.new(@viewport1)
- @shadow_sprite.bitmap = Cache.system("Shadow")
- @shadow_sprite.ox = @shadow_sprite.bitmap.width / 2
- @shadow_sprite.oy = @shadow_sprite.bitmap.height
- @shadow_sprite.z = 180
- end
- #--------------------------------------------------------------------------
- # * Create Weather
- #--------------------------------------------------------------------------
- def create_weather
- @weather = Spriteset_Weather.new(@viewport2)
- end
- #--------------------------------------------------------------------------
- # * Create Picture Sprite
- #--------------------------------------------------------------------------
- def create_pictures
- @picture_sprites = []
- for i in 1..20
- @picture_sprites.push(Sprite_Picture.new(@viewport2,
- $game_map.screen.pictures[i]))
- end
- end
- #--------------------------------------------------------------------------
- # * Create Timer Sprite
- #--------------------------------------------------------------------------
- def create_timer
- @timer_sprite = Sprite_Timer.new(@viewport2)
- end
- #--------------------------------------------------------------------------
- # * Dispose
- #--------------------------------------------------------------------------
- def dispose
- dispose_tilemap
- dispose_parallax
- dispose_characters
- dispose_shadow
- dispose_weather
- dispose_pictures
- dispose_timer
- dispose_viewports
- end
- #--------------------------------------------------------------------------
- # * Dispose of Tilemap
- #--------------------------------------------------------------------------
- def dispose_tilemap
- @tilemap.dispose
- end
- #--------------------------------------------------------------------------
- # * Dispose of Parallax
- #--------------------------------------------------------------------------
- def dispose_parallax
- if @ground != nil
- @ground.dispose
- end
- if @par != nil
- @par.dispose
- end
- @parallax.dispose
- end
- #--------------------------------------------------------------------------
- # * Dispose of Character Sprite
- #--------------------------------------------------------------------------
- def dispose_characters
- for sprite in @character_sprites
- sprite.dispose
- end
- end
- #--------------------------------------------------------------------------
- # * Dispose of Airship Shadow Sprite
- #--------------------------------------------------------------------------
- def dispose_shadow
- @shadow_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # * Dispose of Weather
- #--------------------------------------------------------------------------
- def dispose_weather
- @weather.dispose
- end
- #--------------------------------------------------------------------------
- # * Dispose of Picture Sprite
- #--------------------------------------------------------------------------
- def dispose_pictures
- for sprite in @picture_sprites
- sprite.dispose
- end
- end
- #--------------------------------------------------------------------------
- # * Dispose of Timer Sprite
- #--------------------------------------------------------------------------
- def dispose_timer
- @timer_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # * Dispose of Viewport
- #--------------------------------------------------------------------------
- def dispose_viewports
- @viewport1.dispose
- @viewport2.dispose
- @viewport3.dispose
- end
- #--------------------------------------------------------------------------
- # * Frame Update
- #--------------------------------------------------------------------------
- def update
- update_tilemap
- update_parallax
- update_characters
- update_shadow
- update_weather
- update_pictures
- update_timer
- update_viewports
- end
- #--------------------------------------------------------------------------
- # * Update Tilemap
- #--------------------------------------------------------------------------
- def update_tilemap
- @tilemap.ox = $game_map.display_x / 8
- @tilemap.oy = $game_map.display_y / 8
- @tilemap.update
- end
- #--------------------------------------------------------------------------
- # * Update Parallax
- #--------------------------------------------------------------------------
- def update_parallax
- #HANZO Ground Overlay
- if @ground != nil
- @ground.tone = $game_map.screen.tone
- 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 #./
- if @parallax_name != $game_map.parallax_name
- @parallax_name = $game_map.parallax_name
- if @parallax.bitmap != nil
- @parallax.bitmap.dispose
- @parallax.bitmap = nil
- end
- if @parallax_name != ""
- @parallax.bitmap = Cache.parallax(@parallax_name)
- end
- Graphics.frame_reset
- end
- @parallax.ox = $game_map.calc_parallax_x(@parallax.bitmap)
- @parallax.oy = $game_map.calc_parallax_y(@parallax.bitmap)
- end
- #--------------------------------------------------------------------------
- # * Update Character Sprite
- #--------------------------------------------------------------------------
- def update_characters
- for sprite in @character_sprites
- sprite.update
- end
- end
- #--------------------------------------------------------------------------
- # * Update Airship Shadow Sprite
- #--------------------------------------------------------------------------
- def update_shadow
- airship = $game_map.airship
- @shadow_sprite.x = airship.screen_x
- @shadow_sprite.y = airship.screen_y + airship.altitude
- @shadow_sprite.opacity = airship.altitude * 8
- @shadow_sprite.update
- end
- #--------------------------------------------------------------------------
- # * Update Weather
- #--------------------------------------------------------------------------
- def update_weather
- @weather.type = $game_map.screen.weather_type
- @weather.max = $game_map.screen.weather_max
- @weather.ox = $game_map.display_x / 8
- @weather.oy = $game_map.display_y / 8
- @weather.update
- end
- #--------------------------------------------------------------------------
- # *Update Picture Sprite
- #--------------------------------------------------------------------------
- def update_pictures
- for sprite in @picture_sprites
- sprite.update
- end
- end
- #--------------------------------------------------------------------------
- # * Update Timer Sprite
- #--------------------------------------------------------------------------
- def update_timer
- @timer_sprite.update
- end
- #--------------------------------------------------------------------------
- # * Update Viewport
- #--------------------------------------------------------------------------
- def update_viewports
- @viewport1.tone = $game_map.screen.tone
- @viewport1.ox = $game_map.screen.shake
- @viewport2.color = $game_map.screen.flash_color
- @viewport3.color.set(0, 0, 0, 255 - $game_map.screen.brightness)
- @viewport1.update
- @viewport2.update
- @viewport3.update
- end
- end
复制代码 脚本二:- ####################################################################
- # AutoLight v3.7
- # By: SojaBird
- # Site: [url]http://www.nestcast.blogspot.com[/url]
- # Discription: AutoLight is based on selfmade pictures wich represent the lights
- # and shadows of every map. AutoLight also has a spot-mode wich
- # causes to show a spot over the players position so that only
- # close serounding area is enlighted.
- ####################################################################
- =begin
- #####
- -------------------------
- How to call script?
- -------------------------
- 1)
- First of all, when you're going to changes something of AutoLight by calling
- the script, you have to get rid of the old pictures. To do this call the next
- script first;
- $AutoLight.dispose
-
- Now you can change any value from the setup below by calling the script;
- SojaBird_AL::X
- X is the option you want to changes.
-
- After you've done made all the changes you wanted, call the script to draw the
- pictures again;
- $AutoLight.paint
-
- ~EXAMPLE 1~
- So I want to changes the name of my pictures I'm using for the lights from
- "Light" to "Light2". Also I want to get rid of the shadows. My call script
- event should look like this;
- $AutoLight.dispose
- SojaBird_AL::LightMap = "Light2"
- SojaBird_AL::UseShadow = false
- $AutoLight.paint
- ~END 1~
-
-
- 2)
- A little harder is it, when you want to add a certain amount. What you must do
- is call the script;
- @temp = SojaBird_AL::X
- SojaBird_AL::X = @temp + Y
- X is the option you want to changes.
- Y is the amount you want to add.
-
- The same script is used for subtract, multiply, divide and all other
- mathematical calculations.
- (!Tip: Insted of '@temp', you can use whatever text as long as it has '@'
- infront of it.)
-
- ~EXAMPLE 2~
- This time I want to push up the opacity of my lights with, say like 5
- everytime the script is called. I also want the shadows to decrease with 3.
- My call script event should look like this;
- $AutoLight.dispose
- @temp = SojaBird_AL::LightOpacity
- SojaBird_AL::LightOpacity = @temp + 5
- @temp = SojaBird_AL::ShadowOpacity
- SojaBird_AL::ShadowOpacity = @temp - 3
- $AutoLight.paint
- ~END 2~
-
-
- 3)
- To use variables as a value for sertain options from AutoLight, you'll have to
- use the next script;
- SojaBird_AL::X = $game_variables[Z]
- X is the option you want to changes.
- Z is the variable number.
-
- ~EXAMPLE 3~
- I want to make a variable lightsource so that the player can change the
- values to his/her desire. To realize this, the opacity of the lights need to
- be set by a variable. I'll use 1. The call script event should look like this;
- $AutoLight.dispose
- SojaBird_AL::LightOpacity = $game_variables[1]
- $AutoLight.paint
- ~END 3~
-
-
- 4)
- Now if I want to add a variable to a sertain fixed amount, I have to use points
- 2 and 3 together. The script that must be used is this;
- @temp = SojaBird_AL::X
- SojaBird_AL::X = @temp + $game_variables[Z]
- X is the option you want to changes.
- Z is the variable number.
-
- The same script is used for subtract, multiply, divide and all other
- mathematical calculations.
- (!Tip: Insted of '@temp', you can use whatever text as long as it has '@'
- infront of it.)
-
- ~EXAMPLE 4~
- The flicker of my spot needs to be adjustable by the player. Though, I don't
- want the player to be able to turn it of by set the value of the flicker to 1
- or less. To ensure this, I'll set the flicker in the setup to 5 so that it
- standard flickers 5 pixels. Now the player can add extra flicker to the spot
- by useing setting the variable number 2. My call script event looks like this;
- $AutoLight.dispose
- @temp = SojaBird_AL::SpotFlicker
- SojaBird_AL::SpotFlicker = @temp + $game_variables[2]
- $AutoLight.paint
- ~END 4~
-
- 5)
- >>> MORE TO COME SOON <<<
-
- #####
- =end
- ####################################################################
- # Start Setup
- ####################################################################
- module SojaBird_AL
- Mode = 1 # The mode that autolight uses (Light/Shadow=1, Spot=2, 3=Both, 0=Nothing).
- PictureFormat = "png" # The fileformat of the pictures. Eg. "jpg" or "png" ("...").
-
- ### WHEN MODE = 1 or 3 ###
- LightSwitch = 1 # Number of the switch to show/hide the lightpicture.
- ShadowSwitch = 1 # Number of the switch to show/hide the shadowpicture.
- ParSwitch = 1
- GroundSwitch = 1
-
- LightOpacity = 115 # Opacity of the lightpictures (0-255).
- ShadowOpacity = 145 # Opacity of the shadowpictures (0-255).
- ParOpacity = 255
- GroundOpacity = 255
-
- UseLight = true # Wheter or not to use a lightmaps (true/false).
- UseShadow = true # Wheter or not tu se shadowmaps (true/false).
- UsePar = true
- UseGround = true
-
- LightMap = "Light" # The name of the files with the lights ("...").
- ShadowMap = "Shadow" # The name of the files with the shadows ("...").
- ParMap = "Par"
- GroundMap = "Ground"
-
- LightBlend = 1 # Blending of the lightpicture (0=Normal, 1=More, 2=Less).
- ShadowBlend = 2 #Blending of the shadowpicture (0=Normal, 1=More, 2=Less).
- ParBlend = 0
- GroundBlend = 0
-
- LightFlicker = 1 # Amount of flicker the lights have (<2=No flicker, >1=Flicker).
- ShadowFlicker = 0 # Amount of flicker the shadows have (<2=No flicker, >1=Flicker).
-
- # The light- and shadowmaps need to have the map ID at the end of the by you
- # choosen name!
- ### WHEN MODE = 2 or 3 ###
- SpotSwitch = 1 # Number of the swtich to show/hide the spotpicture.
-
- SpotOpacity = 255 # Opacity of the spotpicture (value=0-255).
-
- SpotMap = "Spot" # Name of the file with the spot ("...").
-
- SpotBlend = 2 # Blending of the spotpicture (0=Normal, 1=More, 2=Less).
- SpotFlicker = 2 # Amount of flicker the spot has (<2=No flicker, >1=Flicker).
-
- # The spotpicture should have the size of 1088*832!
- end
- ####################################################################
- # End Setup
- ####################################################################
- ##############################
- if SojaBird_AL::Mode != 0
- class Scene_Map < Scene_Base
- alias al_start start
- ##############################
- def start
- al_start
- $AutoLight = AutoLight.new
- end
- ###############
- def terminate
- super
- if $scene.is_a?(Scene_Battle)
- @spriteset.dispose_characters
- end
- snapshot_for_background
- @spriteset.dispose
- @message_window.dispose
- $AutoLight.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
- $AutoLight.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
- var_ID = 21
-
-
- case $game_variables[var_ID]
- when 1 # Normaln transfer
- normal_transfer
- when 2 # Fadeless transfer
- fadeless_transfer
- when 3 # White screen transfer
- white_screen_transfer
- end
- 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
- $AutoLight.dispose
- $AutoLight = AutoLight.new
- fadein(30) if fade
- Input.update
- end
- ##############################
- end
- ##############################
- ############################################################
- ##############################
- class AutoLight
- include SojaBird_AL
- ##############################
- def initialize
- file_check
- paint
- end
-
- def file_check
- @LightON = FileTest.exist?("Overlays/" + LightMap + $game_map.map_id.to_s + "." + PictureFormat)
- @ShadowON = FileTest.exist?("Overlays/" + ShadowMap + $game_map.map_id.to_s + "." + PictureFormat)
- @SpotON = FileTest.exist?("Overlays/" + SpotMap + "." + PictureFormat)
- @ParON = FileTest.exist?("Overlays/" + ParMap + $game_map.map_id.to_s + ".png")
- end
-
- def paint
- case Mode
- when 1, 3
- if @LightON
- if UseLight == true
- @light_viewport = Viewport.new(0, 0, 800, 480)
- @light_viewport.z = 9
- @light = Sprite.new(@light_viewport)
- @light.bitmap = Cache.overlay(LightMap + $game_map.map_id.to_s)
- @light.z = 10
- @light.opacity = LightOpacity
- @light.blend_type = LightBlend
- @light.visible = $game_switches[LightSwitch]
- end
- end
- if @ShadowON
- if UseShadow == true
- @shadow_viewport = Viewport.new(0, 0, 800, 480)
- @shadow_viewport.z = 10
- @shadow = Sprite.new(@shadow_viewport)
- @shadow.bitmap = Cache.overlay(ShadowMap + $game_map.map_id.to_s)
- @shadow.z = 9
- @shadow.opacity = ShadowOpacity
- @shadow.blend_type = ShadowBlend
- @shadow.visible = $game_switches[ShadowSwitch]
- end
- end
- if @ParON
- if UsePar == true
- @par_viewport = Viewport.new(0, 0, 800, 480)
- @par_viewport.z = 8
- @par = Plane.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 = ParOpacity
- @par.blend_type = ParBlend
- @par.visible = $game_switches[ParSwitch]
- end
- end
- when 2, 3
- if @SpotON
- @spot_viewport = Viewport.new(0, 0, 800, 480)
- @spot = Sprite.new(@spot_viewport)
- @spot.bitmap = Cache.picture(SpotMap)
- @spot.z = 9
- @spot.opacity = SpotOpacity
- @spot.blend_type = SpotBlend
- @spot.visible = $game_switches[SpotSwitch]
- end
- end
- update
- end
- ###############
- def update
- case Mode
- when 2, 3
- if @spot != nil
- @spot.visible = $game_switches[SpotSwitch]
- @spot.x = ($game_player.real_x / 8) - ($game_map.display_x / 8) - 800 + 16 + rand(SpotFlicker)
- @spot.y = ($game_player.real_y / 8) - ($game_map.display_y / 8) - 480 + 16 + rand(SpotFlicker)
- end #./
- when 1, 3
- 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 @ground != nil
- @ground.visible = $game_switches[GroundSwitch]
- end #./
- if @light != nil
- @light.tone = $game_map.screen.tone
- 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 + rand(LightFlicker)
- @light.oy = $game_map.display_y / 8 + rand(LightFlicker)
- end #./
- end #./
- if @shadow != nil
- @shadow.tone = $game_map.screen.tone
- 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 + rand(ShadowFlicker)
- @shadow.oy = $game_map.display_y / 8 + rand(ShadowFlicker)
- end #./
- end #./
- if @par != nil
- @par.tone = $game_map.screen.tone
- 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 #case end
- end #def end
- ###############
- def dispose
- case Mode
- when 1, 3
- 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
- when 2, 3
- if @spot != nil
- @spot_viewport.dispose
- @spot.dispose
- end
- end
- end
- ##############################
- end
- end
- ##############################
复制代码 使用方法:在工程文件夹中新建一个名为“Overlays”的文件夹。其中装的是LZ你需要的两种图片。其一是优先度在角色上方的,例如:
我将此图片命名为par25,意思是这张图片会在ID为25的地图中以优先度在角色上方出现。
其二是:图片略,我目前还不需要,所以没有做。命名格式为groundXX,作为优先度在角色下方的图片。其中XX与之前的25同义。
PS:想要做出华丽效果的地图,那么心血无疑是要花费很多的。LZ自己考虑得失哈。对了,par类型图片要产生效果需要打开一号开关。
效果游戏开始前一号开关就打开的话,按下面图片添加一句代码:
。前提是你没有使用美化标题类的脚本。��� |
|