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

Project1

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

[RMVX发布] RMVX 教你怎么在晚上做到自动开灯效果

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2012-11-6
帖子
36
跳转到指定楼层
1
发表于 2014-1-19 18:16:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
首先我们要有1个灯光脚本和一个昼夜交替事件
灯光脚本是用Kylock的
先放效果

NIGHT.png (243.32 KB, 下载次数: 21)

NIGHT.png

NIGHT1.png (211.56 KB, 下载次数: 12)

NIGHT1.png

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2012-11-6
帖子
36
来自 11楼
 楼主| 发表于 2014-1-20 17:41:46 | 只看该作者
直接上范例

Project7.rar

257.81 KB, 下载次数: 191

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2012-11-6
帖子
36
2
 楼主| 发表于 2014-1-19 18:21:30 | 只看该作者
  1. #==============================================================================
  2. # ■ 灯光脚本 for VX 版本1.1.1
  3. #     5.21.2008
  4. #------------------------------------------------------------------------------
  5. #  脚本制作: Kylock (For XP 版本 by Near Fantastica)
  6. #==============================================================================
  7. #   如果您想要启用脚本,请在需要灯光效果的事件添加一个注释.
  8. #   打开开关将禁用灯光效果,启用效果前会检查开关,如果已经添加注释但是开关开启,那么将会停止效果.
  9. #   译者的话:因为发现脚本有一些问题,所以是有改动过的,如果改的不对,请M我QQ或者留言.谢谢
  10. #
  11. #==============================================================================
  12. # ● 更新日志
  13. #------------------------------------------------------------------------------
  14. # 1.0 - 建立最初版本
  15. # 1.1 - 添加了新的效果: LIGHT2, TORCH, TORCH2
  16. #      - 更改了混合模式(使其看起来更好)
  17. #      - 对FIRE效果增加了红色
  18. # 1.1.1 -非官方更新
  19. #         -解决了效果FIRE 与 TORCH 效果当开关打开时没有消失的问题
  20. #         -简便了开关判断
  21. #==============================================================================
  22. # ● 支持的效果(您可以添加的注释)
  23. #------------------------------------------------------------------------------
  24. #   GROUND - 中等稳定的白光.
  25. #   FIRE   - 伴有轻微的闪烁的红色.
  26. #   LIGHT  - 小型稳定的白光.
  27. #   LIGHT2 -大型稳定的白光.
  28. #   TORCH  - 伴有强烈闪烁的大型稳定的红光.
  29. #   TORCH2 - 伴有中等烁的大型稳定的红光.
  30. #==============================================================================

  31.   $lsig = 10           #开关号


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

  146.         effect.light.visible = true
  147.       end
  148.     end
  149.     for effect in @light_effects
  150.       case effect.type
  151.       when "GROUND"
  152.         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  153.         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  154.       when "FIRE"
  155.         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
  156.         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
  157.         effect.light.opacity = rand(10) + 90
  158.       when "LIGHT"
  159.         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  160.         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  161.       when "LIGHT2"
  162.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  163.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  164.       when "TORCH"
  165.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
  166.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8 + rand(20) - 10
  167.         effect.light.opacity = rand(30) + 70
  168.       when "TORCH2"
  169.         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  170.         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  171.         effect.light.opacity = rand(10) + 90
  172.       end
  173.     end
  174.   end
  175. end

  176. class Light_Effect
  177.   attr_accessor :light
  178.   attr_accessor :event
  179.   attr_accessor :type
  180.   def initialize(event, type)
  181.     [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new
  182.     @light.bitmap = Cache.picture("le.png")
  183.     @light.visible = true
  184.     @light.z = 1000
  185.     @event = event
  186.     @type = type
  187.   end
  188. end
复制代码
!!!注意如果要用灯光脚 前把图插入Pictures中

le.png (1.46 KB, 下载次数: 52)

le.png

评分

参与人数 1星屑 +20 收起 理由
不会脚本 + 20 点赞

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2012-11-6
帖子
36
3
 楼主| 发表于 2014-1-19 18:45:26 | 只看该作者
- - 我现在有事 明天继续
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
271
在线时间
2088 小时
注册时间
2011-7-28
帖子
1145
4
发表于 2014-1-19 19:07:47 | 只看该作者
3连帖……叫版主帮你合并一下@Sion @fux2 @protosssonny  

点评

素材也分开发了……就这样吧不合并了。只要不是恶意连帖就没事。  发表于 2014-1-20 14:54
[color=Red][b]我没有签名[/b][/color]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
167
在线时间
434 小时
注册时间
2009-1-1
帖子
643
5
发表于 2014-1-19 19:14:06 | 只看该作者
确定是原创脚本?如果不是的话似乎地球村会比较适合?
最近在研究XAS
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2012-11-6
帖子
36
6
 楼主| 发表于 2014-1-19 22:08:08 手机端发表。 | 只看该作者
赛露休斯 发表于 2014-1-19 19:14
确定是原创脚本?如果不是的话似乎地球村会比较适合?

原来地球村才是放教程的OTZ
雖然脚本不是原创的
但是晚上自动开灯这个效果是原创的
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2012-11-6
帖子
36
7
 楼主| 发表于 2014-1-19 22:09:08 手机端发表。 | 只看该作者
不会脚本 发表于 2014-1-19 19:07
3连帖……叫版主帮你合并一下@Sion @fux2 @protosssonny

啊 谢谢
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
7 小时
注册时间
2014-1-20
帖子
6
8
发表于 2014-1-20 09:37:45 | 只看该作者
打开游戏时弹出该脚本第186行发生syntaxerror
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
90 小时
注册时间
2012-11-6
帖子
36
9
 楼主| 发表于 2014-1-20 16:38:47 手机端发表。 | 只看该作者
雷勒德瓦 发表于 2014-1-20 09:37
打开游戏时弹出该脚本第186行发生syntaxerror

你有没有導入图片?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
7 小时
注册时间
2014-1-20
帖子
6
10
发表于 2014-1-20 16:57:17 | 只看该作者
弄进去了啊,大小写都检查了一遍
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-6-10 18:54

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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