查看: 3762|回复: 10

[已经解决] 关于Overlay脚本冲突,求解决办法

[复制链接]
梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
发表于 2013-11-14 22:06:12 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 魔力的觉醒 于 2013-11-16 17:01 编辑

目测脚本兼容出现了问题!!!可以解决吗?下面是脚本
  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 = 16        # Turn on/off light layer
  53.     SHADOW_SWITCH = 17       # Turn on/off shadow layer
  54.     PARALLAX_SWITCH = 18     # Turn on/off parallax layer
  55.     GROUND_SWITCH = 19       # 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 = 8      # Switch to another light
  66.     SHADOW_VARIABLE = 8     # Switch to another shadow
  67.     PARALLAX_VARIABLE = 7   # Switch to another parallax
  68.     GROUND_VARIABLE = 7     # 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 = 0#1  ###SR
  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 = 0#8  ###SR
  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  #SR fix
  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. #==============================================================================
复制代码
W@C2A0IDN~MA0UM{BN%5HQV.jpg
你的意思就是要打架咯?
梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
 楼主| 发表于 2013-11-15 11:53:22 | 显示全部楼层
没人??
回复

使用道具 举报

梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
 楼主| 发表于 2013-11-15 21:31:19 | 显示全部楼层
一天了  还没人   提问区没人管了么!!@tan12345  
你的意思就是要打架咯?
回复

使用道具 举报

梦石
0
星屑
3348
在线时间
1120 小时
注册时间
2009-4-15
回帖
761
发表于 2013-11-15 21:48:18 | 显示全部楼层
魔力的觉醒 发表于 2013-11-15 21:31
一天了  还没人   提问区没人管了么!!@tan12345

这个不会啊……

点评

没事没事 还还以为没人回答呢!!  发表于 2013-11-16 14:28
回复

使用道具 举报

老黄鸡

梦石
4
星屑
46140
在线时间
7978 小时
注册时间
2009-7-6
回帖
13343

MZ评测员RM创作大赛01组委会开拓者贵宾

发表于 2013-11-16 11:56:27 | 显示全部楼层
本帖最后由 fux2 于 2013-11-16 17:44 编辑

追加定义
  1. class NilClass
  2. def dispose
  3. end
  4. end
复制代码
我真不是捣乱

点评

………………楼主把你话当真了……  发表于 2013-11-16 14:37
RGDirect - DirectX驱动的RGSS,点我了解.
(排满,暂停)RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复

使用道具 举报

梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
 楼主| 发表于 2013-11-16 14:29:30 | 显示全部楼层
fux2 发表于 2013-11-16 11:56
追加定义我真不是捣乱

新建一个 还是放在后面呢!!

点评

五楼是在胡扯……  发表于 2013-11-16 14:37
你的意思就是要打架咯?
回复

使用道具 举报

梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
 楼主| 发表于 2013-11-16 14:35:05 | 显示全部楼层
@喵呜喵5 大神会吗??

点评

好吧好吧 结贴了!!  发表于 2013-11-16 17:00
看到楼下的回答之后就完全不想去研究了…  发表于 2013-11-16 15:40
你的意思就是要打架咯?
回复

使用道具 举报

梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
 楼主| 发表于 2013-11-16 14:40:44 | 显示全部楼层
魔力的觉醒 发表于 2013-11-16 14:29
新建一个 还是放在后面呢!!

我猜的也是!!有办法解决么!!!
你的意思就是要打架咯?
回复

使用道具 举报

百合控

梦石
0
星屑
6548
在线时间
1275 小时
注册时间
2013-8-21
回帖
3522

开拓者

发表于 2013-11-16 14:42:32 | 显示全部楼层
如果是脚本冲突……楼主只发一个脚本就没用啊……冲突是两(多)个脚本之间的事……
萌新瑟瑟发抖
看到我请叫我去干活
回复

使用道具 举报

梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
 楼主| 发表于 2013-11-16 14:57:18 | 显示全部楼层
余烬之中 发表于 2013-11-16 14:42
如果是脚本冲突……楼主只发一个脚本就没用啊……冲突是两(多)个脚本之间的事…… ...

大神  帮忙看看吧  麻烦了   

脚本数据.zip

494 KB, 下载次数: 52

你的意思就是要打架咯?
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部