Project1

标题: 有关烛光脚本使用问题 [打印本页]

作者: 脚本盲    时间: 2014-12-2 11:09
标题: 有关烛光脚本使用问题
本帖最后由 VIPArcher 于 2014-12-2 12:42 编辑

先上脚本。
RUBY 代码复制
  1. #==============================================================================
  2. # ■ 灯光脚本 for VA 版本1.0.0
  3. #     12.14.2012
  4. #------------------------------------------------------------------------------
  5. #  脚本修改: dujian15
  6. #  脚本制作: Kylock (For XP 版本 by Near Fantastica)
  7. #==============================================================================
  8.  
  9.  
  10. # ■ 灯光脚本 for VX 版本1.1.1
  11. #     5.21.2008
  12. #------------------------------------------------------------------------------
  13. #  脚本制作: Kylock (For XP 版本 by Near Fantastica)
  14. #==============================================================================
  15. #   如果您想要启用脚本,请在需要灯光效果的事件添加一个注释.
  16. #   打开开关将禁用灯光效果,启用效果前会检查开关,如果已经添加注释但是开关开启,那么将会停止效果.
  17. #   译者的话:因为发现脚本有一些问题,所以是有改动过的,如果改的不对,请M我QQ或者留言.谢谢
  18. #
  19. #==============================================================================
  20. # ● 更新日志
  21. #------------------------------------------------------------------------------
  22. # 1.0 - 建立最初版本
  23. # 1.1 - 添加了新的效果: LIGHT2, TORCH, TORCH2
  24. #      - 更改了混合模式(使其看起来更好)
  25. #      - 对FIRE效果增加了红色
  26. # 1.1.1 -非官方更新
  27. #         -解决了效果FIRE 与 TORCH 效果当开关打开时没有消失的问题
  28. #         -简便了开关判断
  29. #==============================================================================
  30. # ● 支持的效果(您可以添加的注释)
  31. #------------------------------------------------------------------------------
  32. #   GROUND - 中等稳定的白光.
  33. #   FIRE   - 伴有轻微的闪烁的红色.
  34. #   LIGHT  - 小型稳定的白光.
  35. #   LIGHT2 -大型稳定的白光.
  36. #   TORCH  - 伴有强烈闪烁的大型稳定的红光.
  37. #   TORCH2 - 伴有中等烁的大型稳定的红光.
  38. #==============================================================================
  39.  
  40.   $lsig = 100           #开关号
  41.  
  42.  
  43. class Spriteset_Map
  44.   alias les_spriteset_map_initalize initialize
  45.   alias les_spriteset_map_dispose dispose
  46.   alias les_spriteset_map_update update
  47.   def initialize
  48.     @light_effects = []
  49.     setup_lights
  50.     les_spriteset_map_initalize
  51.     update
  52.   end
  53.   def dispose
  54.     les_spriteset_map_dispose
  55.     for effect in @light_effects
  56.       effect.light.dispose
  57.     end
  58.     @light_effects = []
  59.   end
  60.   def update
  61.     les_spriteset_map_update
  62.     update_light_effects
  63.   end
  64.   def setup_lights
  65.     for event in $game_map.events.values
  66.       next if event.list == nil
  67.       for i in 0...event.list.size
  68.         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
  69.           type = "GROUND"
  70.           light_effects = Light_Effect.new(event,type)
  71.           light_effects.light.zoom_x = 2
  72.           light_effects.light.zoom_y = 2
  73.           light_effects.light.opacity = 100
  74.           @light_effects.push(light_effects)
  75.         end
  76.         if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
  77.           type = "FIRE"
  78.           light_effects = Light_Effect.new(event,type)
  79.           light_effects.light.zoom_x = 300 / 100.0
  80.           light_effects.light.zoom_y = 300 / 100.0
  81.           light_effects.light.opacity = 100
  82.           @light_effects.push(light_effects)
  83.         end
  84.         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
  85.           type = "LIGHT"
  86.           light_effects = Light_Effect.new(event,type)
  87.           light_effects.light.zoom_x = 1
  88.           light_effects.light.zoom_y = 1
  89.           light_effects.light.opacity = 150
  90.           @light_effects.push(light_effects)
  91.         end
  92.         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
  93.           type = "LIGHT2"
  94.           light_effects = Light_Effect.new(event,type)
  95.           light_effects.light.zoom_x = 6
  96.           light_effects.light.zoom_y = 6
  97.           light_effects.light.opacity = 150
  98.           @light_effects.push(light_effects)
  99.         end
  100.         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
  101.           type = "TORCH"
  102.           light_effects = Light_Effect.new(event,type)
  103.           light_effects.light.zoom_x = 6
  104.           light_effects.light.zoom_y = 6
  105.           light_effects.light.opacity = 150
  106.           @light_effects.push(light_effects)
  107.         end
  108.         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
  109.           type = "TORCH2"
  110.           light_effects = Light_Effect.new(event,type)
  111.           light_effects.light.zoom_x = 6
  112.           light_effects.light.zoom_y = 6
  113.           light_effects.light.opacity = 150
  114.           @light_effects.push(light_effects)
  115.         end
  116.       end
  117.     end
  118.     for effect in @light_effects
  119.       case effect.type
  120.       when "GROUND"
  121.         effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
  122.         effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
  123.         effect.light.blend_type = 1
  124.       when "FIRE"
  125.         effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
  126.         effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
  127.         effect.light.tone = Tone.new(255,-100,-255,   0)
  128.         effect.light.blend_type = 1
  129.       when "LIGHT"
  130.         effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8
  131.         effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8
  132.         effect.light.blend_type = 1
  133.       when "LIGHT2"
  134.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
  135.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
  136.         effect.light.blend_type = 1
  137.       when "TORCH"
  138.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
  139.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
  140.         effect.light.tone = Tone.new(255,-100,-255,   0)
  141.         effect.light.blend_type = 1
  142.       when "TORCH2"
  143.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
  144.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
  145.         effect.light.tone = Tone.new(255,-100,-255,   0)
  146.         effect.light.blend_type = 1
  147.       end
  148.     end
  149.   end
  150.   def update_light_effects
  151.     if $game_switches[$lsig]
  152.       for effect in @light_effects
  153.         effect.light.visible = false
  154.       end
  155.     else
  156.       for effect in @light_effects
  157.  
  158.         effect.light.visible = true
  159.       end
  160.     end
  161.     for effect in @light_effects
  162.       case effect.type
  163.       when "GROUND"
  164.         effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
  165.         effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
  166.       when "FIRE"
  167.         effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
  168.         effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
  169.         effect.light.opacity = rand(10) + 90
  170.       when "LIGHT"
  171.         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  172.         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  173.       when "LIGHT2"
  174.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
  175.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
  176.       when "TORCH"
  177.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
  178.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 + rand(20) - 10
  179.         effect.light.opacity = rand(30) + 70
  180.       when "TORCH2"
  181.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
  182.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
  183.         effect.light.opacity = rand(10) + 90
  184.       end
  185.     end
  186.   end
  187. end
  188.  
  189. class Light_Effect
  190.   attr_accessor :light
  191.   attr_accessor :event
  192.   attr_accessor :type
  193.   def initialize(event, type)
  194.     [url=home.php?mod=space&uid=22469]@light[/url]= Sprite.new
  195.     @light.bitmap = Cache.picture("le.png")
  196.     @light.visible = true
  197.     @light.z = 1000
  198.     @event = event
  199.     @type = type
  200.   end
  201. end


请教下这个脚本怎么用,插入工程后显示第195行错误。

发脚本可以用代码框,已编辑——VIPArcher
作者: 脚本盲    时间: 2014-12-2 11:12
请教下各位大大:
1.插入工程后显示第195行错误,解决。
2.这个脚本如何使用。
作者: 三途亚梦    时间: 2014-12-2 11:23
发脚本请使用脚本框。

首先确定一下你是否加入了用于作为发光效果的图片,
使用方法就是在事件中“注释”预设好的文字:
GROUND
FIRE
之类




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