Project1

标题: 有没有建筑类的范例,就是那种随着时间增加会改变样子 [打印本页]

作者: wgr273    时间: 2014-6-24 20:04
标题: 有没有建筑类的范例,就是那种随着时间增加会改变样子
本帖最后由 wgr273 于 2014-6-24 22:13 编辑

有没有建筑类的范例或者游戏,就是那种随着时间增加会改变样子,刚开始是一块空地然后慢慢的打地基,建筑第一层,然后第二层。。。。直到建成,就是下了一个指令后自己会随时间建筑,不用操作,有这类似的脚步跟范例的大神们分享下,最好是脚本的,因为想用大量建筑,脚本实现图片ID更换,我想这样可能会更好,感激涕零!
作者: taroxd    时间: 2014-6-24 21:01
事件页1-并行处理 行走图为空地
  等待999帧
  独立开关A 打开

事件页2-并行处理 行走图为地基 条件为独立开关A打开
  等待999帧
  独立开关B 打开

...
作者: shy    时间: 2014-6-24 21:35
事件(并行处理) (行走图为空地):

  等待(999帧)
设置移动路线(本事件):
    更换事件图形——(地基)
……
……
等待(999帧)
设置移动路线(本事件):
    更换事件图形——(高楼)



作者: 日月星辰    时间: 2014-6-24 21:44
taroxd 发表于 2014-6-24 21:01
事件页1-并行处理 行走图为空地
  等待999帧
  独立开关A 打开


等待999。。。貌似很凶残 而且不是很好控制+有限制


lz可以使用计时器啊
不过sprite timer 49行改成0 即可
作者: wgr273    时间: 2014-6-24 22:11
shy 发表于 2014-6-24 21:35
事件(并行处理) (行走图为空地):

  等待(999帧)

恩,这样做的确是可以但是我更想用的是脚本,因为我想做的游戏是需要大量建筑的,如果一个个个事件来设置好像不是很好,而且视乎会卡。
作者: VIPArcher    时间: 2014-6-24 22:15
本帖最后由 VIPArcher 于 2014-6-24 22:16 编辑

为何不用循环+等待+变量操作+判断+跳出?
作者: moy    时间: 2014-6-25 00:56
其实我想说,自己p好图片,挨个显示…………
施工的效果(比如烟雾啥的)用动画实现,施工人员用事件,然后地基做好阻挡。如果建筑物变高了,移动一些隐形的阻挡事件来。
然后如果你是可以选择造什么的一类的,搜索一些生成事件的脚本,配合公共事件整个集成度比较高的效果,就可以了。
作者: moy    时间: 2014-6-25 23:40
本帖最后由 moy 于 2014-6-26 15:32 编辑

RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Spawn Event v1.00
  4. # -- Last Updated: 2012.02.08
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-SpawnEvent"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.02.08 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # For those who would like to spawn pre-made events from the current map or
  22. # even other maps, this script allows you to do so. With the option of spawning
  23. # the events at specific locations or a random spot marked by a certain region,
  24. # you can have events spawn using simple script calls. The events remain until
  25. # a map change.
  26. #
  27. #==============================================================================
  28. # ▼ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # To install this script, open up your script editor and copy/paste this script
  31. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  32. #
  33. # -----------------------------------------------------------------------------
  34. # Script Calls - These commands are used with script calls.
  35. # -----------------------------------------------------------------------------
  36. # spawn_event_location(x, y, event_id)
  37. # spawn_event_location(x, y, event_id, map_id)
  38. # This causes a new event to be created at location x and y on the current map.
  39. # The event to be created will use the event data from event_id. If no map_id
  40. # is used, then the current map's event will be used to spawn the new event.
  41. # The event cannot spawn on top of another event or vehicle. If there is an
  42. # event or vehicle in place, then no event will be spawned at all.
  43. #
  44. # spawn_event_region(region_id, event_id)
  45. # spawn_event_region(region_id, event_id, map_id)
  46. # This causes a new event to be created at a random location with a matching
  47. # region_id. The event to be created will use the event data from event_id. If
  48. # no map_id is used, then the current map's event will be used to spawn the
  49. # new event. If the region_id does not exist on the current map, then no event
  50. # will be spawned. The event will not spawn on top of another event nor on top
  51. # of a vehicle. If there is not enough room to spawn an event, then no event
  52. # will be spawned at all. This process takes slightly longer on larger maps.
  53. #
  54. #==============================================================================
  55. # ▼ Compatibility
  56. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  57. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  58. # it will run with RPG Maker VX without adjusting.
  59. #
  60. #==============================================================================
  61.  
  62. #==============================================================================
  63. # ■ Game_Map
  64. #==============================================================================
  65.  
  66. class Game_Map
  67.  
  68.   #--------------------------------------------------------------------------
  69.   # new method: spawn_event
  70.   #--------------------------------------------------------------------------
  71.   def spawn_event(dx, dy, event_id, map_id)
  72.     return if $game_player.collide_with_characters?(dx, dy)
  73.     return if dx == $game_player.x && dy == $game_player.y
  74.     map_id = @map_id if map_id == 0
  75.     map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
  76.     event = generated_event(map, event_id)
  77.     return if event.nil?
  78.     key_id = @events.keys.max + 1
  79.     @events[key_id] = Game_Event.new(@map_id, event)
  80.     @events[key_id].moveto(dx, dy)
  81.     SceneManager.scene.spriteset.refresh_characters
  82.   end
  83.  
  84.   #--------------------------------------------------------------------------
  85.   # new method: generated_event
  86.   #--------------------------------------------------------------------------
  87.   def generated_event(map, event_id)
  88.     for key in map.events
  89.       event = key[1]
  90.       next if event.nil?
  91.       return event if event.id == event_id
  92.     end
  93.     return nil
  94.   end
  95.  
  96.   #--------------------------------------------------------------------------
  97.   # new method: spawn_event_region
  98.   #--------------------------------------------------------------------------
  99.   def spawn_event_region(reg_id, event_id, map_id)
  100.     tile = get_random_region_tile(reg_id)
  101.     return if tile.nil?
  102.     spawn_event(tile[0], tile[1], event_id, map_id)
  103.   end
  104.  
  105.   #--------------------------------------------------------------------------
  106.   # new method: get_random_region_tile
  107.   #--------------------------------------------------------------------------
  108.   def get_random_region_tile(reg_id)
  109.     tiles = []
  110.     for i in 0...width
  111.       for j in 0...height
  112.         next unless region_id(i, j) == reg_id
  113.         next if $game_player.collide_with_characters?(i, j)
  114.         next if i == $game_player.x && j == $game_player.y
  115.         tiles.push([i, j])
  116.       end
  117.     end
  118.     return tiles.sample
  119.   end
  120.  
  121. end # Game_Map
  122.  
  123. #==============================================================================
  124. # ■ Game_Interpreter
  125. #==============================================================================
  126.  
  127. class Game_Interpreter
  128.  
  129.   #--------------------------------------------------------------------------
  130.   # new method: spawn_event_location
  131.   #--------------------------------------------------------------------------
  132.   def spawn_event_location(dx, dy, event_id, map_id = 0)
  133.     return unless SceneManager.scene_is?(Scene_Map)
  134.     $game_map.spawn_event(dx, dy, event_id, map_id)
  135.   end
  136.  
  137.   #--------------------------------------------------------------------------
  138.   # new method: spawn_event_region
  139.   #--------------------------------------------------------------------------
  140.   def spawn_event_region(region_id, event_id, map_id = 0)
  141.     return unless SceneManager.scene_is?(Scene_Map)
  142.     $game_map.spawn_event_region(region_id, event_id, map_id)
  143.   end
  144.  
  145. end # Game_Interpreter
  146.  
  147. #==============================================================================
  148. # ■ Scene_Map
  149. #==============================================================================
  150.  
  151. class Scene_Map < Scene_Base
  152.  
  153.   #--------------------------------------------------------------------------
  154.   # public instance variables
  155.   #--------------------------------------------------------------------------
  156.   attr_accessor :spriteset
  157.  
  158. end # Scene_Map
  159.  
  160. #==============================================================================
  161. #
  162. # ▼ End of File
  163. #
  164. #==============================================================================


我只有脚本,Yanfly系统的,好在这个不需要系统本体,因此直接用也没什么。
可以将同地图或别的地图的事件在指定位置生成
使用时调用事件脚本,一共以下4种方式,详细的你自己查注释吧。
  1. # spawn_event_location(x, y, event_id)
  2. # spawn_event_location(x, y, event_id, map_id)
  3. # spawn_event_region(region_id, event_id)
  4. # spawn_event_region(region_id, event_id, map_id)
