#============================================================================== # ■ 灯光脚本 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 = 100 #开关号 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
黄亦天 发表于 2019-2-28 20:29
改成@light = Spritr.new试试
是不是在论坛上复制的时候没复制好多了个链接?
筱叶子 发表于 2019-2-28 20:58
谢谢回复,进去测试是没问题了……但是又遇到新的问题,这个脚本注释里写的使用方法是直接在灯光事件里添 ...
黄亦天 发表于 2019-2-28 21:12
没记错的话是添加一个注释,里面写上LIGHT2之类的。
不是添加事件脚本。
筱叶子 发表于 2019-2-28 21:30
等下……我突然发现我知道为啥刚才用注释觉得没效果了,这次测试我是直接在有灯光的这个地图上的打开的游 ...
黄亦天 发表于 2019-2-28 21:32
迷,是不是调整地图色调的问题?
筱叶子 发表于 2019-2-28 21:51
我先后尝试了在前一张地图设置更改色调(继承到下一张地图),在有灯光的这张地图上更改色调,在前一张地 ...
黄亦天 发表于 2019-2-28 21:56
记得范例里都是把注释放在第一行的,这到底是个什么问题我也没见过。
实在不行就在场景移动前后加个黑屏 ...
1.44 MB, 下载次数: 95
shencao 发表于 2019-3-1 14:40
试验了一下,这个脚本效果很奇怪
我在第一个地图设置灯光,换了地图直接继承了上一个地图的灯光,就是说第 ...
欢迎光临 Project1 (https://rpg.blue/) | Powered by Discuz! X3.1 |