设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2581|回复: 2
打印 上一主题 下一主题

[已经解决] 求助,这个灯光脚本是vx移植过来的出问题了

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1058
在线时间
878 小时
注册时间
2012-6-28
帖子
1079
跳转到指定楼层
1
发表于 2013-10-12 11:41:49 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 没是的人 于 2013-10-12 16:59 编辑

这个脚本出问题了,在vx用的好好的
拿到rgss3了以后估计是精灵类方面的问题
切换场景以后灯光的位置居然不变
但是打开菜单以后再关掉显示就正常了

本脚本使用方法:
picture里放人
在脚本里插入这些语句
12号开关控制灯是否亮起,在需要亮起的事件里注释
   GROUND - 中等稳定的白光.
   FIRE   - 伴有轻微的闪烁的红色.
   LIGHT  - 小型稳定的白光.
   LIGHT2 -大型稳定的白光.
   TORCH  - 伴有强烈闪烁的大型稳定的红光.
   TORCH2 - 伴有中等烁的大型稳定的红光.

RUBY 代码复制
  1. $lsig = 12           #开关号
  2.  
  3.  
  4. class Spriteset_Map
  5.   alias les_spriteset_map_initalize initialize
  6.   alias les_spriteset_map_dispose dispose
  7.   alias les_spriteset_map_update update
  8.   def initialize
  9.     @light_effects = []
  10.     setup_lights
  11.     les_spriteset_map_initalize
  12.     update
  13.   end
  14.   def dispose
  15.     les_spriteset_map_dispose
  16.     for effect in @light_effects
  17.       effect.light.dispose
  18.     end
  19.     @light_effects = []
  20.   end
  21.   def update
  22.     les_spriteset_map_update
  23.     update_light_effects
  24.   end
  25.   def setup_lights
  26.     for event in $game_map.events.values
  27.       next if event.list == nil
  28.       for i in 0...event.list.size
  29.         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
  30.           type = "GROUND"
  31.           light_effects = Light_Effect.new(event,type)
  32.           light_effects.light.zoom_x = 2
  33.           light_effects.light.zoom_y = 2
  34.           light_effects.light.opacity = 100
  35.           @light_effects.push(light_effects)
  36.         end
  37.         if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
  38.           type = "FIRE"
  39.           light_effects = Light_Effect.new(event,type)
  40.           light_effects.light.zoom_x = 300 / 100.0
  41.           light_effects.light.zoom_y = 300 / 100.0
  42.           light_effects.light.opacity = 100
  43.           @light_effects.push(light_effects)
  44.         end
  45.         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
  46.           type = "LIGHT"
  47.           light_effects = Light_Effect.new(event,type)
  48.           light_effects.light.zoom_x = 1
  49.           light_effects.light.zoom_y = 1
  50.           light_effects.light.opacity = 150
  51.           @light_effects.push(light_effects)
  52.         end
  53.         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
  54.           type = "LIGHT2"
  55.           light_effects = Light_Effect.new(event,type)
  56.           light_effects.light.zoom_x = 6
  57.           light_effects.light.zoom_y = 6
  58.           light_effects.light.opacity = 150
  59.           @light_effects.push(light_effects)
  60.         end
  61.         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
  62.           type = "TORCH"
  63.           light_effects = Light_Effect.new(event,type)
  64.           light_effects.light.zoom_x = 6
  65.           light_effects.light.zoom_y = 6
  66.           light_effects.light.opacity = 150
  67.           @light_effects.push(light_effects)
  68.         end
  69.         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
  70.           type = "TORCH2"
  71.           light_effects = Light_Effect.new(event,type)
  72.           light_effects.light.zoom_x = 6
  73.           light_effects.light.zoom_y = 6
  74.           light_effects.light.opacity = 150
  75.           @light_effects.push(light_effects)
  76.         end
  77.       end
  78.     end
  79.     for effect in @light_effects
  80.       case effect.type
  81.       when "GROUND"
  82.         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  83.         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  84.         effect.light.blend_type = 1
  85.       when "FIRE"
  86.         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
  87.         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
  88.         effect.light.tone = Tone.new(255,-100,-255,   0)
  89.         effect.light.blend_type = 1
  90.       when "LIGHT"
  91.         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  92.         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  93.         effect.light.blend_type = 1
  94.       when "LIGHT2"
  95.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  96.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  97.         effect.light.blend_type = 1
  98.       when "TORCH"
  99.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  100.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  101.         effect.light.tone = Tone.new(255,-100,-255,   0)
  102.         effect.light.blend_type = 1
  103.       when "TORCH2"
  104.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  105.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  106.         effect.light.tone = Tone.new(255,-100,-255,   0)
  107.         effect.light.blend_type = 1
  108.       end
  109.     end
  110.   end
  111.   def update_light_effects
  112.     if $game_switches[$lsig]
  113.       for effect in @light_effects
  114.         effect.light.visible = false
  115.       end
  116.     else
  117.       for effect in @light_effects
  118.  
  119.         effect.light.visible = true
  120.       end
  121.     end
  122.     for effect in @light_effects
  123.       case effect.type
  124.       when "GROUND"
  125.         effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
  126.         effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
  127.       when "FIRE"
  128.         effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
  129.         effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
  130.         effect.light.opacity = rand(10) + 90
  131.       when "LIGHT"
  132.         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  133.         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  134.       when "LIGHT2"
  135.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 32
  136.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 - 32
  137.       when "TORCH"
  138.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
  139.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 + rand(20) - 10
  140.         effect.light.opacity = rand(30) + 70
  141.       when "TORCH2"
  142.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
  143.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
  144.         effect.light.opacity = rand(10) + 90
  145.       end
  146.     end
  147.   end
  148. end
  149.  
  150. class Light_Effect
  151.   attr_accessor :light
  152.   attr_accessor :event
  153.   attr_accessor :type
  154.   def initialize(event, type)
  155.     [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new
  156.     @light.bitmap = Cache.picture("le.png")
  157.     @light.visible = true
  158.     @light.z = 1
  159.     @event = event
  160.     @type = type
  161.   end
  162. end

出现的主要问题就是:切换场景以后灯光显示不正常,打开一下菜单就正常了
折腾了一上午了就是没解决问题,希望大家帮帮忙,我一定多塞糖

点评

你是怎么产生VX的脚本可以直接在VA上用的错觉的……  发表于 2013-10-12 12:20
不追求华丽的商业素材;不依赖与自己运用能力不符的外挂脚本;不搞华而不实的无用噱头。
                    修改,使用最朴实的素材,融入自己的智慧做最好的游戏!
                                    点这里!暂不设加入门槛
         
                               我觉得我的优点是,会认真的画每一张地图。

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21005
在线时间
9337 小时
注册时间
2012-6-19
帖子
7107

开拓者短篇九导演组冠军

2
发表于 2013-10-12 13:17:08 | 只看该作者

  1.   $lsig = 12           #开关号


  2. class Spriteset_Map
  3.   alias les_spriteset_map_initalize initialize
  4.   alias les_spriteset_map_dispose dispose
  5.   alias les_spriteset_map_update update
  6.   alias m5_spriteset_map_refresh_characters refresh_characters
  7.   def initialize   
  8.     creat_light
  9.     les_spriteset_map_initalize
  10.     update        
  11.   end  
  12.   def dispose
  13.     les_spriteset_map_dispose
  14.     dispose_light
  15.   end  
  16.   def creat_light
  17.     @light_effects = []
  18.     setup_lights   
  19.   end  
  20.   def dispose_light
  21.     for effect in @light_effects
  22.       effect.light.dispose
  23.     end
  24.     @light_effects = []
  25.   end  
  26.   def update   
  27.     les_spriteset_map_update
  28.     update_light_effects
  29.   end
  30.   def refresh_characters
  31.     m5_spriteset_map_refresh_characters
  32.     refresh_light
  33.   end
  34.   def refresh_light
  35.     dispose_light
  36.     creat_light
  37.     update
  38.   end
  39.   
  40.   def setup_lights
  41.     for event in $game_map.events.values
  42.       next if event.list == nil
  43.       for i in 0...event.list.size
  44.         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
  45.           type = "GROUND"
  46.           light_effects = Light_Effect.new(event,type)
  47.           light_effects.light.zoom_x = 2
  48.           light_effects.light.zoom_y = 2
  49.           light_effects.light.opacity = 100
  50.           @light_effects.push(light_effects)
  51.         end
  52.         if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
  53.           type = "FIRE"
  54.           light_effects = Light_Effect.new(event,type)
  55.           light_effects.light.zoom_x = 300 / 100.0
  56.           light_effects.light.zoom_y = 300 / 100.0
  57.           light_effects.light.opacity = 100
  58.           @light_effects.push(light_effects)
  59.         end
  60.         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
  61.           type = "LIGHT"
  62.           light_effects = Light_Effect.new(event,type)
  63.           light_effects.light.zoom_x = 1
  64.           light_effects.light.zoom_y = 1
  65.           light_effects.light.opacity = 150
  66.           @light_effects.push(light_effects)
  67.         end
  68.         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
  69.           type = "LIGHT2"
  70.           light_effects = Light_Effect.new(event,type)
  71.           light_effects.light.zoom_x = 6
  72.           light_effects.light.zoom_y = 6
  73.           light_effects.light.opacity = 150
  74.           @light_effects.push(light_effects)
  75.         end
  76.         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
  77.           type = "TORCH"
  78.           light_effects = Light_Effect.new(event,type)
  79.           light_effects.light.zoom_x = 6
  80.           light_effects.light.zoom_y = 6
  81.           light_effects.light.opacity = 150
  82.           @light_effects.push(light_effects)
  83.         end
  84.         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
  85.           type = "TORCH2"
  86.           light_effects = Light_Effect.new(event,type)
  87.           light_effects.light.zoom_x = 6
  88.           light_effects.light.zoom_y = 6
  89.           light_effects.light.opacity = 150
  90.           @light_effects.push(light_effects)
  91.         end
  92.       end
  93.     end
  94.     for effect in @light_effects
  95.       case effect.type
  96.       when "GROUND"
  97.         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  98.         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  99.         effect.light.blend_type = 1
  100.       when "FIRE"
  101.         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
  102.         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
  103.         effect.light.tone = Tone.new(255,-100,-255,   0)
  104.         effect.light.blend_type = 1
  105.       when "LIGHT"
  106.         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  107.         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  108.         effect.light.blend_type = 1
  109.       when "LIGHT2"
  110.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  111.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  112.         effect.light.blend_type = 1
  113.       when "TORCH"
  114.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  115.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  116.         effect.light.tone = Tone.new(255,-100,-255,   0)
  117.         effect.light.blend_type = 1
  118.       when "TORCH2"
  119.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  120.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  121.         effect.light.tone = Tone.new(255,-100,-255,   0)
  122.         effect.light.blend_type = 1
  123.       end
  124.     end
  125.   end
  126.   def update_light_effects
  127.     if $game_switches[$lsig]
  128.       for effect in @light_effects
  129.         effect.light.visible = false
  130.       end
  131.     else
  132.       for effect in @light_effects

  133.         effect.light.visible = true
  134.       end
  135.     end
  136.     for effect in @light_effects
  137.       case effect.type
  138.       when "GROUND"
  139.         effect.light.x = (effect.event.screen_x * 8 - 400 - $game_map.display_x) / 8 - 8
  140.         effect.light.y = (effect.event.screen_y * 8 - 400 - $game_map.display_y) / 8 - 36
  141.       when "FIRE"
  142.         effect.light.x = (effect.event.screen_x * 8 - 600 - $game_map.display_x) / 8 + rand(6) - 3 - 16
  143.         effect.light.y = (effect.event.screen_y * 8 - 600 - $game_map.display_y) / 8 + rand(6) - 3 - 48
  144.         effect.light.opacity = rand(10) + 90
  145.       when "LIGHT"
  146.         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  147.         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  148.       when "LIGHT2"
  149.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 32
  150.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 - 32
  151.       when "TORCH"
  152.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
  153.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8 + rand(20) - 10
  154.         effect.light.opacity = rand(30) + 70
  155.       when "TORCH2"
  156.         effect.light.x = (effect.event.screen_x * 8 - 1200 - $game_map.display_x) / 8 - 20
  157.         effect.light.y = (effect.event.screen_y * 8 - 1200 - $game_map.display_y) / 8
  158.         effect.light.opacity = rand(10) + 90
  159.       end
  160.     end
  161.   end
  162. end

  163. class Light_Effect
  164.   attr_accessor :light
  165.   attr_accessor :event
  166.   attr_accessor :type
  167.   def initialize(event, type)
  168.     [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new
  169.     @light.bitmap = Cache.picture("le.png")
  170.     @light.visible = true
  171.     @light.z = 1
  172.     @event = event
  173.     @type = type
  174.   end  
  175. end
复制代码
记得自己把173行论坛添加的[url]删掉

评分

参与人数 3星屑 +60 梦石 +1 收起 理由
熊喵酱 + 30 好感動~
Sion + 1 太感动了
没是的人 + 30

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1058
在线时间
878 小时
注册时间
2012-6-28
帖子
1079
3
 楼主| 发表于 2013-10-12 16:58:33 | 只看该作者
喵呜喵5 发表于 2013-10-12 13:17
记得自己把173行论坛添加的删掉

谢谢,谢谢,谢谢,大好人啊,太感动了

点评

@迷糊的安安  发表于 2013-10-12 17:00
不追求华丽的商业素材;不依赖与自己运用能力不符的外挂脚本;不搞华而不实的无用噱头。
                    修改,使用最朴实的素材,融入自己的智慧做最好的游戏!
                                    点这里!暂不设加入门槛
         
                               我觉得我的优点是,会认真的画每一张地图。
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-6 21:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表