- Joined
- Jul 16, 2015
- Messages
- 6
- Reaction score
- 0
- First Language
- Ruby
- Primarily Uses
Hello
Nice scipt there! Awesome I should say!! But, while playing / testing it, I found a big flaw
:
When you have multiple required rooms with the same size they skacks up.
exemple : 3 switches required in a Puzzle dungeon
You endup with 8 events instead of 5 : the <keep> one, the exit and 5 switches.
They stacks in 3 piles: one of 3 switches, an other of 2 switches and, the last one, alone.
After some works, I find how to patch it. Basically there is only a keyword missing : "break". The rest is simply a personal rewrite.
All for a world more..... random

Nice scipt there! Awesome I should say!! But, while playing / testing it, I found a big flaw
:When you have multiple required rooms with the same size they skacks up.
exemple : 3 switches required in a Puzzle dungeon
You endup with 8 events instead of 5 : the <keep> one, the exit and 5 switches.
They stacks in 3 piles: one of 3 switches, an other of 2 switches and, the last one, alone.
After some works, I find how to patch it. Basically there is only a keyword missing : "break". The rest is simply a personal rewrite.
#While there are rooms to add if !room_slots.empty? and depth <= 10 p depth depth+=1 next_batch = [] room_slots.shuffle! for s in room_slots next unless req_rooms.each_with_index{|req_room, i| if (!s.disallow_quests && req_room != nil && req_room.w == s.w && req_room.h == s.h) #place the req_room next_batch.concat dungeon_room(req_room.map_id, s.w, s.h, s.x, s.y,req_room.x,req_room.y) #remove the req_room req_rooms.delete_at(i) # the next line is the patch. In your version, you continue to loop inside req_rooms after getting a match ;( break # go to the next slot (the break statement will return the nil value and will be "capture" by the "next unless #{value}" above) end } #otherwise, place random room, as per normal for that slot next_batch.concat dungeon_room(s.map_id, s.w, s.h, s.x, s.y) end room_slots = next_batch end
Last edited by a moderator:




