Main Menu
  • Welcome to The RPG Maker Resource Kit.

Help with japanese dungeon generation script!

Started by Zambaku, July 12, 2008, 06:34:18 PM

0 Members and 1 Guest are viewing this topic.

Zambaku

I would be extremely happy if someone could help me getting this script to work.

When I enter the dungeon it simply runs black and nothing more.



#-------------------------------------------------------------------------------
# ??????????????

# roguelike??????????????????????Game_Map????
# ??????
# ????????????????
# ??????????????????????????????
# ?????????????????????????????????????
#
# ?????????
#   Racanhack ????? [ http://racanhack.sourceforge.jp/rhdoc/index.html ]
#     ????????????????????

# ????
# ???ROGUELIKE_MAP_ID???????ID??? or
# ????????????????$game_map.make_dungeon?????
#
#----------------------------------------------------------------------------
# ??
#----------------------------------------------------------------------------
module ROGUELIKE_MAP
  # ?????????ID???
  # ?.???ID003?005???????? ? ROGUELIKE_MAP_ID = [3,5]
  ROGUELIKE_MAP_ID = []
  # VX????ID????????????????????
  # ????????ID
  SPACE_TILE_ID = 5888
  # ?????ID
  FLOOR_TILE_ID = 1552
  # ?????ID
  WALL_TILE_ID = 6280
  # ???????????(??????64, 1/????????????)
  # ??????????????????????1????
  # ??????????????????????????(nil???)
  BIG_ROOM = 64
  BIG_ROOM_SWITCH = nil
  # ??????????(??????96, 1/????????)
  ADD_COUPLE = 96
  # ?????????
  MIN_ROOM_SIZE = 2
  # ????????(3??????????????)
  MIN_BTWN_RECT_ROOM = 3
  # ?????????(??????2 + 3 * 2 = 8)
  MIN_RECT_SIZE = MIN_ROOM_SIZE + (MIN_BTWN_RECT_ROOM * 2)
  #--------------------------------------------------------------------------
  R_VERTICAL = 0
  R_HORIZONAL = 1
  # ?????????
  # min??max??????int??????
  def rand_range(min, max)
    return((min + rand(max - min)).round)
  end
#-------------------------------------------------------------------------------
  #R_Couple??? ????????
  class R_Couple
    attr_accessor :v_or_h
    attr_accessor :rect0
    attr_accessor :rect1
    def initialize(v_or_h, rect0, rect1)
      @v_or_h = v_or_h
      @rect0 = rect0
      @rect1 = rect1
    end
  end
  #R_Room??? ????????
  class R_Room
    attr_accessor :lx
    attr_accessor :ly
    attr_accessor :hx
    attr_accessor :hy
    def initialize(lx, ly, hx, hy)
      @lx = lx
      @ly = ly
      @hx = hx
      @hy = hy
    end
  end
  #R_Rect??? ????????
  class R_Rect < R_Room
    attr_accessor :done_v
    attr_accessor :done_h
    attr_accessor :room
    def initialize(lx, ly, hx, hy, done_v = false, done_h = false, room = nil)
      super(lx, ly, hx, hy)
      @done_v = done_v
      @done_h = done_h
      @room = room
    end
  end
