查看: 1914|回复: 4

[已经解决] 求教OverlayMappingTest怎么用

[复制链接]
梦石
0
星屑
50
在线时间
54 小时
注册时间
2013-9-23
回帖
21
发表于 2013-11-9 15:22:51 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
脚本贴到工程里了文件也丢到文件夹了,,然后应该做什么,,,

点评

你能先把脚本贴出来么,百度为您找到相关结果约835个……  发表于 2013-11-9 15:29
梦石
0
星屑
50
在线时间
54 小时
注册时间
2013-9-23
回帖
21
 楼主| 发表于 2013-11-9 15:52:07 | 显示全部楼层
那好吧。。。。。。。。。
回复

使用道具 举报

梦石
0
星屑
50
在线时间
54 小时
注册时间
2013-9-23
回帖
21
 楼主| 发表于 2013-11-9 15:54:21 | 显示全部楼层
本帖最后由 76213585 于 2013-11-9 11:24 编辑
  1. #==============================================================================
  2. #
  3. # ▼ Yami Script Ace - Overlay Mapping
  4. # -- Last Updated: 2011.12.29
  5. # -- Level: Easy
  6. # -- Requires: n/a
  7. # -- Credit: Hanzo Kimura for Original Script
  8. #
  9. #==============================================================================

  10. $imported = {} if $imported.nil?
  11. $imported["YSA-OverlayMapping"] = true

  12. #==============================================================================
  13. # ▼ Updates
  14. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  15. # 2011.12.29 - Bugfix for transfer.
  16. # 2011.12.10 - Started and Finished Script.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # This script based on Hanzo Kimura's idea. This will automatically load map's
  22. # overlay by map ID, and a map can have more than one image per layer, so you
  23. # don't have to create two or more map just for day/night or when an event occur.
  24. #
  25. #==============================================================================
  26. # ▼ Instructions
  27. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  28. # Create a folder in Graphics and name it Overlay.
  29. # Put all of your overlay into Graphics/Overlay.
  30. # Your overlay file will have the name: "Filename Prefix" + Map-ID + "-" + Number
  31. # which "Filename Prefix" is the one you will config below
  32. # Map-ID is your map's ID
  33. # Number is 1, 2, 3, ... using for Overlay Variables.
  34. #
  35. # Example: Graphics/Overlay/ground2-1.png
  36. # Which means this will be ground layer, for map 2, variable = 1
  37. #
  38. # Light/Shadow must be .jpg
  39. # Parallax/Ground must be .png
  40. #
  41. #==============================================================================

  42. module YSA
  43.   module OVERLAY
  44.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  45.     # - Overlay Switches -
  46.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  47.     # These are switches which are enable overlay layers. Turn them on to show
  48.     # them in your maps.
  49.     #--------------------------------------------------------------------------
  50.     # Default: ON
  51.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  52.     LIGHT_SWITCH = 1        # Turn on/off light layer
  53.     SHADOW_SWITCH = 2       # Turn on/off shadow layer
  54.     PARALLAX_SWITCH = 3     # Turn on/off parallax layer
  55.     GROUND_SWITCH = 4       # Turn on/off ground layer

  56.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  57.     # - Overlay Variables -
  58.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  59.     # A map can have more than one image per layer, that means you can have a
  60.     # different light/shadow for day and night, or have a different ground when
  61.     # an event occured.
  62.     #--------------------------------------------------------------------------
  63.     # Default: 1
  64.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  65.     LIGHT_VARIABLE = 2      # Switch to another light
  66.     SHADOW_VARIABLE = 2     # Switch to another shadow
  67.     PARALLAX_VARIABLE = 1   # Switch to another parallax
  68.     GROUND_VARIABLE = 1     # Switch to another ground
  69.    
  70.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  71.     # - Filename Prefix -
  72.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  73.     # This will make this script automatic, it will check if there are layers in
  74.     # overlay folder
  75.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  76.     LIGHT = "light"         # Light layer's filename prefix
  77.     SHADOW = "shadow"       # Shadow layer's filename prefix
  78.     PARALLAX = "par"        # Parallax layer's filename prefix
  79.     GROUND = "ground"       # Ground layer's filename prefix
  80.    
  81.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  82.     # - Overlay Opacity -
  83.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  84.     # This will make this script automatic, it will check if there are layers in
  85.     # overlay folder
  86.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  87.     GROUND_OPACITY = 255
  88.     PARALLAX_OPACITY = 255
  89.     LIGHT_OPACITY = 128
  90.     SHADOW_OPACITY = 96
  91.   end #OVERLAY
  92. end # YSA

  93. #==============================================================================
  94. # ▼ Editting anything past this point may potentially result in causing
  95. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  96. # halitosis so edit at your own risk.
  97. #==============================================================================

  98. #==============================================================================
  99. # ■ Cache
  100. #==============================================================================

  101. module Cache
  102.   
  103.   #--------------------------------------------------------------------------
  104.   # new method: overlay
  105.   #--------------------------------------------------------------------------
  106.   def self.overlay(filename)
  107.     load_bitmap("Graphics/Overlay/", filename)
  108.   end
  109.   
  110. end # Cache

  111. #==============================================================================
  112. # ■ DataManager
  113. #==============================================================================

  114. module DataManager
  115.   
  116.   #--------------------------------------------------------------------------
  117.   # alias method: setup_new_game
  118.   #--------------------------------------------------------------------------
  119.   class <<self; alias ovm_setup_new_game setup_new_game; end
  120.   def self.setup_new_game
  121.     ovm_setup_new_game
  122.     setup_overlay_mapping
  123.   end
  124.   
  125.   #--------------------------------------------------------------------------
  126.   # new method: setup_overlay_mapping
  127.   #--------------------------------------------------------------------------
  128.   def self.setup_overlay_mapping
  129.     # Control switches
  130.     $game_switches[YSA::OVERLAY::LIGHT_SWITCH] = true
  131.     $game_switches[YSA::OVERLAY::SHADOW_SWITCH] = true
  132.     $game_switches[YSA::OVERLAY::GROUND_SWITCH] = true
  133.     $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] = true
  134.    
  135.     # Control variables
  136.     $game_variables[YSA::OVERLAY::LIGHT_VARIABLE] = 1
  137.     $game_variables[YSA::OVERLAY::SHADOW_VARIABLE] = 1
  138.     $game_variables[YSA::OVERLAY::GROUND_VARIABLE] = 1
  139.     $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE] = 1
  140.   end
  141.   
  142. end # DataManager

  143. #==============================================================================
  144. # ■ Spriteset_Map
  145. #==============================================================================

  146. class Spriteset_Map
  147.   
  148.   #--------------------------------------------------------------------------
  149.   # alias method: initialize
  150.   #--------------------------------------------------------------------------
  151.   alias overlay_initialize initialize
  152.   def initialize
  153.     overlay_initialize
  154.     create_overlay_map
  155.     update
  156.   end
  157.   
  158.   #--------------------------------------------------------------------------
  159.   # new method: check_file
  160.   #--------------------------------------------------------------------------
  161.   def check_file(type)
  162.     filename = "Graphics/Overlay/"
  163.     filename += YSA::OVERLAY::GROUND if type == "ground"
  164.     filename += YSA::OVERLAY::LIGHT if type == "light"
  165.     filename += YSA::OVERLAY::SHADOW if type == "shadow"
  166.     filename += YSA::OVERLAY::PARALLAX if type == "par"
  167.     filename += $game_map.map_id.to_s
  168.     filename += "-" + $game_variables[YSA::OVERLAY::GROUND_VARIABLE].to_s if type == "ground"
  169.     filename += "-" + $game_variables[YSA::OVERLAY::LIGHT_VARIABLE].to_s if type == "light"
  170.     filename += "-" + $game_variables[YSA::OVERLAY::SHADOW_VARIABLE].to_s if type == "shadow"
  171.     filename += "-" + $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE].to_s if type == "par"
  172.     filename += ".jpg" if type == "light" || type == "shadow"
  173.     filename += ".png" if type == "par" || type == "ground"
  174.     return FileTest.exist?(filename)
  175.   end
  176.   
  177.   #--------------------------------------------------------------------------
  178.   # new method: create_overlay_map
  179.   #--------------------------------------------------------------------------
  180.   def create_overlay_map
  181.     w = Graphics.width
  182.     h = Graphics.height
  183.     @current_light = 0
  184.     @current_shadow = 0
  185.     @current_par = 0
  186.     @current_ground = 0
  187.     # Ground Layer
  188.     @ground = Sprite.new(@viewport1)
  189.     @ground.z = 1
  190.     @ground.opacity = YSA::OVERLAY::GROUND_OPACITY
  191.     # Light Layer
  192.     @light_viewport = Viewport.new(0, 0, w, h)
  193.     @light_viewport.z = 10
  194.     [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new(@light_viewport)
  195.     @light.opacity = YSA::OVERLAY::LIGHT_OPACITY
  196.     @light.blend_type = 1
  197.     # Shadow Layer
  198.     @shadow_viewport = Viewport.new(0, 0, w, h)
  199.     @shadow_viewport.z = 9
  200.     [url=home.php?mod=space&uid=31758]@Shadow[/url] = Sprite.new(@shadow_viewport)
  201.     @shadow.opacity = YSA::OVERLAY::SHADOW_OPACITY
  202.     @shadow.blend_type = 2
  203.     # Parallax Layer
  204.     @par_viewport = Viewport.new(0, 0, w, h)
  205.     @par_viewport.z = 8
  206.     @par = Sprite.new(@par_viewport)
  207.     @par.opacity = YSA::OVERLAY::PARALLAX_OPACITY
  208.   end
  209.   
  210.   #--------------------------------------------------------------------------
  211.   # alias method: dispose_parallax
  212.   #--------------------------------------------------------------------------
  213.   alias overlay_dispose_parallax dispose_parallax
  214.   def dispose_parallax
  215.     overlay_dispose_parallax
  216.     dispose_overlay_map
  217.   end
  218.   
  219.   #--------------------------------------------------------------------------
  220.   # new method: dispose_overlay_map
  221.   #--------------------------------------------------------------------------
  222.   def dispose_overlay_map
  223.     @ground.dispose
  224.     @shadow_viewport.dispose
  225.     @light_viewport.dispose
  226.     @light.dispose
  227.     @shadow.dispose
  228.     @par_viewport.dispose
  229.     @par.dispose
  230.   end
  231.   
  232.   #--------------------------------------------------------------------------
  233.   # alias method: update_parallax
  234.   #--------------------------------------------------------------------------
  235.   alias overlay_update_parallax update_parallax
  236.   def update_parallax
  237.     overlay_update_parallax
  238.     # Parallax
  239.     if @ground != nil
  240.       if check_file("ground")
  241.         @ground.visible = $game_switches[YSA::OVERLAY::GROUND_SWITCH] if @ground.visible != $game_switches[YSA::OVERLAY::GROUND_SWITCH]
  242.         @ground.ox = $game_map.display_x * 32 if @ground.ox != $game_map.display_x * 32
  243.         @ground.oy = $game_map.display_y * 32 if @ground.oy != $game_map.display_y * 32
  244.         @ground.tone = $game_map.screen.tone
  245.         if @current_ground != $game_variables[YSA::OVERLAY::GROUND_VARIABLE]
  246.           filename = YSA::OVERLAY::GROUND
  247.           filename += $game_map.map_id.to_s
  248.           filename += "-" + $game_variables[YSA::OVERLAY::GROUND_VARIABLE].to_s
  249.           @ground.bitmap = Cache.overlay(filename)
  250.           @current_ground = $game_variables[YSA::OVERLAY::GROUND_VARIABLE]
  251.         end
  252.       else
  253.         @ground.visible = false
  254.       end
  255.     end
  256.     # Light
  257.     if [url=home.php?mod=space&uid=22469]@light[/url] != nil && @light_viewport != nil
  258.       if check_file("light")
  259.         @light.visible = $game_switches[YSA::OVERLAY::LIGHT_SWITCH] if @light.visible != $game_switches[YSA::OVERLAY::LIGHT_SWITCH]
  260.         @light.ox = $game_map.display_x * 32 if @light.ox != $game_map.display_x * 32
  261.         @light.oy = $game_map.display_y * 32 if @light.oy != $game_map.display_y * 32
  262.         @light.tone = $game_map.screen.tone
  263.         @light_viewport.ox = $game_map.screen.shake
  264.         @light_viewport.color = $game_map.screen.flash_color
  265.         if @current_light != $game_variables[YSA::OVERLAY::LIGHT_VARIABLE]
  266.           filename = YSA::OVERLAY::LIGHT
  267.           filename += $game_map.map_id.to_s
  268.           filename += "-" + $game_variables[YSA::OVERLAY::LIGHT_VARIABLE].to_s
  269.           @light.bitmap = Cache.overlay(filename)
  270.           @current_light = $game_variables[YSA::OVERLAY::LIGHT_VARIABLE]
  271.         end
  272.       else
  273.         @light.visible = false
  274.       end   
  275.     end
  276.     # Shadow
  277.     if [url=home.php?mod=space&uid=31758]@Shadow[/url] != nil && @shadow_viewport != nil
  278.       if check_file("shadow")
  279.         @shadow.visible = $game_switches[YSA::OVERLAY::SHADOW_SWITCH] if @shadow.visible != $game_switches[YSA::OVERLAY::SHADOW_SWITCH]
  280.         @shadow.ox = $game_map.display_x * 32 if @shadow.ox != $game_map.display_x * 32
  281.         @shadow.oy = $game_map.display_y * 32 if @shadow.oy != $game_map.display_y * 32
  282.         @shadow.tone = $game_map.screen.tone
  283.         @shadow_viewport.ox = $game_map.screen.shake
  284.         @shadow_viewport.color = $game_map.screen.flash_color
  285.         if @current_shadow != $game_variables[YSA::OVERLAY::SHADOW_VARIABLE]
  286.           filename = YSA::OVERLAY::SHADOW
  287.           filename += $game_map.map_id.to_s
  288.           filename += "-" + $game_variables[YSA::OVERLAY::SHADOW_VARIABLE].to_s
  289.           @shadow.bitmap = Cache.overlay(filename)
  290.           @current_shadow = $game_variables[YSA::OVERLAY::SHADOW_VARIABLE]
  291.         end
  292.       else
  293.         @shadow.visible = false
  294.       end
  295.     end
  296.     # Parallax
  297.     if @par != nil && @par_viewport != nil
  298.       if check_file("par")
  299.         @par.visible = $game_switches[YSA::OVERLAY::PARALLAX_SWITCH] if @par.visible != $game_switches[YSA::OVERLAY::PARALLAX_SWITCH]
  300.         @par.ox = $game_map.display_x * 32 if @par.ox != $game_map.display_x * 32
  301.         @par.oy = $game_map.display_y * 32 if @par.oy != $game_map.display_y * 32
  302.         @par.tone = $game_map.screen.tone
  303.         @par_viewport.ox = $game_map.screen.shake
  304.         @par_viewport.color = $game_map.screen.flash_color
  305.         if @current_par != $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE]
  306.           filename = YSA::OVERLAY::PARALLAX
  307.           filename += $game_map.map_id.to_s
  308.           filename += "-" + $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE].to_s
  309.           @par.bitmap = Cache.overlay(filename)
  310.           @current_par = $game_variables[YSA::OVERLAY::PARALLAX_VARIABLE]
  311.         end
  312.       else
  313.         @par.visible = false
  314.       end
  315.     end
  316.   end
  317.   
  318. end # Spriteset_Map

  319. #==============================================================================
  320. # ■ Scene_Map
  321. #==============================================================================

  322. class Scene_Map < Scene_Base
  323.   
  324.   #--------------------------------------------------------------------------
  325.   # alias method: post_transfer
  326.   #--------------------------------------------------------------------------
  327.   alias overlay_post_transfer post_transfer
  328.   def post_transfer
  329.     @spriteset.dispose_overlay_map
  330.     @spriteset.create_overlay_map
  331.     @spriteset.update
  332.     overlay_post_transfer
  333.   end

  334. end # Scene_Map

  335. #==============================================================================
  336. #
  337. # ▼ End of File
  338. #
  339. #==============================================================================
复制代码

评分

参与人数 1星屑 -10 收起 理由
熊喵酱 -10 編輯稅

查看全部评分

回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2013-11-9 19:10:38 | 显示全部楼层
本帖最后由 tseyik 于 2013-11-10 00:02 编辑

網上翻譯
#================================================= =============================
#¥說明
#= - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - = - =
#創建一個文件夾放圖形,並將它命名為Overlay。
#把所有你的圖形/覆蓋放到Overlay文件夾。
#覆蓋文件的名稱:“文件名前綴”+地圖ID+“ - ”+數字
#地圖ID是你的地圖的ID
#號是1,2,3,...使用疊加變數。
#
#示例:Graphics/Overlay/ground2-1.png的
#這意味著這將是地面層,圖2,變量=1
#
#光/陰影必須是jpg
#視差/地面必須是PNG

评分

参与人数 1星屑 +132 收起 理由
熊喵酱 + 132 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
50
在线时间
54 小时
注册时间
2013-9-23
回帖
21
 楼主| 发表于 2013-11-10 21:53:39 | 显示全部楼层
tseyik 发表于 2013-11-9 19:10
網上翻譯
#================================================= =============================
#¥說明

谢谢~~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部