#Room generation problem

13 messages · Page 1 of 1 (latest)

remote lava
#

Room script:

local room = {}
room.Info = require(script.RoomInfo)
room.LastTurnDirection = nil
room.random = Random.new()

function room.GetRandom(prevRoom)
local possibleRooms = workspace.Rooms:GetChildren()
local randomRoom = possibleRooms[room.random:NextInteger(1, #possibleRooms)]

--[1] Next room MUST be different than the previous
--[2] If corner then next turn must turn other way
--[3] If prev room had stairs, then the next room cannot

local direction = room.Info[randomRoom.Name]["Direction"]
local hasStairs = room.Info[randomRoom.Name]["Stairs"]
local prevHadStairs = room.Info[randomRoom.Name]["Direction"]

if (prevRoom.Name == randomRoom.Name)
    or (direction and direction == room.LastTurnDirection)
    or (hasStairs and prevHadStairs)
then
    return room.GetRandom(prevRoom)
else 
    if direction then
        room.LastTurnDirection = direction
    end
    
    return randomRoom
end

end

function room.Generate(prevRoom)
local randomRoom = room.GetRandom(prevRoom)
local newRoom = randomRoom:Clone()

newRoom.PrimaryPart = newRoom.Entrance
newRoom:PivotTo(prevRoom.Exit.CFrame)
newRoom.Entrance.Transparency = 1

newRoom.Parent = workspace.GeneratedRooms

return newRoom

end

return room
.

Roominfo script:
local roomInfo = {
["StartRoom"] = {

},
["LavaChoice"] = {
    
},
["SimpleRoom"] = {
    
},
["RightTurn"] = {
    ["Direction"] = "Right"
}

}

--["LeftTurn"] = {
--["Direction"] = "Left"
--},

--["Downstairs"] = {
--["Stairs"] = true
--},

return roomInfo

remote lava
#

Room generation problem

crimson galleon
#

Idk

remote lava
#

if you dont know just don't talk

crimson galleon
#

I talk what i want

#

I wont let anyone shush me

remote lava
crimson galleon
remote lava
#

just shut the fck up