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

Project1

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

[已经解决] 关于在地图中光照效果的问题。

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
23 小时
注册时间
2013-3-12
帖子
74
跳转到指定楼层
1
发表于 2013-3-13 14:27:31 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
依然是小生,请问各位大大,P叔的第六套题中有个光照效果的题目,请问如何将光照效果应用到各个地图当中去?

Lv3.寻梦者

梦石
0
星屑
1246
在线时间
422 小时
注册时间
2011-6-30
帖子
497
来自 2楼
发表于 2013-3-13 15:08:26 | 只看该作者
显示图片就行了,不消除图片的话,图片是一直都在的,题目里附加了一张光照的图。
PS:话说不是有标准答案的吗?

点评

我想靠自己的理解去做 呵呵  发表于 2013-3-13 15:43

评分

参与人数 1星屑 +50 收起 理由
怪蜀黍 + 50 认可答案

查看全部评分

点这里给我发邮件
有事欢迎给我发邮件哟~~
不出意外的话都会回复的哟~~~
邮箱:[email protected]
个人主页:curatorjin.github.io
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
191
在线时间
835 小时
注册时间
2012-9-16
帖子
1811
3
发表于 2013-3-13 18:08:13 | 只看该作者
我又来回答啦~~~

这是脚本,请复制到工程的脚本编辑器里,在工程地图绘制或设置事件时按下F11快捷键就可以打开。
  1. =begin
  2.                               Thomas Edison VX

  3. Version: 0.1
  4. Author: BulletXt ([email protected])
  5. Date: 12/06/2009
  6. Script based upon Kylock's (http://www.rpgmakervx.net/index.php?showtopic=2432)


  7. Description:
  8. To make an event glow, put a Comment inside event with one of the following
  9. light modes. When importing this script to a new project, be sure to copy
  10. Graphics/Pictures/le.png to your project.

  11. Light Modes:
  12.   
  13. GROUND - Medium steady white light.
  14. GROUND2 - Medium white light with slight flicker.
  15. GROUND3 - Small steady red light.
  16. GROUND4 - Medium steady green light.
  17. GROUND5 - Medium steady blu light.
  18. FIRE - Large red light with a slight flicker.
  19. LIGHT - Small steady white light.
  20. LIGHT2 - X-Large steady white light.
  21. LIGHT3 - Small white light with slight flicker.
  22. TORCH - X-Large red light with a heavy flicker.
  23. TORCH2 - X-Large red light with a sleight flicker.
  24. TORCH3 - Large white light with a slight flicker.

  25. You can make a specific light type turn off/on by turning
  26. one of the following switches id ON/off. By default, the switches are off so
  27. the lights will show. Of course, turning all switches to ON will make all
  28. light types go off.

  29. =end

  30. #id switch that if ON turns off FIRE mode lights
  31. #applies only to light mode: FIRE
  32. FIRE = 264
  33. #id switch that if ON turns off LIGHT mode lights
  34. #applies to light mode: LIGHT, LIGHT2, LIGHT3
  35. LIGHT = 265
  36. #id switch that if ON turns off GROUND mode lights
  37. #applies to light mode: GROUND, GROUND2, GROUND3, GROUND4, GROUND5
  38. GROUND = 266
  39. #id switch that if ON turns off TORCH mode lights
  40. #applies to light mode: TORCH, TORCH2, TORCH3
  41. TORCH = 267


  42. # this value can be true or false. If true, it enables compatibility with
  43. # KGC_DayNight script. When it's night, lights will automatically go on, when
  44. # morning comes back lights will go off. If you set this to true, be sure to
  45. # place this script below KGC_DayNight script in the Scripting Editor of VX.
  46. ENABLE_KGC_DAY_NIGHT_SCRIPT = true

  47. =begin
  48. This value must be exactly the same of "PHASE_VARIABLE" setting in KGC_DayNight
  49. script. By default the script sets it to 11.
  50. To make the event light go on/off with DayNight system, set the event page
  51. to be triggered with this variable id and set it to be 1 or above.
  52. =end
  53. KGC_DAY_NIGHT_SCRIPT_VARIABLE = 11

  54. =begin
  55. Tips and tricks:
  56.   You can't make a single specific light inside event go on/off if
  57.   a condition applies, for example if a switch is ON.
  58.   For the moment, you can achieve this by doing
  59.   a script call immediatley after you make the condition apply.
  60.   If for example the light event must go on if switch 100 is ON, after you turn
  61.   on the switch do this call script:
  62.   $scene = Scene_Map.new
  63.   
  64.   Be aware that doing this call script will make game freeze
  65.   for 30 milliseconds.

  66. ################################################################################
  67. =end


  68. $bulletxt_day_check = 0

  69. class Spriteset_Map
  70.        
  71.   alias bulletxt_spriteset_map_initalize initialize
  72.         def initialize
  73.                 @light_effects = []
  74.                 initialize_lights
  75.                 bulletxt_spriteset_map_initalize
  76.                 update
  77.         end

  78.   alias bulletxt_spriteset_map_dispose dispose
  79.         def dispose
  80.                 bulletxt_spriteset_map_dispose
  81.                 for effect in @light_effects
  82.                         effect.light.dispose
  83.                 end
  84.                 @light_effects = []
  85.         end
  86.        
  87.   alias bulletxt_spriteset_map_update update
  88.         def update
  89.                 bulletxt_spriteset_map_update
  90.     check_day_night if ENABLE_KGC_DAY_NIGHT_SCRIPT
  91.                 update_light_effects
  92.    
  93.         end

  94.   
  95.   def check_day_night
  96.     #if night
  97.    if $bulletxt_day_check == 0
  98.     if $game_variables[KGC_DAY_NIGHT_SCRIPT_VARIABLE] == 1
  99.       $scene = Scene_Map.new
  100.       $bulletxt_day_check = 1
  101.   
  102.     end
  103.    
  104.   else
  105.     #if morning
  106.     if $game_variables[KGC_DAY_NIGHT_SCRIPT_VARIABLE] == 3
  107.       $game_variables[KGC_DAY_NIGHT_SCRIPT_VARIABLE] = -1
  108.       $scene = Scene_Map.new
  109.       $bulletxt_day_check = 0
  110.     end
  111.   end
  112.   
  113.    
  114.    
  115.   end
  116.   
  117.   
  118.         def initialize_lights
  119.                 for event in $game_map.events.values
  120.                         next if event.list == nil
  121.                                 for i in 0...event.list.size

  122.                                         if event.list[i].code == 108 and event.list[i].parameters == ["FIRE"]
  123.                                                 type = "FIRE"
  124.                                                 light_effects = Light_Effect.new(event,type)
  125.                                                 light_effects.light.zoom_x = 300 / 100.0
  126.                                                 light_effects.light.zoom_y = 300 / 100.0
  127.                                                 light_effects.light.opacity = 100
  128.                                                 @light_effects.push(light_effects)
  129.                                         end
  130.          
  131.                                         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT"]
  132.                                                 type = "LIGHT"
  133.                                                 light_effects = Light_Effect.new(event,type)
  134.                                                 light_effects.light.zoom_x = 1
  135.                                                 light_effects.light.zoom_y = 1
  136.                                                 light_effects.light.opacity = 150
  137.                                                 @light_effects.push(light_effects)
  138.                                         end
  139.                                         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT2"]
  140.                                                 type = "LIGHT2"
  141.                                                 light_effects = Light_Effect.new(event,type)
  142.                                                 light_effects.light.zoom_x = 6
  143.                                                 light_effects.light.zoom_y = 6
  144.                                                 light_effects.light.opacity = 150
  145.                                                 @light_effects.push(light_effects)
  146.                                         end

  147.                                         if event.list[i].code == 108 and event.list[i].parameters == ["LIGHT3"]
  148.                                                 type = "LIGHT3"
  149.                                                 light_effects = Light_Effect.new(event,type)
  150.                                                 light_effects.light.zoom_x = 1
  151.                                                 light_effects.light.zoom_y = 1
  152.                                                 light_effects.light.opacity = 150
  153.                                                 @light_effects.push(light_effects)
  154.                                         end
  155.          
  156.                                         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH"]
  157.                                                 type = "TORCH"
  158.                                                 light_effects = Light_Effect.new(event,type)
  159.                                                 light_effects.light.zoom_x = 6
  160.                                                 light_effects.light.zoom_y = 6
  161.                                                 light_effects.light.opacity = 150
  162.                                                 @light_effects.push(light_effects)
  163.                                         end
  164.                                         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH2"]
  165.                                                 type = "TORCH2"
  166.                                                 light_effects = Light_Effect.new(event,type)
  167.                                                 light_effects.light.zoom_x = 6
  168.                                                 light_effects.light.zoom_y = 6
  169.                                                 light_effects.light.opacity = 150
  170.                                                 @light_effects.push(light_effects)
  171.                                         end
  172.                                         if event.list[i].code == 108 and event.list[i].parameters == ["TORCH3"]
  173.                                                 type = "TORCH3"
  174.                                                 light_effects = Light_Effect.new(event,type)
  175.                                                 light_effects.light.zoom_x = 300 / 100.0
  176.                                                 light_effects.light.zoom_y = 300 / 100.0
  177.                                                 light_effects.light.opacity = 100
  178.                                                 @light_effects.push(light_effects)
  179.                                         end
  180.          
  181.                                         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND"]
  182.                                                 type = "GROUND"
  183.                                                 light_effects = Light_Effect.new(event,type)
  184.                                                 light_effects.light.zoom_x = 2
  185.                                                 light_effects.light.zoom_y = 2
  186.                                                 light_effects.light.opacity = 100
  187.                                                 @light_effects.push(light_effects)
  188.                                         end
  189.                                         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND2"]
  190.                                                 type = "GROUND2"
  191.                                                 light_effects = Light_Effect.new(event,type)
  192.                                                 light_effects.light.zoom_x = 2
  193.                                                 light_effects.light.zoom_y = 2
  194.                                                 light_effects.light.opacity = 100
  195.                                                 @light_effects.push(light_effects)
  196.                                         end
  197.                                         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND3"]
  198.                                                 type = "GROUND3"
  199.                                                 light_effects = Light_Effect.new(event,type)
  200.                                                 light_effects.light.zoom_x = 2
  201.                                                 light_effects.light.zoom_y = 2
  202.                                                 light_effects.light.opacity = 100
  203.                                                 @light_effects.push(light_effects)
  204.                                         end
  205.                                         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND4"]
  206.                                                 type = "GROUND4"
  207.                                                 light_effects = Light_Effect.new(event,type)
  208.                                                 light_effects.light.zoom_x = 2
  209.                                                 light_effects.light.zoom_y = 2
  210.                                                 light_effects.light.opacity = 100
  211.                                                 @light_effects.push(light_effects)
  212.                                         end
  213.                                         if event.list[i].code == 108 and event.list[i].parameters == ["GROUND5"]
  214.                                                 type = "GROUND5"
  215.                                                 light_effects = Light_Effect.new(event,type)
  216.                                                 light_effects.light.zoom_x = 2
  217.                                                 light_effects.light.zoom_y = 2
  218.                                                 light_effects.light.opacity = 100
  219.                                                 @light_effects.push(light_effects)
  220.                                         end
  221.                                 end
  222.                         end
  223.                        
  224.         for effect in @light_effects
  225.                 case effect.type
  226.                
  227.                 when "FIRE"
  228.                         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
  229.                         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
  230.                         effect.light.tone = Tone.new(255,-100,-255, 0)
  231.                         effect.light.blend_type = 1
  232.                 when "LIGHT"
  233.                         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  234.                         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  235.                         effect.light.blend_type = 1
  236.                 when "LIGHT2"
  237.                         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  238.                         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  239.                         effect.light.blend_type = 1
  240.                 when "LIGHT3"
  241.                         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  242.                         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  243.                         effect.light.blend_type = 1
  244.                 when "TORCH"
  245.                         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  246.                         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  247.                         effect.light.tone = Tone.new(255,-100,-255, 0)
  248.                         effect.light.blend_type = 1
  249.                 when "TORCH2"
  250.                         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  251.                         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  252.                         effect.light.tone = Tone.new(255,-100,-255, 0)
  253.                         effect.light.blend_type = 1
  254.                 when "TORCH3"
  255.                         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
  256.                         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
  257.                         effect.light.blend_type = 1
  258.       
  259.                 when "GROUND"
  260.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  261.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  262.                         effect.light.blend_type = 1
  263.                 when "GROUND2"
  264.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  265.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  266.                         effect.light.blend_type = 1
  267.                 when "GROUND3"
  268.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  269.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  270.                         effect.light.tone = Tone.new(255,-255,-255, 255)
  271.                         effect.light.blend_type = 1
  272.                 when "GROUND4"
  273.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  274.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  275.                         effect.light.tone = Tone.new(-255,255,-255, 100)
  276.                         effect.light.blend_type = 1
  277.                 when "GROUND5"
  278.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  279.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  280.                         effect.light.tone = Tone.new(-255,255,255, 100)
  281.                         effect.light.blend_type = 1
  282.                 end
  283.         end
  284. end


  285. def update_light_effects
  286. ################################################################################
  287.   
  288.   # handle FIRE
  289.   if $game_switches[FIRE]
  290.     for effect in @light_effects
  291.       next if effect.type != "FIRE"
  292.       effect.light.visible = false
  293.     end
  294.   else
  295.     for effect in @light_effects
  296.      next if effect.type != "FIRE"
  297.       effect.light.visible = true
  298.     end
  299.   end

  300.   # handle LIGHT
  301.   if $game_switches[LIGHT]
  302.     for effect in @light_effects
  303.       next if effect.type != "LIGHT" && effect.type != "LIGHT2" && effect.type != "LIGHT3"
  304.       effect.light.visible = false
  305.     end
  306.   else
  307.     for effect in @light_effects
  308.       next if effect.type != "LIGHT" && effect.type != "LIGHT2" && effect.type != "LIGHT3"
  309.       effect.light.visible = true
  310.     end
  311.   end


  312.   # handle GROUND
  313.   if $game_switches[GROUND]
  314.     for effect in @light_effects
  315.       next if effect.type != "GROUND" && effect.type != "GROUND2" && effect.type != "GROUND3" && effect.type != "GROUND4" && effect.type != "GROUND5"
  316.       effect.light.visible = false
  317.     end
  318.   else
  319.     for effect in @light_effects
  320.       next if effect.type != "GROUND" && effect.type != "GROUND2" && effect.type != "GROUND3" && effect.type != "GROUND4" && effect.type != "GROUND5"
  321.       effect.light.visible = true
  322.     end
  323.   end


  324.   # handle TORCH
  325.   if $game_switches[TORCH]
  326.     for effect in @light_effects
  327.       next if effect.type != "TORCH" && effect.type != "TORCH2" && effect.type != "TORCH3"
  328.       effect.light.visible = false
  329.     end
  330.   else
  331.     for effect in @light_effects
  332.       next if effect.type != "TORCH" && effect.type != "TORCH2" && effect.type != "TORCH3"
  333.       effect.light.visible = true
  334.     end
  335.   end





  336. ################################################################################

  337.         for effect in @light_effects
  338.                 case effect.type

  339.         when "FIRE"
  340.                         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
  341.                         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
  342.                         effect.light.opacity = rand(10) + 90
  343.       
  344.         when "LIGHT"
  345.                         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  346.                         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  347.         when "LIGHT2"
  348.                         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  349.                         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  350.         when "LIGHT3"
  351.                         effect.light.x = (-0.25 / 2 * $game_map.display_x) + (effect.event.x * 32) - 15
  352.                         effect.light.y = (-0.25 / 2 * $game_map.display_y) + (effect.event.y * 32) - 15
  353.                         effect.light.opacity = rand(10) + 90
  354.       
  355.         when "TORCH"
  356.                         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20 + rand(20) - 10
  357.                         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8 + rand(20) - 10
  358.                         effect.light.opacity = rand(30) + 70
  359.         when "TORCH2"
  360.                         effect.light.x = (effect.event.real_x - 1200 - $game_map.display_x) / 8 - 20
  361.                         effect.light.y = (effect.event.real_y - 1200 - $game_map.display_y) / 8
  362.                         effect.light.opacity = rand(10) + 90
  363.         when "TORCH3"
  364.                         effect.light.x = (effect.event.real_x - 600 - $game_map.display_x) / 8 + rand(6) - 3
  365.                         effect.light.y = (effect.event.real_y - 600 - $game_map.display_y) / 8 + rand(6) - 3
  366.                         effect.light.opacity = rand(10) + 90
  367.       
  368.         when "GROUND"
  369.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  370.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  371.         when "GROUND2"
  372.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  373.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  374.                         effect.light.opacity = rand(10) + 90
  375.         when "GROUND3"
  376.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  377.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  378.         when "GROUND4"
  379.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  380.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  381.         when "GROUND5"
  382.                         effect.light.x = (effect.event.real_x - 400 - $game_map.display_x) / 8
  383.                         effect.light.y = (effect.event.real_y - 400 - $game_map.display_y) / 8
  384.                 end
  385.         end

  386.   #close def
  387.         end
  388. #close class       
  389. end


  390. class Light_Effect
  391.         attr_accessor :light
  392.         attr_accessor :event
  393.         attr_accessor :type
  394.        
  395.         def initialize(event, type)
  396.                 [url=home.php?mod=space&uid=22469]@light[/url] = Sprite.new
  397.                 @light.bitmap = Cache.picture("le.png")
  398.                 @light.visible = true
  399.                 @light.z = 1000
  400.                 @event = event
  401.                 @type = type
  402.         end

  403. end
复制代码
请你先插入那个le.png的图片,然后放在那个对应的文件夹里。然后,你可以在你想要的夜晚[白天有发光的灯也是有的]地图里加上个事件,设置为自动执行。事件内容是:
更改画面色调。大概是-100-100-100 0.然后暂时消除事件。然后在要发光的事件里设置下,触发为确定键。然后事件里就加个注释。注释里的灯光可以参见这个灯光脚本17-28行。
至于那个灯光脚本17-28行,你可以用谷歌翻译。

点评

晕,大哥,我就是想弄个地图的效果而已,你弄那么一大串,太复杂了吧。  发表于 2013-3-14 13:23
烛光脚本。。。  发表于 2013-3-13 19:39
他好像问的是考场的第六套题。  发表于 2013-3-13 18:22

评分

参与人数 1星屑 +1 收起 理由
0newing + 1 塞糖。。。

查看全部评分


——旧坑欢迎戳
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-30 09:35

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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