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

Project1

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

[已经解决] 不太明白這腳印腳本是如何設定

[复制链接]

Lv2.观梦者

梦石
0
星屑
284
在线时间
271 小时
注册时间
2013-4-23
帖子
143
跳转到指定楼层
1
发表于 2013-12-24 02:05:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 yiu889 于 2013-12-24 14:13 编辑
  1. #------------------------------------------------------------------------------#
  2. #  Galv's Region Effects
  3. #------------------------------------------------------------------------------#
  4. #  For: RPGMAKER VX ACE
  5. #  Version 1.7
  6. #  Credit to Yanfly and Quack for event spawning method
  7. #------------------------------------------------------------------------------#
  8. #  2012-11-15 - Version 1.7 - Made effects work during forced move routes
  9. #  2012-11-15 - Version 1.6 - Fixed a major bug caused with last update.
  10. #  2012-11-04 - Version 1.5 - streamline updates and bug fix suggested by Quack
  11. #  2012-10-23 - Version 1.4 - updated alias naming convention for compatability
  12. #  2012-10-09 - Version 1.3 - re-wrote the code to be more efficient when
  13. #                           - using many different region effects.
  14. #  2012-10-09 - Version 1.2 - code tweak that may reduce lag on low-end pc's
  15. #  2012-09-16 - Version 1.1 - now compatible with Yanfly's spawn events
  16. #  2012-09-15 - Version 1.0 - release
  17. #------------------------------------------------------------------------------#
  18. #  Designed to activate effects when regions are stood on.
  19. #  An effect can include:
  20. #     - Sound Effect
  21. #     - An event that appears at the player's location
  22. #     - Activating a common event
  23. #
  24. #
  25. #  INSTRUCTIONS:
  26. #  1. Copy image from /Graphics/Characters/!Other-specials.png to your project
  27. #  2. Copy the map from this demo into your game.
  28. #        - this map has events set up for the pre-made effects
  29. #  3. Check the map ID of the map you copied in your game
  30. #  4. Change the SPAWN_MAP_ID number to this map ID
  31. #  5. Change REGION_EFFECT_SWITCH to a switch you are not using in your game.
  32. #  6. Add some regions to your map to test.
  33. #
  34. #------------------------------------------------------------------------------#

  35. $imported = {} if $imported.nil?
  36. $imported["Region_Effects"] = true

  37. module Region_Effects
  38. #------------------------------------------------------------------------------#
  39. #  SCRIPT SETUP OPTIONS
  40. #------------------------------------------------------------------------------#

  41.    REGION_EFFECT_SWITCH = 1   # Turn this switch ON to disable the effects.

  42.    MAX_EFFECTS = 30           # Number of effects that can be on screen
  43.                               # before being removed. (To prevent lag)

  44.    SPAWN_MAP_ID = 2           # Map ID of the map you store event effects in.

  45. #------------------------------------------------------------------------------#
  46. #  ENVIRONMENT REGIONS SETUP
  47. #------------------------------------------------------------------------------#
  48. #------------------------------------------------------------------------------#
  49. #
  50. #  region => ["sound", vol, pitch, event_id, common_event_id]
  51. #
  52. #  region          -  the region ID the effect will activate on
  53. #  sound           -  the name of the SE file. "" for no sound
  54. #  vol             -  the volume of the SE (0 - 100)
  55. #  pitch           -  the pitch of the SE (50 - 150)
  56. #  event_id        -  event ID called from the spawn map. 0 for none.
  57. #  common_event_id -  common event ID to call. 0 for no common event.
  58. #
  59. #------------------------------------------------------------------------------#
  60.     EFFECT = { # ! don't touch this
  61. #------------------------------------------------------------------------------#

  62.     0 => ["", 0, 0, 0, 0],              # No Effect (no region)

  63.     # Pre-made effects (requires demo events)
  64.     1 => ["", 0, 0, 5, 0],              # Dirt dust
  65.     2 => ["Blow7", 60, 150, 0, 0],      # Wood surface noise only
  66.     3 => ["Water1", 60, 110, 1, 0],     # Shallow Water
  67.     18 => ["Earth2", 40, 130, 0, 0],     # Hard surface noise only
  68.     5 => ["Damage3", 40, 150, 2, 0],    # Footprints
  69.     6 => ["Ice9", 50, 130, 3, 0],       # Walking over thick grass
  70.     7 => ["", 0, 0, 0, 1],              # Calls common event 1 only
  71.     8 => ["Fire3", 80, 120, 4, 2],      # Calls fire trap
  72.     37 => ["", 80, 120, 6, 0],          # Dust cloud

  73.     # You can add more as required. eg:
  74.     # 42 => ["", 0, 0, 0, 0],
  75.     # 18 => ["", 0, 0, 0, 0],
  76.     # etc. etc.

  77.     # Only one effect per region number will work

  78. #------------------------------------------------------------------------------#
  79.     } # ! don't touch this
  80. #------------------------------------------------------------------------------#
  81. #  END SCRIPT SETUP
  82. #------------------------------------------------------------------------------#

  83. end # Region_Effects

  84. module DataManager

  85. #--------------------------------------------------------------------------
  86. # alias method: load_normal_database
  87. #--------------------------------------------------------------------------
  88. class <<self; alias load_normal_database_spawn_alias load_normal_database; end
  89. def self.load_normal_database
  90.   load_normal_database_spawn_alias
  91.   $data_spawn_map = load_data(sprintf("Data/Map%03d.rvdata2", Region_Effects::SPAWN_MAP_ID))
  92. end

  93. end

  94. class Game_Player < Game_Character

  95.   alias galv_region_effects_update_update_nonmoving update_nonmoving
  96.   def update_nonmoving(last_moving)
  97.     if last_moving
  98.       galv_region_check unless $game_switches[Region_Effects::REGION_EFFECT_SWITCH] == true
  99.     end
  100.     galv_region_effects_update_update_nonmoving(last_moving)
  101.   end

  102.   def galv_region_check
  103.     return if Input.trigger?(:C)
  104.     v = rand(10) - rand(10)
  105.     p = rand(40) - rand(40)

  106.     @r_id = $game_map.region_id($game_player.x, $game_player.y)
  107.     return if Region_Effects::EFFECT[@r_id] == nil

  108.     sound = Region_Effects::EFFECT[@r_id][0]
  109.     vol = Region_Effects::EFFECT[@r_id][1]
  110.       pit = Region_Effects::EFFECT[@r_id][2]
  111.       eve = Region_Effects::EFFECT[@r_id][3]
  112.       com_eve = Region_Effects::EFFECT[@r_id][4]

  113.       RPG::SE.new(sound, vol + v, pit + p).play
  114.       if eve > 0
  115.         $game_map.region_event($game_player.x, $game_player.y, eve, Region_Effects::SPAWN_MAP_ID)
  116.       end
  117.         $game_temp.reserve_common_event(com_eve) unless com_eve == nil
  118.   end

  119. end # Game_Player

  120. #==============================================================================
  121. # Credit to Yanfly for modified Spawn event script below
  122. #==============================================================================

  123. class Game_Map

  124.   alias galv_region_effects_setup setup
  125.   def setup(map_id)
  126.     @effect_var = []
  127.     galv_region_effects_setup(map_id)
  128.   end

  129.   def region_event(dx, dy, event_id, map_id)
  130.     map_id = @map_id if map_id == 0
  131.     map = $data_spawn_map
  132.     event = generated_region_event(map, event_id)

  133.     if @effect_var.length < Region_Effects::MAX_EFFECTS
  134.       if @events.keys.max.nil?
  135.         new_id = 1
  136.       else
  137.         new_id = @events.keys.max + 1
  138.       end
  139.         @effect_var.push(new_id)
  140.     else
  141.         new_id = @effect_var.shift
  142.         @effect_var.push(new_id)
  143.     end

  144.     @events[new_id] = Game_Event.new(@map_id, event)
  145.     @events[new_id].moveto(dx, dy)
  146.     SceneManager.scene.spriteset.refresh_characters
  147.   end

  148.   def generated_region_event(map, event_id)
  149.     for key in map.events
  150.       event = key[1]
  151.       next if event.nil?
  152.       return event if event.id == event_id
  153.     end
  154.     return nil
  155.   end

  156. end # Game_Map


  157. class Scene_Map < Scene_Base
  158.   attr_accessor :spriteset
  159. end # Scene_Map
复制代码
我下了DEMO,也不太明白它是如何設定它的地圖地形屬性。
求懂英文的指點一下

Lv5.捕梦者 (管理员)

老黄鸡

梦石
0
星屑
42399
在线时间
7602 小时
注册时间
2009-7-6
帖子
13506

开拓者贵宾

2
发表于 2013-12-24 03:01:04 | 只看该作者
区域编号,你不会不知道区域吧。。。

点评

忘了這個=口='',感謝提醒  发表于 2013-12-24 12:06
RGDirect - DirectX驱动的RGSS,点我了解.
RM全系列成套系统定制请联系QQ1213237796
不接受对其他插件维护的委托
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-23 05:39

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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