end
#-------------------------------------------------------------------------------
# ? Game_Map
#-------------------------------------------------------------------------------
# ??????????????????????????????????????
# ????????????? $game_map ????????
#-------------------------------------------------------------------------------
class Game_Map
  include ROGUELIKE_MAP
  #--------------------------------------------------------------------------
  # ? ??????
  #     map_id : ??? ID
  #--------------------------------------------------------------------------
  alias randmap_setup setup
  def setup(map_id)
    #????
    randmap_setup(map_id)
    #???ID?????????ID?????????????????
    make_dungeon if(ROGUELIKE_MAP_ID.include?(map_id))
  end
  #--------------------------------------------------------------------------
  # ? ??????????????????
  #    ???????$game_map.make_dungeon??????setup???????
  #--------------------------------------------------------------------------
  def make_dungeon
    @rect_list = []   # ?????
    @room_list = []   # ?????
    @couple_list = [] # ??????
    # ???????????????????
    for i in 0...@map.width
      for j in 0...@map.height
        @map.data[i,j,0] = SPACE_TILE_ID
      end
    end
    # ?????(split_rect????????????)
    split_rect(add_rect(0,0,@map.width - 1, @map.height - 1), true)
    # ?????
    make_room
    # ???????
    for n in 0...@room_list.size
      for i in @room_list[n].lx..@room_list[n].hx
        for j in @room_list[n].ly..@room_list[n].hy
          @map.data[i,j,0] = FLOOR_TILE_ID
        end
      end
    end
    # ????????????????????
    rect_map = Array.new(@map.width)
    for i in 0...rect_map.size
      rect_map = Array.new(@map.height)
    end
    for i in 0...@rect_list.size
      for j in @rect_list.lx..@rect_list.hx
        for k in @rect_list.ly..@rect_list.hy
          rect_map[j][k] = @rect_list
        end
      end
    end
    for i in 0...(@map.width - 1)
      for j in 0...(@map.height - 1)
        break unless(rect_map[j] != nil)
        break unless(rect_map[i + 1][j] != nil)
        break unless(rect_map[j + 1] != nil)
        if(rect_map[j] != rect_map[j + 1])
          add_couple(R_VERTICAL, rect_map[j], rect_map[j + 1]) if (rand(ADD_COUPLE) == 0)
        end
        if(rect_map[j] != rect_map[i + 1][j])
          add_couple(R_HORIZONAL, rect_map[j], rect_map[i + 1][j]) if (rand(ADD_COUPLE) == 0)
        end
      end
    end
    # ????????????????
    for i in 0...@couple_list.size
      # ???????????
      if(@couple_list.v_or_h == R_HORIZONAL)
        break unless(@couple_list.rect0.hx == @couple_list.rect1.lx)
        c0x = @couple_list.rect0.hx
        c0y = rand_range(@couple_list.rect0.room.ly + 1,
                @couple_list.rect0.room.hy)
        c1x = @couple_list.rect1.lx
        c1y = rand_range(@couple_list.rect1.room.ly + 1,
                @couple_list.rect1.room.hy)
        make_line(c0x, c0y, c1x, c1y)
        make_line(@couple_list.rect0.room.hx, c0y, c0x, c0y)
        make_line(@couple_list.rect1.room.lx, c1y, c1x, c1y)
      # ???????????
      elsif(@couple_list.v_or_h == R_VERTICAL)
        break unless(@couple_list.rect0.hy == @couple_list.rect1.ly)
        c0x = rand_range(@couple_list.rect0.room.lx + 1,
                @couple_list.rect0.room.hx)
        c0y = @couple_list.rect0.hy
        c1x = rand_range(@couple_list.rect1.room.lx + 1,
                @couple_list.rect1.room.hx)
        c1y = @couple_list.rect1.ly
        make_line(c0x, c0y, c1x, c1y)
        make_line(c0x, @couple_list.rect0.room.hy, c0x, c0y)
        make_line(c1x, @couple_list.rect1.room.ly, c1x, c1y)
      end
    end
    # ???(????????????????????????????????)
    for i in 0...@map.width
      for j in 1...@map.height
        if(@map.data[i, j, 0] == FLOOR_TILE_ID &&
          @map.data[i, j - 1, 0] == SPACE_TILE_ID)
          @map.data[i, j - 1, 0] = WALL_TILE_ID
        end
      end
    end
    # ??
  end
  # ????????????????????
  def add_rect(lx, ly, hx, hy)
    @rect_list.push(R_Rect.new(lx, ly, hx, hy))
    return(@rect_list.last)
  end
  # ???????????(??)
  def split_rect(rect_par, flag = false)
    # ?????????????????????????????????
    if(rect_par.hx - rect_par.lx <= MIN_RECT_SIZE * 2)
         rect_par.done_v = true
      end
      if(rect_par.hy - rect_par.ly <= MIN_RECT_SIZE * 2)
         rect_par.done_h = true
      end
    # ?????????(?????????????????)
    if (rand(BIG_ROOM) == 0 && flag == true)
      rect_par.done_v = true
      rect_par.done_h = true
    end
    # ????????????????
      if((rect_par.done_v == true) && (rect_par.done_h == true))
         return
      end
    # ?????
    rect_child = add_rect(rect_par.lx, rect_par.ly, rect_par.hx, rect_par.hy)
    # ?????????????
      if(rect_par.done_v == false)
         split_coord_y = rand_range(rect_par.ly + MIN_RECT_SIZE,
                        rect_par.hy - MIN_RECT_SIZE)
         rect_par.hy = split_coord_y;
         rect_child.ly = split_coord_y;
      # ???????
         rect_par.done_v = true
         rect_child.done_v = true
      # ???????
      add_couple(R_VERTICAL, rect_par, rect_child);
      # ??
         split_rect(rect_par)
         split_rect(rect_child)
         return
      end
    # ?????????????
      if(rect_par.done_h == false)
         split_coord_x = rand_range(rect_par.lx + MIN_RECT_SIZE,
                        rect_par.hx - MIN_RECT_SIZE)
         rect_par.hx = split_coord_x;
         rect_child.lx = split_coord_x;
      # ???????
         rect_par.done_h = true
         rect_child.done_h = true
      # ???????
      add_couple(R_HORIZONAL, rect_par, rect_child);
      # ??
         split_rect(rect_par)
         split_rect(rect_child)
         return
      end
  end
  # ????????????????????
  def add_room(lx, ly, hx, hy)
    @room_list.push(R_Room.new(lx, ly, hx, hy))
    return(@room_list.last)
  end
  # ???????????
  def make_room()
    for i in 0...@rect_list.size
      #?????????X
         w = rand_range(MIN_ROOM_SIZE,
            (@rect_list.hx - @rect_list.lx - (MIN_BTWN_RECT_ROOM * 2) + 1))
      #?????????Y
         h = rand_range(MIN_ROOM_SIZE,
            (@rect_list.hy - @rect_list.ly - (MIN_BTWN_RECT_ROOM * 2) + 1))
      #?????
         x = rand_range(@rect_list.lx + MIN_BTWN_RECT_ROOM,
            @rect_list.hx - MIN_BTWN_RECT_ROOM - w + 1)
      #?????
         y = rand_range(@rect_list.ly + MIN_BTWN_RECT_ROOM,
            @rect_list.hy - MIN_BTWN_RECT_ROOM - h + 1)
      #?????????????
         @rect_list.room = add_room(x, y, x + w, y + h)
      end
  end
  #--------------------------------------------------------------------------
  # ? split_rect?????????????????????????
  #    ??split_rect???????????????
  #     v_or_h : ????????
  #     rect0  : ??1
  #     rect1  : ??2
  #--------------------------------------------------------------------------
  def add_couple(v_or_h, rect0, rect1)
    @couple_list.push(R_Couple.new(v_or_h, rect0, rect1))
    return(@couple_list.last)
  end
  #--------------------------------------------------------------------------
  # ? ??????????????????????
  #     x0     : ?1?X??
  #     y0     : ?1?Y??
  #     x1     : ?2?X??
  #     y1     : ?2?Y??
  #--------------------------------------------------------------------------
  def make_line(x0, y0, x1, y1)
    min_x = [x0, x1].min
    max_x = [x0, x1].max
    min_y = [y0, y1].min
    max_y = [y0, y1].max
    unless((min_x >= 0) && (max_x < @map.width) &&
      (min_y >= 0) && (max_y < @map.height))
      return
    end
    if((x0 <= x1) && (y0 >= y1))
      for i in min_x..max_x
        @map.data[i, max_y, 0] = FLOOR_TILE_ID
      end
      for j in min_y..max_y
        @map.data[max_x, j, 0] = FLOOR_TILE_ID
      end
      return
    end
    if((x0 > x1) && (y0 > y1))
      for i in min_x..max_x
        @map.data[i, min_y, 0] = FLOOR_TILE_ID
      end
      for j in min_y..max_y
        @map.data[max_x, j, 0] = FLOOR_TILE_ID
      end
      return
    end
    if((x0 > x1) && (y0 <= y1))
      for i in min_x..max_x
        @map.data[i, min_y, 0] = FLOOR_TILE_ID
      end
      for j in min_y..max_y
        @map.data[min_x, j, 0] = FLOOR_TILE_ID
      end
      return
    end
    if((x0 <= x1) && (y0 < y1))
      for i in min_x..max_x
        @map.data[i, max_y, 0] = FLOOR_TILE_ID
      end
      for j in min_y..max_y
        @map.data[min_x, j, 0] = FLOOR_TILE_ID
      end
      return
    end
  end