复制代码
  1. spawn_event_location(12,3,4)  #以本地图的4号事件为模板,在坐标(12,3)位置新建一个事件
  2. spawn_event_location(12,3,4,12)  #以12号地图的4号事件为模板,在坐标(12,3)位置新建一个事件
  3. spawn_event_region(1, 2)  #以本地图的2号事件为模板,在区域1中随机位置新建一个事件
  4. spawn_event_region(2, 2, 4) #以3号地图的2号事件为模板,在区域2中随机位置新建一个事件
复制代码

作者: wgr273    时间: 2014-6-27 15:54
moy 发表于 2014-6-25 23:40
#==============================================================================
#
# ▼ Yanfly Engin ...


你的脚本151行发生错误!
作者: moy    时间: 2014-6-27 17:57
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Spawn Event v1.00
  4. # -- Last Updated: 2012.02.08
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #==============================================================================
  8. # -- 移植至XP by moy
  9. # -- 2014.6.27
  10. # -- 由于没有区域功能,此功能暂废除。
  11. #==============================================================================
  12.  
  13. $imported = {} if $imported.nil?
  14. $imported["YEA-SpawnEvent"] = true
  15.  
  16. #==============================================================================
  17. # ▼ Updates
  18. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  19. # 2012.02.08 - Started Script and Finished.
  20. #
  21. #==============================================================================
  22. # ▼ Introduction
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # For those who would like to spawn pre-made events from the current map or
  25. # even other maps, this script allows you to do so. With the option of spawning
  26. # the events at specific locations or a random spot marked by a certain region,
  27. # you can have events spawn using simple script calls. The events remain until
  28. # a map change.
  29. #
  30. #==============================================================================
  31. # ▼ Instructions
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # To install this script, open up your script editor and copy/paste this script
  34. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  35. #
  36. # -----------------------------------------------------------------------------
  37. # Script Calls - These commands are used with script calls.
  38. # -----------------------------------------------------------------------------
  39. # spawn_event_location(x, y, event_id)
  40. # spawn_event_location(x, y, event_id, map_id)
  41. # This causes a new event to be created at location x and y on the current map.
  42. # The event to be created will use the event data from event_id. If no map_id
  43. # is used, then the current map's event will be used to spawn the new event.
  44. # The event cannot spawn on top of another event or vehicle. If there is an
  45. # event or vehicle in place, then no event will be spawned at all.
  46. # 以下暂不可用
  47. # spawn_event_region(region_id, event_id)
  48. # spawn_event_region(region_id, event_id, map_id)
  49. # This causes a new event to be created at a random location with a matching
  50. # region_id. The event to be created will use the event data from event_id. If
  51. # no map_id is used, then the current map's event will be used to spawn the
  52. # new event. If the region_id does not exist on the current map, then no event
  53. # will be spawned. The event will not spawn on top of another event nor on top
  54. # of a vehicle. If there is not enough room to spawn an event, then no event
  55. # will be spawned at all. This process takes slightly longer on larger maps.
  56. #
  57. #==============================================================================
  58. # ▼ Compatibility
  59. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  60. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  61. # it will run with RPG Maker VX without adjusting.
  62. #
  63. #==============================================================================
  64.  
  65. #==============================================================================
  66. # ■ Game_Map
  67. #==============================================================================
  68.  
  69. class Game_Map
  70.  
  71.   #--------------------------------------------------------------------------
  72.   # new method: spawn_event
  73.   #--------------------------------------------------------------------------
  74.   def spawn_event(dx, dy, event_id, map_id)
  75.     return if $game_player.collide_with_characters?(dx, dy)
  76.     return if dx == $game_player.x && dy == $game_player.y
  77.     map_id = @map_id if map_id == 0
  78.     map = load_data(sprintf("Data/Map%03d.rxdata", map_id)) # 修改了档案名
  79.     event = generated_event(map, event_id)
  80.     return if event.nil?
  81.     key_id = @events.keys.max + 1
  82.     @events[key_id] = Game_Event.new(@map_id, event)
  83.     @events[key_id].moveto(dx, dy)
  84.     $scene.spriteset.refresh_characters
  85.   end
  86.  
  87.   #--------------------------------------------------------------------------
  88.   # new method: generated_event
  89.   #--------------------------------------------------------------------------
  90.   def generated_event(map, event_id)
  91.     for key in map.events
  92.       event = key[1]
  93.       next if event.nil?
  94.       return event if event.id == event_id
  95.     end
  96.     return nil
  97.   end
  98. =begin
  99.   #--------------------------------------------------------------------------
  100.   # new method: spawn_event_region
  101.   #--------------------------------------------------------------------------
  102.   def spawn_event_region(reg_id, event_id, map_id)
  103.     tile = get_random_region_tile(reg_id)
  104.     return if tile.nil?
  105.     spawn_event(tile[0], tile[1], event_id, map_id)
  106.   end
  107.  
  108.   #--------------------------------------------------------------------------
  109.   # new method: get_random_region_tile
  110.   #--------------------------------------------------------------------------
  111.   def get_random_region_tile(reg_id)
  112.     tiles = []
  113.     for i in 0...width
  114.       for j in 0...height
  115.         next unless region_id(i, j) == reg_id
  116.         next if $game_player.collide_with_characters?(i, j)
  117.         next if i == $game_player.x && j == $game_player.y
  118.         tiles.push([i, j])
  119.       end
  120.     end
  121.     return tiles.sample
  122.   end
  123. =end
  124. end # Game_Map
  125.  
  126. #==============================================================================
  127. # ■ Game_Player
  128. #==============================================================================
  129. class Game_Player < Game_Character
  130.   #--------------------------------------------------------------------------
  131.   # 判断目标位置是否有事件或角色占据 new
  132.   #--------------------------------------------------------------------------
  133.   def collide_with_characters?(new_x,new_y)
  134.     # 循环全部事件
  135.     for event in $game_map.events.values
  136.       # 事件坐标于移动目标坐标一致的情况下
  137.       if event.x == new_x and event.y == new_y
  138.         return true
  139.       end
  140.     end
  141.     # 主角的坐标与移动目标坐标一致的情况下
  142.     if @x == new_x and @y == new_y
  143.         return true
  144.     end
  145.   end
  146. end # Game_Player
  147.  
  148. #==============================================================================
  149. # ■ Game_Interpreter => Interpreter
  150. #==============================================================================
  151.  
  152. class Interpreter
  153.   #--------------------------------------------------------------------------
  154.   # new method: spawn_event_location
  155.   #--------------------------------------------------------------------------
  156.   def spawn_event_location(dx, dy, event_id, map_id = 0)
  157.     return unless $scene.is_a?(Scene_Map)
  158.     $game_map.spawn_event(dx, dy, event_id, map_id)
  159.   end
  160. =begin
  161.   #--------------------------------------------------------------------------
  162.   # new method: spawn_event_region
  163.   #--------------------------------------------------------------------------
  164.   def spawn_event_region(region_id, event_id, map_id = 0)
  165.     return unless $scene.is_a?(Scene_Map)
  166.     $game_map.spawn_event_region(region_id, event_id, map_id)
  167.   end
  168. =end
  169. end # Game_Interpreter
  170.  
  171. #==============================================================================
  172. # ■ Scene_Map
  173. #==============================================================================
  174.  
  175. class Scene_Map
  176.  
  177.   #--------------------------------------------------------------------------
  178.   # public instance variables
  179.   #--------------------------------------------------------------------------
  180.   attr_accessor :spriteset
  181.  
  182. end # Scene_Map
  183.  
  184. #==============================================================================
  185. # ■ Spriteset_Map
  186. #==============================================================================
  187. class Spriteset_Map
  188.   #--------------------------------------------------------------------------
  189.   # 重置所有角色图形 new
  190.   #--------------------------------------------------------------------------
  191.   def refresh_characters
  192.     # 刷新角色活动块
  193.     for sprite in @character_sprites
  194.       sprite.dispose
  195.     end
  196.     # 生成角色活动块
  197.     @character_sprites = []
  198.     for i in $game_map.events.keys.sort
  199.       sprite = Sprite_Character.new(@viewport1, $game_map.events[i])
  200.       @character_sprites.push(sprite)
  201.     end
  202.     @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
  203.   end
  204. end # Spriteset_Map
  205.  
  206. #==============================================================================
  207. #
  208. # ▼ End of File
  209. #
  210. #==============================================================================


移植了一下,但是因XP没有区域功能,所以直接注释了,只使用指定坐标的吧。
作者: 天地有正气    时间: 2014-7-4 10:13
moy 发表于 2014-6-27 17:57
#==============================================================================
#
# ▼ Yanfly Engin ...

很久以前美兽大大发过一个处处留情脚本,好像又叫保护环境人人有责。。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1