Project1

标题: 无力翻墙,求帮助,图层脚本 [打印本页]

作者: a774741359    时间: 2013-9-22 19:15
标题: 无力翻墙,求帮助,图层脚本
本帖最后由 a774741359 于 2013-9-22 19:16 编辑

我需要这个脚本:http://bbs.cgyouxi.com/forum.php?mod=viewthread&tid=304286
但是无力翻墙
求帮助
传送门:http://galveraxe.wordpress.com/galvs-layer-graphics/
作者: lottesong    时间: 2013-9-22 19:58
Galv的旧版示范下载  
http://pan.baidu.com/share/link? ... 7&uk=1932489685

  (脚本请用下面这个↓)
RUBY 代码复制
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Layer Graphics
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.2
  6. #------------------------------------------------------------------------------#
  7. #  2013-03-22 - Version 1.2 - Added layers in battles
  8. #  2013-03-17 - Version 1.1 - fixed graphic object bug
  9. #  2013-03-17 - Version 1.0 - release
  10. #------------------------------------------------------------------------------#
  11. #  Create image layers on maps using script calls. These image layers can be
  12. #  used for overlay mapping, moving fogs etc.
  13. #
  14. #  Notes:
  15. #  Once you have created a layer for a map, it will remain at the settings you
  16. #  chose until you change it again. Layers don't carry over from map to map, you
  17. #  will need to create the layer for each map required.
  18. #  I recommend not using too many layers as it could start to cause lag.
  19. #
  20. #  There are other scripts available that do a similar thing, this is just my
  21. #  implementation of it. I recommend trying the others out, too (as they are
  22. #  possibly better!). I created this more for myself but thought I'd add it to
  23. #  my archive for anyone to use.
  24. #------------------------------------------------------------------------------#
  25.  
  26. #-------------------------------------------------------------------------------
  27. #  SCRIPT CALLS:
  28. #-------------------------------------------------------------------------------
  29. #
  30. #  layer_status(status)    # script enabled if status is true, disabled if false
  31. #
  32. #  del_layer(map_id,layer_id)       # removes a layer graphic from selected map
  33. #
  34. #  layer(map,layer,["Filename",xspeed,yspeed,opacity,z,blend,xoffset,yoffset])
  35. #
  36. #  #  map        - map id the layer is to be on
  37. #  #  layer      - layer number. use different numbers for different layers
  38. #  #  "Filename" - the name of the image located in Graphics/Layers/ folder
  39. #  #  xspeed     - speed the layer will scroll horizontally
  40. #  #  yspeed     - speed the layer will scroll vertically
  41. #  #  opacity    - the opacity of the layer
  42. #  #  z value    - what level the layer is displayed at (ground is 0)
  43. #  #  blend      - 0 is normal, 1 is addition, 2 is subtraction
  44. #  #  xoffset    - Moves the layer at a different amount than the map. Make
  45. #  #  yoffset    - these 0 to fix the layer to the map.
  46. #
  47. #  refresh_layers     # When setting a NEW layer on the CURRENT map, you will
  48. #                     # need to use the refresh_layers script call right after.
  49. #                     # Updating an existing one or setting a layer for another
  50. #                     # map doesn't require refreshing.
  51. #
  52. #-------------------------------------------------------------------------------
  53. #  EXAMPLE SCRIPT CALLS:
  54. #  layer(1,6,["water2",0.3,0.1,120,-5,0,0,0])   # adds/updates layer 6 on map 1
  55. #  layer(2,1,["map2-over",0,0,255,700,0,10,0])  # adds/updates layer 1 on map 2
  56. #
  57. #  layer_status(false)    # turn layers OFF
  58. #  layer_status(true)     # turn layers ON
  59. #-------------------------------------------------------------------------------
  60.  
  61. #-------------------------------------------------------------------------------
  62. #  SCRIPT CALLS for BATTLE layers
  63. #-------------------------------------------------------------------------------
  64. #
  65. #  del_blayer(layer_id)       # Removes a layer from battles.
  66. #
  67. #  refresh_layers             # Use this when adding a new laying during battle
  68. #
  69. #  blayer(layer,["Filename",xspeed,yspeed,opacity,z,blend,xoffset,yoffset])
  70. #
  71. #  #  These script calls add and remove layers that will appear in battle. They
  72. #  #  work the same as map layers without the need for a map id at the start.
  73. #  #  Ideally you would change the layers before combat, but they can be done
  74. #  #  during as well, if you refresh the layers.
  75. #
  76. #-------------------------------------------------------------------------------
  77.  
  78. #-------------------------------------------------------------------------------
  79. #  NO SCRIPT SETTINGS. DO NOT EDIT BELOW UNLESS YOU KNOW WHAT YOU ARE DOING.
  80. #-------------------------------------------------------------------------------
  81.  
  82. ($imported ||= {})["Galv_Layers"] = true
  83. module Cache
  84.   def self.layers(filename)
  85.     load_bitmap("Graphics/Layers/", filename)
  86.   end
  87. end # Cache
  88.  
  89.  
  90. class Spriteset_Map
  91.   def create_layers
  92.     @layer_images = []
  93.     return if !$game_map.layer_status
  94.     return if $game_map.layers[$game_map.map_id].nil?
  95.     $game_map.layers[$game_map.map_id].each_with_index { |layer,i|
  96.       if layer.nil?
  97.         @layer_images.push(nil)
  98.       else
  99.         @layer_images.push(Layer_Graphic.new(@viewport1,i))
  100.       end
  101.     }
  102.   end
  103.  
  104.   def update_layers
  105.     @layer_images.each { |o| o.update if !o.nil? }
  106.   end
  107.  
  108.   def dispose_layers
  109.     @layer_images.each { |o| o.dispose if !o.nil? }
  110.     @layer_images = []
  111.   end
  112.  
  113.   def refresh_layers
  114.     dispose_layers
  115.     create_layers
  116.   end
  117.  
  118.   alias galv_layers_sm_create_parallax create_parallax
  119.   def create_parallax
  120.     galv_layers_sm_create_parallax
  121.     create_layers
  122.   end
  123.   alias galv_layers_sm_dispose_parallax dispose_parallax
  124.   def dispose_parallax
  125.     galv_layers_sm_dispose_parallax
  126.     dispose_layers
  127.   end
  128.  
  129.   alias galv_layers_sm_update_parallax update_parallax
  130.   def update_parallax
  131.     galv_layers_sm_update_parallax
  132.     update_layers
  133.   end
  134. end # Spriteset_Map
  135.  
  136.  
  137. class Spriteset_Battle
  138.   def create_layers
  139.     @layer_images = []
  140.     return if !$game_map.layer_status
  141.     return if $game_map.blayers.nil?
  142.     $game_map.blayers.each_with_index { |layer,i|
  143.       if layer.nil?
  144.         @layer_images.push(nil)
  145.       else
  146.         @layer_images.push(Layer_Graphic.new(@viewport1,i))
  147.       end
  148.     }
  149.   end
  150.  
  151.   def update_layers
  152.     @layer_images.each { |o| o.update if !o.nil? }
  153.   end
  154.  
  155.   def dispose_layers
  156.     @layer_images.each { |o| o.dispose if !o.nil? }
  157.     @layer_images = []
  158.   end
  159.  
  160.   def refresh_layers
  161.     dispose_layers
  162.     create_layers
  163.   end
  164.  
  165.   alias galv_layers_sb_create_battleback2 create_battleback2
  166.   def create_battleback2
  167.     galv_layers_sb_create_battleback2
  168.     create_layers
  169.   end
  170.  
  171.   alias galv_layers_sb_dispose dispose
  172.   def dispose
  173.     dispose_layers
  174.     galv_layers_sb_dispose
  175.   end
  176.  
  177.   alias galv_layers_sb_update update
  178.   def update
  179.     galv_layers_sb_update
  180.     update_layers
  181.   end
  182. end # Spriteset_Battle
  183.  
  184.  
  185. class Game_Map
  186.   attr_accessor :blayers
  187.   attr_accessor :layers
  188.   attr_accessor :layer_status
  189.  
  190.   alias galv_layers_gm_initialize initialize
  191.   def initialize
  192.     galv_layers_gm_initialize
  193.     @layer_status = true
  194.     @layers = { 0 => [] }
  195.     @blayers = []
  196.   end
  197.  
  198.   alias galv_layers_gm_setup setup
  199.   def setup(map_id)
  200.     galv_layers_gm_setup(map_id)
  201.     if SceneManager.scene_is?(Scene_Map)
  202.       @layers[0] = []
  203.       SceneManager.scene.spriteset.refresh_layers
  204.     end
  205.   end
  206. end # Game_Map
  207.  
  208.  
  209. class Scene_Map < Scene_Base
  210.   attr_accessor :spriteset
  211. end # Scene_Map < Scene_Base
  212.  
  213. class Scene_Battle < Scene_Base
  214.   attr_accessor :spriteset
  215. end # Scene_Map < Scene_Base
  216.  
  217.  
  218. class Game_Interpreter
  219.   def refresh_layers
  220.     SceneManager.scene.spriteset.refresh_layers
  221.   end
  222.  
  223.   def layer(map,id,array)
  224.     need_refresh = false
  225.     $game_map.layers[map] ||= []
  226.     need_refresh = true if $game_map.layers[map][id].nil?
  227.     $game_map.layers[map][id] = array
  228.   end
  229.   def del_layer(map,id)
  230.     return if !$game_map.layers[map]
  231.     $game_map.layers[map][id] = nil
  232.     SceneManager.scene.spriteset.refresh_layers
  233.   end
  234.   def layer_status(status)
  235.     $game_map.layer_status = status
  236.     SceneManager.scene.spriteset.refresh_layers
  237.   end
  238.  
  239.   def blayer(id,array)
  240.     need_refresh = false
  241.     $game_map.blayers ||= []
  242.     need_refresh = true if $game_map.blayers[id].nil?
  243.     $game_map.blayers[id] = array
  244.   end
  245.   def del_blayer(id)
  246.     return if !$game_map.blayers
  247.     $game_map.blayers[id] = nil
  248.     SceneManager.scene.spriteset.refresh_layers if SceneManager.scene_is?(Scene_Battle)
  249.   end
  250.  
  251. end # Game_Interpreter
  252.  
  253.  
  254. class Layer_Graphic < Plane
  255.   def initialize(viewport,id)
  256.     super(viewport)
  257.     @id = id
  258.     if SceneManager.scene_is?(Scene_Battle)
  259.       @layers = $game_map.blayers
  260.     else
  261.       @layers = $game_map.layers[$game_map.map_id]
  262.     end
  263.     @layers
  264.     init_settings
  265.   end
  266.  
  267.   def init_settings
  268.     @name = @layers[@id][0]  # filename
  269.     self.bitmap = Cache.layers(@name)
  270.     @width = self.bitmap.width
  271.     [url=home.php?mod=space&uid=291977]@height[/url] = self.bitmap.height
  272.     if @layers[0] && @layers[0][@id]
  273.       @movedx = @layers[0][@id][0].to_f  # stored x
  274.       @movedy = @layers[0][@id][1].to_f  # stored y
  275.     else
  276.       @movedx = 0.to_f
  277.       @movedy = 0.to_f
  278.     end
  279.   end
  280.  
  281.   def update
  282.     change_graphic if @name != @layers[@id][0]
  283.     update_opacity
  284.     update_movement
  285.   end
  286.  
  287.   def change_graphic
  288.     @name = @layers[@id][0]
  289.     self.bitmap = Cache.layers(@name)
  290.     @width = self.bitmap.width
  291.     @height = self.bitmap.height
  292.   end
  293.  
  294.   def update_movement
  295.     self.ox = 0 + $game_map.display_x * 32 + @movedx + xoffset
  296.     self.oy = 0 + $game_map.display_y * 32 + @movedy + yoffset
  297.     @movedx += @layers[@id][1]
  298.     @movedy += @layers[@id][2]
  299.     @movedx = 0 if @movedx >= @width
  300.     @movedy = 0 if @movedy >= @height
  301.     self.z = @layers[@id][4]
  302.     self.blend_type = @layers[@id][5]
  303.   end
  304.  
  305.   def xoffset
  306.     $game_map.display_x * @layers[@id][6]
  307.   end
  308.   def yoffset
  309.     $game_map.display_x * @layers[@id][7]
  310.   end
  311.  
  312.   def update_opacity
  313.     self.opacity = @layers[@id][3]
  314.   end
  315.  
  316.   def dispose
  317.     $game_map.layers[0][@id] = [@movedx,@movedy]
  318.     self.bitmap.dispose if self.bitmap
  319.     super
  320.   end
  321. end # Layer_Graphic < Plane

作者: a774741359    时间: 2013-9-23 14:55
lottesong 发表于 2013-9-22 19:58
Galv的旧版示范下载  
http://pan.baidu.com/share/link?shareid=692351037&uk=1932489685

十分感谢  问题解决




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1