end
#-------------------------------------------------------------------------------
# ? Game_Interpreter
#-------------------------------------------------------------------------------
# ????????????????????????????? Game_Map ????
# Game_Troop ????Game_Event ??????????????
#-------------------------------------------------------------------------------
class Game_Interpreter
  #--------------------------------------------------------------------------
  # ? ???????
  #    $game_map.make_dungeon??????????
  #--------------------------------------------------------------------------
  def make_dungeon
    $game_map.make_dungeon
  end
end

modern algebra

#1
Hi Question faces.


Place code in code tags:





Quote the post to see them.

I am , however, curious as to why you need a random dungeon generator in VX when there is already one built in?

Zambaku

#2
The reason I want to use this script is becouse it generated the dungeon each time you enter instead of having a set dungeon.


Quote#==============================================================================
# ? VX_SP1
#------------------------------------------------------------------------------
# ??????????????????????
#==============================================================================

#------------------------------------------------------------------------------
# ?SP1 ?????
#------------------------------------------------------------------------------
# ??????????????????????????????????????
#   ??Y??????????????????????????????????
#   ?????????
# ???????????????Y??????????????????????
#   ??
# ??????????????????????????????????????
#   ???????????????????
#------------------------------------------------------------------------------

class Sprite_Base < Sprite
  #--------------------------------------------------------------------------
  # ? ??????????
  #--------------------------------------------------------------------------
  alias eb_sp1_dispose_animation dispose_animation
  def dispose_animation
    eb_sp1_dispose_animation
    @animation_bitmap1 = nil
    @animation_bitmap2 = nil
  end
  #--------------------------------------------------------------------------
  # ? ???????????????
  #     frame : ??????? (RPG::Animation::Frame)
  #--------------------------------------------------------------------------
  alias eb_sp1_animation_set_sprites animation_set_sprites
  def animation_set_sprites(frame)
    eb_sp1_animation_set_sprites(frame)
    cell_data = frame.cell_data
    for i in 0..15
      sprite = @animation_sprites[i]
      next if sprite == nil
      pattern = cell_data[i, 0]
      next if pattern == nil or pattern == -1
      if @animation_mirror
        sprite.y = @animation_oy + cell_data[i, 2]
      end
      sprite.z = self.z + 300 + i
    end
  end
