查看: 4693|回复: 10

[已经过期] 有没有建筑类的范例,就是那种随着时间增加会改变样子

[复制链接]
梦石
0
星屑
607
在线时间
111 小时
注册时间
2012-9-30
回帖
86
发表于 2014-6-24 20:04:56 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 wgr273 于 2014-6-24 22:13 编辑

有没有建筑类的范例或者游戏,就是那种随着时间增加会改变样子,刚开始是一块空地然后慢慢的打地基,建筑第一层,然后第二层。。。。直到建成,就是下了一个指令后自己会随时间建筑,不用操作,有这类似的脚步跟范例的大神们分享下,最好是脚本的,因为想用大量建筑,脚本实现图片ID更换,我想这样可能会更好,感激涕零!

…あたしは天

梦石
0
星屑
2308
在线时间
4033 小时
注册时间
2010-10-4
回帖
10548

开拓者贵宾

发表于 2014-6-24 21:01:00 | 显示全部楼层
事件页1-并行处理 行走图为空地
  等待999帧
  独立开关A 打开

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

...

点评

恩,这样做的确是可以但是我更想用的是脚本,因为我想做的游戏是需要大量建筑的,如果一个个个事件来设置好像不是很好,而且视乎会卡。  发表于 2014-6-24 22:08
回复

使用道具 举报

梦石
0
星屑
167
在线时间
673 小时
注册时间
2013-6-15
回帖
663
发表于 2014-6-24 21:35:47 | 显示全部楼层
事件(并行处理) (行走图为空地):

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


回复

使用道具 举报

梦石
0
星屑
492
在线时间
908 小时
注册时间
2009-10-12
回帖
1702
发表于 2014-6-24 21:44:05 | 显示全部楼层
taroxd 发表于 2014-6-24 21:01
事件页1-并行处理 行走图为空地
  等待999帧
  独立开关A 打开


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


lz可以使用计时器啊
不过sprite timer 49行改成0 即可
回复

使用道具 举报

梦石
0
星屑
607
在线时间
111 小时
注册时间
2012-9-30
回帖
86
 楼主| 发表于 2014-6-24 22:11:24 | 显示全部楼层
shy 发表于 2014-6-24 21:35
事件(并行处理) (行走图为空地):

  等待(999帧)

恩,这样做的确是可以但是我更想用的是脚本,因为我想做的游戏是需要大量建筑的,如果一个个个事件来设置好像不是很好,而且视乎会卡。
回复

使用道具 举报

无限の剣制

梦石
0
星屑
10450
在线时间
5019 小时
注册时间
2013-2-28
回帖
4942

开拓者贵宾

发表于 2014-6-24 22:15:31 | 显示全部楼层
本帖最后由 VIPArcher 于 2014-6-24 22:16 编辑

为何不用循环+等待+变量操作+判断+跳出?

点评

具体应该怎么用呢,亲?能不能搞个范例或者写个脚本!亲!  发表于 2014-6-24 22:17
回复

使用道具 举报

无节操

梦石
0
星屑
608
在线时间
795 小时
注册时间
2009-2-6
回帖
3910

开拓者贵宾

发表于 2014-6-25 00:56:38 | 显示全部楼层
其实我想说,自己p好图片,挨个显示…………
施工的效果(比如烟雾啥的)用动画实现,施工人员用事件,然后地基做好阻挡。如果建筑物变高了,移动一些隐形的阻挡事件来。
然后如果你是可以选择造什么的一类的,搜索一些生成事件的脚本,配合公共事件整个集成度比较高的效果,就可以了。

点评

我好像没听说过有生成事件的脚本挨,能不能给个范例呀,大神!  发表于 2014-6-25 22:01
Brandnew day, Brandnew Life
                             规 实在  中
暂为素材区版主,版其  琢磨
应援一下~
RPG制作大师授权素材推广计划
回复

使用道具 举报

无节操

梦石
0
星屑
608
在线时间
795 小时
注册时间
2009-2-6
回帖
3910

开拓者贵宾

发表于 2014-6-25 23:40:16 | 显示全部楼层
本帖最后由 moy 于 2014-6-26 15:32 编辑

