赞 | 2 |
VIP | 0 |
好人卡 | 20 |
积分 | 5 |
经验 | 26304 |
最后登录 | 2024-2-11 |
在线时间 | 487 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 473
- 在线时间
- 487 小时
- 注册时间
- 2011-10-12
- 帖子
- 407
|
这是一个灯光脚本,经过测试,与烛光、天气、光影等脚本都能兼容使用,但在我的一个工程里却不能正常显示灯光。- #==============================================================================
- # ■ 灯光脚本 for VA 版本1.0.0
- # 12.14.2012
- #------------------------------------------------------------------------------
- # 脚本修改: dujian15
- # 脚本制作: Kylock (For XP 版本 by Near Fantastica)
- #==============================================================================
- # ■ 灯光脚本 for VX 版本1.1.1
- # 5.21.2008
- #------------------------------------------------------------------------------
- # 脚本制作: Kylock (For XP 版本 by Near Fantastica)
- #==============================================================================
- # 如果您想要启用脚本,请在需要灯光效果的事件添加一个注释.
- # 打开开关将禁用灯光效果,启用效果前会检查开关,如果已经添加注释但是开关开启,那么将会停止效果.
- # 译者的话:因为发现脚本有一些问题,所以是有改动过的,如果改的不对,请M我QQ或者留言.谢谢
- #
- #==============================================================================
- # ● 更新日志
- #------------------------------------------------------------------------------
- # 1.0 - 建立最初版本
- # 1.1 - 添加了新的效果: LIGHT2, TORCH, TORCH2
- # - 更改了混合模式(使其看起来更好)
- # - 对FIRE效果增加了红色
- # 1.1.1 -非官方更新
- # -解决了效果FIRE 与 TORCH 效果当开关打开时没有消失的问题
- # -简便了开关判断
- #==============================================================================
- # ● 支持的效果(您可以添加的注释)
- #------------------------------------------------------------------------------
- # GROUND - 中等稳定的白光.
- # FIRE - 伴有轻微的闪烁的红色.
- # LIGHT - 小型稳定的白光.
- # LIGHT2 -大型稳定的白光.
- # TORCH - 伴有强烈闪烁的大型稳定的红光.
- # TORCH2 - 伴有中等烁的大型稳定的红光.
- #==============================================================================
-
- $lsig = 200 #如果打开\关闭灯光效果
-
-
- class Spriteset_Map
- alias les_spriteset_map_initalize initialize
- alias les_spriteset_map_dispose dispose
- alias les_spriteset_map_update update
- def initialize
- @light_effects = []
- setup_lights
- les_spriteset_map_initalize
- update
- end
- def dispose
- les_spriteset_map_dispose
- for effect in @light_effects
- effect.light.dispose
- end
- @light_effects = []
- end
- def update
- les_spriteset_map_update
- update_light_effects
- end
- def setup_lights
- for event in $game_map.events.values
- next if event.list == nil
- for i in 0...event.list.size
- if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
- type = "GROUND"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 2
- light_effects.light.zoom_y = 2
- light_effects.light.opacity = 100
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
- type = "FIRE"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 300 / 100.0
- light_effects.light.zoom_y = 300 / 100.0
- light_effects.light.opacity = 100
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
- type = "LIGHT"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 1
- light_effects.light.zoom_y = 1
- light_effects.light.opacity = 150
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
- type = "LIGHT2"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 6
- light_effects.light.zoom_y = 6
- light_effects.light.opacity = 150
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
- type = "TORCH"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 6
- light_effects.light.zoom_y = 6
- light_effects.light.opacity = 150
- @light_effects.push(light_effects)
- end
- if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
- type = "TORCH2"
- light_effects = Light_Effect.new(event,type)
- light_effects.light.zoom_x = 6
- light_effects.light.zoom_y = 6
- light_effects.light.opacity = 150
- @light_effects.push(light_effects)
- end
- end
- end
- for effect in @light_effects
- case effect.type
- when "GROUND"
- effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
- effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
- effect.light.blend_type = 1
- when "FIRE"
- effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
- effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
- effect.light.tone = Tone.new(255,-100,-255, 0)
- effect.light.blend_type = 1
- when "LIGHT"
- effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8
- effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8
- effect.light.blend_type = 1
- when "LIGHT2"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- effect.light.blend_type = 1
- when "TORCH"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- effect.light.tone = Tone.new(255,-100,-255, 0)
- effect.light.blend_type = 1
- when "TORCH2"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- effect.light.tone = Tone.new(255,-100,-255, 0)
- effect.light.blend_type = 1
- end
- end
- end
- def update_light_effects
- if $game_switches[$lsig]
- for effect in @light_effects
- effect.light.visible = false
- end
- else
- for effect in @light_effects
- effect.light.visible = true
- end
- end
- for effect in @light_effects
- case effect.type
- when "GROUND"
- effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
- effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
- when "FIRE"
- effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
- effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
- effect.light.opacity = rand(10) + 90
- when "LIGHT"
- effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
- effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
- when "LIGHT2"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- when "TORCH"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 + rand(20) - 10
- effect.light.opacity = rand(30) + 70
- when "TORCH2"
- effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
- effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
- effect.light.opacity = rand(10) + 90
- end
- end
- end
- end
- class Light_Effect
- attr_accessor :light
- attr_accessor :event
- attr_accessor :type
- def initialize(event, type)
- [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new
- @light.bitmap = Cache.picture("le.png")
- @light.visible = true
- @light.z = 1000
- @event = event
- @type = type
- end
- end
复制代码
把它放在Pictures文件夹里。
这里有个烛光脚本,效果也很好(但必须要开启黑暗效果才会显示烛光,适合山洞之类的纯黑暗环境)。
http://rpg.blue/thread-224000-1-2.html
注意:要把tktk_bitmap.dl复制过去才能使用,共两个脚本“Bitmapクラスの拡張”和“HN_Light” |
评分
-
查看全部评分
|