end



Quote#-------------------------------------------------------------------------------
# ??????????????

# roguelike??????????????????????Game_Map????
# ??????
# ????????????????
# ??????????????????????????????
# ?????????????????????????????????????
#
# ?????????
#   Racanhack ????? [ http://racanhack.sourceforge.jp/rhdoc/index.html ]
#     ????????????????????

# ????
# ???ROGUELIKE_MAP_ID???????ID??? or
# ????????????????$game_map.make_dungeon?????
#
#----------------------------------------------------------------------------
# ??
#----------------------------------------------------------------------------
module ROGUELIKE_MAP
  # ?????????ID???
  # ?.???ID003?005???????? ? ROGUELIKE_MAP_ID = [3,5]
  ROGUELIKE_MAP_ID = []
  # VX????ID????????????????????
  # ????????ID
  SPACE_TILE_ID = 5888
  # ?????ID
  FLOOR_TILE_ID = 1552
  # ?????ID
  WALL_TILE_ID = 6280
  # ???????????(??????64, 1/????????????)
  # ??????????????????????1????
  # ??????????????????????????(nil???)
  BIG_ROOM = 64
  BIG_ROOM_SWITCH = nil
  # ??????????(??????96, 1/????????)
  ADD_COUPLE = 96
  # ?????????
  MIN_ROOM_SIZE = 2
  # ????????(3??????????????)
  MIN_BTWN_RECT_ROOM = 3
  # ?????????(??????2 + 3 * 2 = 8)
  MIN_RECT_SIZE = MIN_ROOM_SIZE + (MIN_BTWN_RECT_ROOM * 2)
  #--------------------------------------------------------------------------
  R_VERTICAL = 0
  R_HORIZONAL = 1
  # ?????????
  # min??max??????int??????
  def rand_range(min, max)
    return((min + rand(max - min)).round)
  end