[pre lang="ruby" line="1"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Spawn Event v1.00
# -- Last Updated: 2012.02.08
# -- Level: Normal, Hard
# -- Requires: n/a
#
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-SpawnEvent"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.02.08 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# For those who would like to spawn pre-made events from the current map or
# even other maps, this script allows you to do so. With the option of spawning
# the events at specific locations or a random spot marked by a certain region,
# you can have events spawn using simple script calls. The events remain until
# a map change.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Script Calls - These commands are used with script calls.
# -----------------------------------------------------------------------------
# spawn_event_location(x, y, event_id)
# spawn_event_location(x, y, event_id, map_id)
# This causes a new event to be created at location x and y on the current map.
# The event to be created will use the event data from event_id. If no map_id
# is used, then the current map's event will be used to spawn the new event.
# The event cannot spawn on top of another event or vehicle. If there is an
# event or vehicle in place, then no event will be spawned at all.
#
# spawn_event_region(region_id, event_id)
# spawn_event_region(region_id, event_id, map_id)
# This causes a new event to be created at a random location with a matching
# region_id. The event to be created will use the event data from event_id. If
# no map_id is used, then the current map's event will be used to spawn the
# new event. If the region_id does not exist on the current map, then no event
# will be spawned. The event will not spawn on top of another event nor on top
# of a vehicle. If there is not enough room to spawn an event, then no event
# will be spawned at all. This process takes slightly longer on larger maps.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

#==============================================================================
# ■ Game_Map
#==============================================================================

class Game_Map
  
  #--------------------------------------------------------------------------
  # new method: spawn_event
  #--------------------------------------------------------------------------
  def spawn_event(dx, dy, event_id, map_id)
    return if $game_player.collide_with_characters?(dx, dy)
    return if dx == $game_player.x && dy == $game_player.y
    map_id = @map_id if map_id == 0
    map = load_data(sprintf("Data/Map%03d.rvdata2", map_id))
    event = generated_event(map, event_id)
    return if event.nil?
    key_id = @events.keys.max + 1
    @events[key_id] = Game_Event.new(@map_id, event)
    @events[key_id].moveto(dx, dy)
    SceneManager.scene.spriteset.refresh_characters
  end
  
  #--------------------------------------------------------------------------
  # new method: generated_event
  #--------------------------------------------------------------------------
  def generated_event(map, event_id)
    for key in map.events
      event = key[1]
      next if event.nil?
      return event if event.id == event_id
    end
    return nil
  end
  
  #--------------------------------------------------------------------------
  # new method: spawn_event_region
  #--------------------------------------------------------------------------
  def spawn_event_region(reg_id, event_id, map_id)
    tile = get_random_region_tile(reg_id)
    return if tile.nil?
    spawn_event(tile[0], tile[1], event_id, map_id)
  end
  
  #--------------------------------------------------------------------------
  # new method: get_random_region_tile
  #--------------------------------------------------------------------------
  def get_random_region_tile(reg_id)
    tiles = []
    for i in 0...width
      for j in 0...height
        next unless region_id(i, j) == reg_id
        next if $game_player.collide_with_characters?(i, j)
        next if i == $game_player.x && j == $game_player.y
        tiles.push([i, j])
      end
    end
    return tiles.sample
  end
  
end # Game_Map

#==============================================================================
# ■ Game_Interpreter
#==============================================================================

class Game_Interpreter
  
  #--------------------------------------------------------------------------
  # new method: spawn_event_location
  #--------------------------------------------------------------------------
  def spawn_event_location(dx, dy, event_id, map_id = 0)
    return unless SceneManager.scene_is?(Scene_Map)
    $game_map.spawn_event(dx, dy, event_id, map_id)
  end
  
  #--------------------------------------------------------------------------
  # new method: spawn_event_region
  #--------------------------------------------------------------------------
  def spawn_event_region(region_id, event_id, map_id = 0)
    return unless SceneManager.scene_is?(Scene_Map)
    $game_map.spawn_event_region(region_id, event_id, map_id)
  end
  
end # Game_Interpreter

#==============================================================================
# ■ Scene_Map
#==============================================================================

class Scene_Map < Scene_Base
  
  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :spriteset
  
end # Scene_Map

#==============================================================================
#
# ▼ End of File
#
#==============================================================================[/pre]

我只有脚本,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中随机位置新建一个事件
复制代码

点评

大神不是很懂你这脚本怎么弄,能不能搞成范例呢,拜托了,大侠!  发表于 2014-6-26 15:10
Brandnew day, Brandnew Life
                             规 实在  中
暂为素材区版主,版其  琢磨
应援一下~
RPG制作大师授权素材推广计划
回复

使用道具 举报

梦石
0
星屑
607
在线时间
111 小时
注册时间
2012-9-30
回帖
86
 楼主| 发表于 2014-6-27 15:54:21 | 显示全部楼层
moy 发表于 2014-6-25 23:40
#==============================================================================
#
# ▼ Yanfly Engin ...

0001.jpg
你的脚本151行发生错误!

点评

不是吧,好可惜呀,没有别的办法了么?  发表于 2014-6-27 17:23
moy
汗,我的错,我忘记这个脚本在XP好像不能直接用了,你还是忘了他吧,需要移植一下。  发表于 2014-6-27 16:46
回复

使用道具 举报

无节操

梦石
0
星屑
608
在线时间
795 小时
注册时间
2009-2-6
回帖
3910

开拓者贵宾

发表于 2014-6-27 17:57:23 | 显示全部楼层
[pre lang="ruby" line="1"]#==============================================================================
#
# ▼ Yanfly Engine Ace - Spawn Event v1.00
# -- Last Updated: 2012.02.08
# -- Level: Normal, Hard
# -- Requires: n/a
#==============================================================================
# -- 移植至XP by moy
# -- 2014.6.27
# -- 由于没有区域功能,此功能暂废除。
#==============================================================================

$imported = {} if $imported.nil?
$imported["YEA-SpawnEvent"] = true

#==============================================================================
# ▼ Updates
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# 2012.02.08 - Started Script and Finished.
#
#==============================================================================
# ▼ Introduction
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# For those who would like to spawn pre-made events from the current map or
# even other maps, this script allows you to do so. With the option of spawning
# the events at specific locations or a random spot marked by a certain region,
# you can have events spawn using simple script calls. The events remain until
# a map change.
#
#==============================================================================
# ▼ Instructions
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# To install this script, open up your script editor and copy/paste this script
# to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
#
# -----------------------------------------------------------------------------
# Script Calls - These commands are used with script calls.
# -----------------------------------------------------------------------------
# spawn_event_location(x, y, event_id)
# spawn_event_location(x, y, event_id, map_id)
# This causes a new event to be created at location x and y on the current map.
# The event to be created will use the event data from event_id. If no map_id
# is used, then the current map's event will be used to spawn the new event.
# The event cannot spawn on top of another event or vehicle. If there is an
# event or vehicle in place, then no event will be spawned at all.
# 以下暂不可用
# spawn_event_region(region_id, event_id)
# spawn_event_region(region_id, event_id, map_id)
# This causes a new event to be created at a random location with a matching
# region_id. The event to be created will use the event data from event_id. If
# no map_id is used, then the current map's event will be used to spawn the
# new event. If the region_id does not exist on the current map, then no event
# will be spawned. The event will not spawn on top of another event nor on top
# of a vehicle. If there is not enough room to spawn an event, then no event
# will be spawned at all. This process takes slightly longer on larger maps.
#
#==============================================================================
# ▼ Compatibility
# =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
# This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
# it will run with RPG Maker VX without adjusting.
#
#==============================================================================

#==============================================================================
# ■ Game_Map
#==============================================================================

class Game_Map

  #--------------------------------------------------------------------------
  # new method: spawn_event
  #--------------------------------------------------------------------------
  def spawn_event(dx, dy, event_id, map_id)
    return if $game_player.collide_with_characters?(dx, dy)
    return if dx == $game_player.x && dy == $game_player.y
    map_id = @map_id if map_id == 0
    map = load_data(sprintf("Data/Map%03d.rxdata", map_id)) # 修改了档案名
    event = generated_event(map, event_id)
    return if event.nil?
    key_id = @events.keys.max + 1
    @events[key_id] = Game_Event.new(@map_id, event)
    @events[key_id].moveto(dx, dy)
    $scene.spriteset.refresh_characters
  end

  #--------------------------------------------------------------------------
  # new method: generated_event
  #--------------------------------------------------------------------------
  def generated_event(map, event_id)
    for key in map.events
      event = key[1]
      next if event.nil?
      return event if event.id == event_id
    end
    return nil
  end
=begin
  #--------------------------------------------------------------------------
  # new method: spawn_event_region
  #--------------------------------------------------------------------------
  def spawn_event_region(reg_id, event_id, map_id)
    tile = get_random_region_tile(reg_id)
    return if tile.nil?
    spawn_event(tile[0], tile[1], event_id, map_id)
  end

  #--------------------------------------------------------------------------
  # new method: get_random_region_tile
  #--------------------------------------------------------------------------
  def get_random_region_tile(reg_id)
    tiles = []
    for i in 0...width
      for j in 0...height
        next unless region_id(i, j) == reg_id
        next if $game_player.collide_with_characters?(i, j)
        next if i == $game_player.x && j == $game_player.y
        tiles.push([i, j])
      end
    end
    return tiles.sample
  end
=end
end # Game_Map

#==============================================================================
# ■ Game_Player
#==============================================================================
class Game_Player < Game_Character
  #--------------------------------------------------------------------------
  # 判断目标位置是否有事件或角色占据 new
  #--------------------------------------------------------------------------
  def collide_with_characters?(new_x,new_y)
    # 循环全部事件
    for event in $game_map.events.values
      # 事件坐标于移动目标坐标一致的情况下
      if event.x == new_x and event.y == new_y
        return true
      end
    end
    # 主角的坐标与移动目标坐标一致的情况下
    if @x == new_x and @y == new_y
        return true
    end
  end
end # Game_Player

#==============================================================================
# ■ Game_Interpreter => Interpreter
#==============================================================================

class Interpreter
  #--------------------------------------------------------------------------
  # new method: spawn_event_location
  #--------------------------------------------------------------------------
  def spawn_event_location(dx, dy, event_id, map_id = 0)
    return unless $scene.is_a?(Scene_Map)
    $game_map.spawn_event(dx, dy, event_id, map_id)
  end
=begin
  #--------------------------------------------------------------------------
  # new method: spawn_event_region
  #--------------------------------------------------------------------------
  def spawn_event_region(region_id, event_id, map_id = 0)
    return unless $scene.is_a?(Scene_Map)
    $game_map.spawn_event_region(region_id, event_id, map_id)
  end
=end
end # Game_Interpreter

#==============================================================================
# ■ Scene_Map
#==============================================================================

class Scene_Map

  #--------------------------------------------------------------------------
  # public instance variables
  #--------------------------------------------------------------------------
  attr_accessor :spriteset

end # Scene_Map

#==============================================================================
# ■ Spriteset_Map
#==============================================================================
class Spriteset_Map
  #--------------------------------------------------------------------------
  # 重置所有角色图形 new
  #--------------------------------------------------------------------------
  def refresh_characters
    # 刷新角色活动块
    for sprite in @character_sprites
      sprite.dispose
    end
    # 生成角色活动块
    @character_sprites = []
    for i in $game_map.events.keys.sort
      sprite = Sprite_Character.new(@viewport1, $game_map.events)
      @character_sprites.push(sprite)
    end
    @character_sprites.push(Sprite_Character.new(@viewport1, $game_player))
  end
end # Spriteset_Map

#==============================================================================
#
# ▼ End of File
#
#==============================================================================
[/pre]

移植了一下,但是因XP没有区域功能,所以直接注释了,只使用指定坐标的吧。
Brandnew day, Brandnew Life
                             规 实在  中
暂为素材区版主,版其  琢磨
应援一下~
RPG制作大师授权素材推广计划
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部