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

Project1

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

[已经过期] 地形特效脚本使用

[复制链接]

Lv1.梦旅人

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

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

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

x
本帖最后由 kkwo 于 2014-1-11 21:00 编辑

我找到一个配合地图区域ID显示不同的效果的脚本
(就是走在不同的地形可以有不同的效果和声音)
不知道哪出了问题
范本中的档案测试没问题
可是我複製到我的档案在测试的时候一踏上地形就出问题...
哪怕开一个新的档案...

我也有照着使用说明将图片跟地图都複製过去了...

调整项目那边我只看到ID跟音效的
也没看到显示效果要在哪调整...
所以想请问有谁能告诉我该怎麽做才能让脚本正常运作?
以下附上脚本和范例
Region Effectsv1.9.rar (1.49 MB, 下载次数: 67)
RUBY 代码复制
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Region Effects
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.9
  6. #  Credit to Yanfly and Quack for event spawning method
  7. #------------------------------------------------------------------------------#
  8. #  2014-01-07 - Version 1.9 - upgrade to not stop animations playing when a
  9. #                             region effect is drawn.
  10. #  2013-01-24 - Version 1.8 - minor tweaks
  11. #  2013-01-22 - Version 1.7 - Made effects work during forced move routes
  12. #  2012-11-15 - Version 1.6 - Fixed a major bug caused with last update.
  13. #  2012-11-04 - Version 1.5 - streamline updates and bug fix suggested by Quack
  14. #  2012-10-23 - Version 1.4 - updated alias naming convention for compatability
  15. #  2012-10-09 - Version 1.3 - re-wrote the code to be more efficient when
  16. #                           - using many different region effects.
  17. #  2012-10-09 - Version 1.2 - code tweak that may reduce lag on low-end pc's
  18. #  2012-09-16 - Version 1.1 - now compatible with Yanfly's spawn events
  19. #  2012-09-15 - Version 1.0 - release
  20. #------------------------------------------------------------------------------#
  21. #  Designed to activate effects when regions are stood on.
  22. #  An effect can include:
  23. #     - Sound Effect
  24. #     - An event that appears at the player's location
  25. #     - Activating a common event
  26. #
  27. #
  28. #  INSTRUCTIONS:
  29. #  1. Copy image from /Graphics/Characters/!Other-specials.png to your project
  30. #  2. Copy the map from this demo into your game.
  31. #        - this map has events set up for the pre-made effects
  32. #  3. Check the map ID of the map you copied in your game
  33. #  4. Change the SPAWN_MAP_ID number to this map ID
  34. #  5. Change REGION_EFFECT_SWITCH to a switch you are not using in your game.
  35. #  6. Add some regions to your map to test.
  36. #
  37. #
  38. #
  39. #  To disable region effects use
  40. #  $game_player.region_effects = false
  41. #
  42. #------------------------------------------------------------------------------#
  43.  
  44. $imported = {} if $imported.nil?
  45. $imported["Region_Effects"] = true
  46.  
  47. module Region_Effects
  48. #------------------------------------------------------------------------------#
  49. #  SCRIPT SETUP OPTIONS
  50. #------------------------------------------------------------------------------#
  51.  
  52.    REGION_EFFECT_SWITCH = 1   # Turn this switch ON to disable the effects.
  53.  
  54.    MAX_EFFECTS = 20           # Number of effects that can be on screen
  55.                               # before being removed. (To prevent lag)
  56.  
  57.    SPAWN_MAP_ID = 2           # Map ID of the map you store event effects in.
  58.  
  59.  
  60.  
  61. #------------------------------------------------------------------------------#
  62. #  ENVIRONMENT REGIONS SETUP
  63. #------------------------------------------------------------------------------#
  64. #------------------------------------------------------------------------------#
  65. #
  66. #  region => ["sound", vol, pitch, event_id, common_event_id]
  67. #
  68. #  region          -  the region ID the effect will activate on
  69. #  sound           -  the name of the SE file. "" for no sound
  70. #  vol             -  the volume of the SE (0 - 100)
  71. #  pitch           -  the pitch of the SE (50 - 150)
  72. #  event_id        -  event ID called from the spawn map. 0 for none.
  73. #  common_event_id -  common event ID to call. 0 for no common event.
  74. #
  75. #------------------------------------------------------------------------------#
  76.     EFFECT = { # ! don't touch this
  77. #------------------------------------------------------------------------------#
  78.  
  79.     0 => ["", 0, 0, 0, 0],              # No Effect (no region)
  80.  
  81.     # Pre-made effects (requires demo events)
  82.     1 => ["", 0, 0, 5, 0],              # Dirt dust
  83.     2 => ["Blow7", 60, 150, 0, 0],      # Wood surface noise only
  84.     3 => ["Water1", 60, 110, 1, 0],     # Shallow Water
  85.  
  86.     18 => ["Earth2", 40, 130, 0, 0],     # Hard surface noise only
  87.     5 => ["Damage3", 40, 150, 2, 0],    # Footprints
  88.     6 => ["Ice9", 50, 130, 3, 0],       # Walking over thick grass
  89.     7 => ["", 0, 0, 0, 1],              # Calls common event 1 only
  90.     8 => ["Fire3", 80, 120, 4, 2],      # Calls fire trap
  91.     37 => ["", 80, 120, 6, 0],          # Dust cloud
  92.  
  93.     # You can add more as required. eg:
  94.     # 42 => ["", 0, 0, 0, 0],
  95.     # 18 => ["", 0, 0, 0, 0],
  96.     # etc. etc.
  97.  
  98.     # Only one effect per region number will work
  99.  
  100. #------------------------------------------------------------------------------#
  101.     } # ! don't touch this
  102. #------------------------------------------------------------------------------#
  103. #  END SCRIPT SETUP
  104. #------------------------------------------------------------------------------#
  105.  
  106. end # Region_Effects
  107.  
  108. module DataManager
  109.  
  110. #--------------------------------------------------------------------------
  111. # alias method: load_normal_database
  112. #--------------------------------------------------------------------------
  113. class <<self; alias load_normal_database_spawn_alias load_normal_database; end
  114.   def self.load_normal_database
  115.     load_normal_database_spawn_alias
  116.     $data_spawn_map = load_data(sprintf("Data/Map%03d.rvdata2", Region_Effects::SPAWN_MAP_ID))
  117.   end
  118. end
  119.  
  120. class Game_Player < Game_Character
  121.   attr_accessor :region_effects
  122.  
  123.   alias galv_region_effects_update_update_nonmoving update_nonmoving
  124.   def update_nonmoving(last_moving)
  125.     if last_moving
  126.       galv_region_check unless $game_switches[Region_Effects::REGION_EFFECT_SWITCH] == true
  127.     end
  128.     galv_region_effects_update_update_nonmoving(last_moving)
  129.   end
  130.  
  131.   def galv_region_check
  132.     return if Input.trigger?(:C)
  133.     v = rand(10) - rand(10)
  134.     p = rand(40) - rand(40)
  135.  
  136.     r_id = $game_map.region_id($game_player.x, $game_player.y)
  137.     return if Region_Effects::EFFECT[r_id] == nil
  138.  
  139.     sound = Region_Effects::EFFECT[r_id][0]
  140.     vol = Region_Effects::EFFECT[r_id][1]
  141.       pit = Region_Effects::EFFECT[r_id][2]
  142.       eve = Region_Effects::EFFECT[r_id][3]
  143.       com_eve = Region_Effects::EFFECT[r_id][4]
  144.  
  145.       RPG::SE.new(sound, vol + v, pit + p).play
  146.       if eve > 0
  147.         $game_map.region_event($game_player.x, $game_player.y, eve, Region_Effects::SPAWN_MAP_ID)
  148.       end
  149.       $game_temp.reserve_common_event(com_eve) unless com_eve == nil
  150.   end
  151.  
  152.  
  153. end # Game_Player
  154.  
  155.  
  156.  
  157. class Game_Map
  158.   attr_accessor :effectlist
  159.   attr_accessor :r_events
  160.  
  161.   alias galv_region_effects_setup setup
  162.   def setup(map_id)
  163.     @effectlist = []
  164.     @r_events = {}
  165.     galv_region_effects_setup(map_id)
  166.  
  167.     @eid = 0
  168.   end
  169.  
  170.   def region_event(dx, dy, event_id, map_id)
  171.     map_id = @map_id if map_id == 0
  172.     map = $data_spawn_map
  173.     event = generated_region_event(map, event_id)
  174.  
  175.     @eid += 1
  176.     @effectlist.push(@eid)
  177.     @effectlist.shift if @effectlist.count > Region_Effects::MAX_EFFECTS
  178.  
  179.     @r_events[@eid] = Game_Event.new(@map_id, event)
  180.     @r_events[@eid].moveto(dx, dy)
  181.     SceneManager.scene.spriteset.refresh_region_effects
  182.  
  183.     @eid = 0 if @eid >= Region_Effects::MAX_EFFECTS
  184.   end
  185.  
  186.  
  187.   def generated_region_event(map, event_id)
  188.     for key in map.events
  189.       event = key[1]
  190.       next if event.nil?
  191.       return event if event.id == event_id
  192.     end
  193.     return nil
  194.   end
  195.  
  196.   alias galv_region_effects_gm_refresh refresh
  197.   def refresh
  198.     @r_events.each_value {|event| event.refresh }
  199.     galv_region_effects_gm_refresh
  200.   end
  201.  
  202.   alias galv_region_effects_gm_update_events update_events
  203.   def update_events
  204.     @r_events.each_value {|event| event.update }
  205.     galv_region_effects_gm_update_events
  206.   end
  207.  
  208. end # Game_Map
  209.  
  210.  
  211.  
  212. class Spriteset_Map
  213.   def refresh_region_effects
  214.     dispose_region_sprites
  215.     create_region_sprites
  216.   end
  217.  
  218.   alias galv_region_effect_sm_sb_create_characters create_characters
  219.   def create_characters
  220.     create_region_sprites
  221.     galv_region_effect_sm_sb_create_characters
  222.   end
  223.  
  224.   alias galv_region_effect_sm_sb_update_characters update_characters
  225.   def update_characters
  226.     galv_region_effect_sm_sb_update_characters
  227.     @region_sprites.each { |sprite| sprite.update }
  228.   end
  229.  
  230.   alias galv_region_effect_sm_sb_dispose_characters dispose_characters
  231.   def dispose_characters
  232.     dispose_region_sprites
  233.     galv_region_effect_sm_sb_dispose_characters
  234.   end
  235.  
  236.   def create_region_sprites
  237.     @region_sprites = []
  238.     $game_map.effectlist.each_with_index { |id,i|
  239.       @region_sprites[i] = Sprite_Character.new(@viewport1,$game_map.r_events[id])
  240.     }
  241.   end
  242.  
  243.   def dispose_region_sprites
  244.     @region_sprites.each { |sprite| sprite.dispose }
  245.   end
  246. end
  247.  
  248.  
  249.  
  250. class Scene_Map < Scene_Base
  251.   attr_accessor :spriteset
  252.  
  253.   alias galv_region_effects_start start
  254.   def start
  255.     galv_region_effects_start
  256.     SceneManager.scene.spriteset.refresh_region_effects
  257.   end
  258. end # Scene_Map
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-5-23 22:14

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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