#-------------------------------------------------------------------------------
  #R_Couple??? ????????
  class R_Couple
    attr_accessor :v_or_h
    attr_accessor :rect0
    attr_accessor :rect1
    def initialize(v_or_h, rect0, rect1)
      @v_or_h = v_or_h
      @rect0 = rect0
      @rect1 = rect1
    end
  end
  #R_Room??? ????????
  class R_Room
    attr_accessor :lx
    attr_accessor :ly
    attr_accessor :hx
    attr_accessor :hy
    def initialize(lx, ly, hx, hy)
      @lx = lx
      @ly = ly
      @hx = hx
      @hy = hy
    end
  end
  #R_Rect??? ????????
  class R_Rect < R_Room
    attr_accessor :done_v
    attr_accessor :done_h
    attr_accessor :room
    def initialize(lx, ly, hx, hy, done_v = false, done_h = false, room = nil)
      super(lx, ly, hx, hy)
      @done_v = done_v
      @done_h = done_h
      @room = room
    end
  end
end
#-------------------------------------------------------------------------------
# ? Game_Map
#-------------------------------------------------------------------------------
# ??????????????????????????????????????
# ????????????? $game_map ????????
#-------------------------------------------------------------------------------
class Game_Map
  include ROGUELIKE_MAP
  #--------------------------------------------------------------------------
  # ? ??????
  #     map_id : ??? ID
  #--------------------------------------------------------------------------
  alias randmap_setup setup
  def setup(map_id)
    #????
    randmap_setup(map_id)
    #???ID?????????ID?????????????????
    make_dungeon if(ROGUELIKE_MAP_ID.include?(map_id))
  end
  #--------------------------------------------------------------------------
  # ? ??????????????????
  #    ???????$game_map.make_dungeon??????setup???????
  #--------------------------------------------------------------------------
  def make_dungeon
    @rect_list = []   # ?????
    @room_list = []   # ?????
    @couple_list = [] # ??????
    # ???????????????????
    for i in 0...@map.width
      for j in 0...@map.height
        @map.data[i,j,0] = SPACE_TILE_ID
      end
    end
    # ?????(split_rect????????????)
    split_rect(add_rect(0,0,@map.width - 1, @map.height - 1), true)
    # ?????
    make_room
    # ???????
    for n in 0...@room_list.size
      for i in @room_list[n].lx..@room_list[n].hx
        for j in @room_list[n].ly..@room_list[n].hy
          @map.data[i,j,0] = FLOOR_TILE_ID
        end
      end
    end
    # ????????????????????
    rect_map = Array.new(@map.width)
    for i in 0...rect_map.size
      rect_map[i] = Array.new(@map.height)
    end
    for i in 0...@rect_list.size
      for j in @rect_list[i].lx..@rect_list[i].hx
        for k in @rect_list[i].ly..@rect_list[i].hy
          rect_map[j][k] = @rect_list[i]
        end
      end
    end
    for i in 0...(@map.width - 1)
      for j in 0...(@map.height - 1)
        break unless(rect_map[i][j] != nil)
        break unless(rect_map[i + 1][j] != nil)
        break unless(rect_map[i][j + 1] != nil)
        if(rect_map[i][j] != rect_map[i][j + 1])
          add_couple(R_VERTICAL, rect_map[i][j], rect_map[i][j + 1]) if (rand(ADD_COUPLE) == 0)
        end
        if(rect_map[i][j] != rect_map[i + 1][j])
          add_couple(R_HORIZONAL, rect_map[i][j], rect_map[i + 1][j]) if (rand(ADD_COUPLE) == 0)
        end
      end
    end
    # ????????????????
    for i in 0...@couple_list.size
      # ???????????
      if(@couple_list[i].v_or_h == R_HORIZONAL)
        break unless(@couple_list[i].rect0.hx == @couple_list[i].rect1.lx)
        c0x = @couple_list[i].rect0.hx
        c0y = rand_range(@couple_list[i].rect0.room.ly + 1,
                @couple_list[i].rect0.room.hy)
        c1x = @couple_list[i].rect1.lx
        c1y = rand_range(@couple_list[i].rect1.room.ly + 1,
                @couple_list[i].rect1.room.hy)
        make_line(c0x, c0y, c1x, c1y)
        make_line(@couple_list[i].rect0.room.hx, c0y, c0x, c0y)
        make_line(@couple_list[i].rect1.room.lx, c1y, c1x, c1y)
      # ???????????
      elsif(@couple_list[i].v_or_h == R_VERTICAL)
        break unless(@couple_list[i].rect0.hy == @couple_list[i].rect1.ly)
        c0x = rand_range(@couple_list[i].rect0.room.lx + 1,
                @couple_list[i].rect0.room.hx)
        c0y = @couple_list[i].rect0.hy
        c1x = rand_range(@couple_list[i].rect1.room.lx + 1,
                @couple_list[i].rect1.room.hx)
        c1y = @couple_list[i].rect1.ly
        make_line(c0x, c0y, c1x, c1y)
        make_line(c0x, @couple_list[i].rect0.room.hy, c0x, c0y)
        make_line(c1x, @couple_list[i].rect1.room.ly, c1x, c1y)
      end
    end
    # ???(????????????????????????????????)
    for i in 0...@map.width
      for j in 1...@map.height
        if(@map.data[i, j, 0] == FLOOR_TILE_ID &&
          @map.data[i, j - 1, 0] == SPACE_TILE_ID)
          @map.data[i, j - 1, 0] = WALL_TILE_ID
        end
      end
    end
    # ??
  end
  # ????????????????????
  def add_rect(lx, ly, hx, hy)
    @rect_list.push(R_Rect.new(lx, ly, hx, hy))
    return(@rect_list.last)
  end
  # ???????????(??)
  def split_rect(rect_par, flag = false)
    # ?????????????????????????????????
    if(rect_par.hx - rect_par.lx <= MIN_RECT_SIZE * 2)
rect_par.done_v = true
end
if(rect_par.hy - rect_par.ly <= MIN_RECT_SIZE * 2)
rect_par.done_h = true
end
    # ?????????(?????????????????)
    if (rand(BIG_ROOM) == 0 && flag == true)
      rect_par.done_v = true
      rect_par.done_h = true
    end
    # ????????????????
if((rect_par.done_v == true) && (rect_par.done_h == true))
return
end
    # ?????
    rect_child = add_rect(rect_par.lx, rect_par.ly, rect_par.hx, rect_par.hy)
    # ?????????????
if(rect_par.done_v == false)
split_coord_y = rand_range(rect_par.ly + MIN_RECT_SIZE,
                        rect_par.hy - MIN_RECT_SIZE)
rect_par.hy = split_coord_y;
rect_child.ly = split_coord_y;
      # ???????
rect_par.done_v = true
rect_child.done_v = true
      # ???????
      add_couple(R_VERTICAL, rect_par, rect_child);
      # ??
split_rect(rect_par)
split_rect(rect_child)
return
end
    # ?????????????
if(rect_par.done_h == false)
split_coord_x = rand_range(rect_par.lx + MIN_RECT_SIZE,
                        rect_par.hx - MIN_RECT_SIZE)
rect_par.hx = split_coord_x;
rect_child.lx = split_coord_x;
      # ???????
rect_par.done_h = true
rect_child.done_h = true
      # ???????
      add_couple(R_HORIZONAL, rect_par, rect_child);
      # ??
split_rect(rect_par)
split_rect(rect_child)
return
end
  end
  # ????????????????????
  def add_room(lx, ly, hx, hy)
    @room_list.push(R_Room.new(lx, ly, hx, hy))
    return(@room_list.last)
  end
  # ???????????
  def make_room()
    for i in 0...@rect_list.size
      #?????????X
w = rand_range(MIN_ROOM_SIZE,
            (@rect_list[i].hx - @rect_list[i].lx - (MIN_BTWN_RECT_ROOM * 2) + 1))
      #?????????Y
h = rand_range(MIN_ROOM_SIZE,
            (@rect_list[i].hy - @rect_list[i].ly - (MIN_BTWN_RECT_ROOM * 2) + 1))
      #?????
x = rand_range(@rect_list[i].lx + MIN_BTWN_RECT_ROOM,
            @rect_list[i].hx - MIN_BTWN_RECT_ROOM - w + 1)
      #?????
y = rand_range(@rect_list[i].ly + MIN_BTWN_RECT_ROOM,
            @rect_list[i].hy - MIN_BTWN_RECT_ROOM - h + 1)
      #?????????????
@rect_list[i].room = add_room(x, y, x + w, y + h)
end
  end
  #--------------------------------------------------------------------------
  # ? split_rect?????????????????????????
  #    ??split_rect???????????????
  #     v_or_h : ????????
  #     rect0  : ??1
  #     rect1  : ??2
  #--------------------------------------------------------------------------
  def add_couple(v_or_h, rect0, rect1)
    @couple_list.push(R_Couple.new(v_or_h, rect0, rect1))
    return(@couple_list.last)
  end
  #--------------------------------------------------------------------------
  # ? ??????????????????????
  #     x0     : ?1?X??
  #     y0     : ?1?Y??
  #     x1     : ?2?X??
  #     y1     : ?2?Y??
  #--------------------------------------------------------------------------
  def make_line(x0, y0, x1, y1)
    min_x = [x0, x1].min
    max_x = [x0, x1].max
    min_y = [y0, y1].min
    max_y = [y0, y1].max
    unless((min_x >= 0) && (max_x < @map.width) &&
      (min_y >= 0) && (max_y < @map.height))
      return
    end
    if((x0 <= x1) && (y0 >= y1))
      for i in min_x..max_x
        @map.data[i, max_y, 0] = FLOOR_TILE_ID
      end
      for j in min_y..max_y
        @map.data[max_x, j, 0] = FLOOR_TILE_ID
      end
      return
    end
    if((x0 > x1) && (y0 > y1))
      for i in min_x..max_x
        @map.data[i, min_y, 0] = FLOOR_TILE_ID
      end
      for j in min_y..max_y
        @map.data[max_x, j, 0] = FLOOR_TILE_ID
      end
      return
    end
    if((x0 > x1) && (y0 <= y1))
      for i in min_x..max_x
        @map.data[i, min_y, 0] = FLOOR_TILE_ID
      end
      for j in min_y..max_y
        @map.data[min_x, j, 0] = FLOOR_TILE_ID
      end
      return
    end
    if((x0 <= x1) && (y0 < y1))
      for i in min_x..max_x
        @map.data[i, max_y, 0] = FLOOR_TILE_ID
      end
      for j in min_y..max_y
        @map.data[min_x, j, 0] = FLOOR_TILE_ID
      end
      return
    end
  end
end
#-------------------------------------------------------------------------------
# ? Game_Interpreter
#-------------------------------------------------------------------------------
# ????????????????????????????? Game_Map ????
# Game_Troop ????Game_Event ??????????????
#-------------------------------------------------------------------------------
class Game_Interpreter
  #--------------------------------------------------------------------------
  # ? ???????
  #    $game_map.make_dungeon??????????
  #--------------------------------------------------------------------------
  def make_dungeon
    $game_map.make_dungeon
  end
end



Quote=begin


???????????????

?????????????????????????????????????
?????????????????????????????????
??(????????????????????????????????)

????????????????????????????????????

????????RPG????XP??????????????????????
???RPG????VX????????????????????????


??????????????

???????????????????????????????????
???????????????????????????????????
????????????????????????


=end

Gnarizard

See how this one works for ya.

Simply Copy/Paste the scripts into your game, as well as the common events.

Make sure you copy the events on the blank map in the demo as well.
The 1st one calls all the necessary things to randomize the map, the 2nd is a staircase that gets placed randomly.

Anything you want to appear randomly (probably everything) should have a 1st page that contains the same stuff as the staircase's 1st page.
The 2nd page can be whatever you want (chest, barrel, etc.)

I suggest that you make any random events movable and/or destructible, otherwise you may accidentally cut the player off from a corridor.

Make sure to use the "Fadeout Screen" command under "Screen Effects" on the second page of event commands before you teleport to a new map, otherwise there will be an awkward moment where your player will be standing in the middle of nowhere before the map generates and fades in again.

That should be about it, I hope that helps! ;D

(Note: The fact that the script is in Japanese should not affect the script's function)

PS: You don't get to use Switch #0001 because the RDG (Rand. Dungeon Gen.) uses it.

ALSO: I hope I didn't necro-post needlessly. I'm only trying to help resolve an unresolved topic. :)

Grafikal

Quote from: modern algebra on July 12, 2008, 10:19:38 PM
I am , however, curious as to why you need a random dungeon generator in VX when there is already one built in?

Hey MA, I think (if understand this correctly) that this script serves a similar if not the same purpose as something like random dungeon gen from .hack if you're familiar with the .hack series.