Lagaan2
|
  |
| Joined: 31 Dec 2011 |
| Total Posts: 167 |
|
|
| 29 Jun 2013 08:16 PM |
| I'm working on a place that has a maze that needs to change with every night/day cycle. I know almost nothing about scripting, so how would I do this? |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:02 PM |
Alright, just saying:
Programming functional mazes that have a start and end is actually extremely advanced. I've tried many times before and almost got a working one once but not completely |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:15 PM |
| What you can do is create a bucnh of different mazes and do math.random for the order of them. That's the simplest possible way to do it. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:18 PM |
| If you want it to be a different maze every time then make an if statement to check if it is a certain time of day then when that happens have a math.random to change certain bricks to be in a different position, or be invisible and no-collided, and any other property changes. |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:28 PM |
here you are, just made it for you this is probably the closest you'll get to a fully functional maze enjoy :D
gapX=15 gapZ=15 height=10 mazeRadius=200 seed=math.random(1,1000000) --same seed = same maze
while true do math.randomseed(seed) model=Instance.new("Model",game.Workspace) model.Name="MazeParts" for z=-mazeRadius/2,mazeRadius/2,gapZ do for x=-mazeRadius/2,mazeRadius/2,gapX do part=Instance.new("Part") part.Parent=model part.Anchored=true part.TopSurface="Smooth" if math.floor(math.random(1,2))==1 then --set the sizes, randomly facing right-left or left-right part.Size=Vector3.new(gapX,height,2) else part.Size=Vector3.new(2,height,gapZ) end part.CFrame=CFrame.new(x,height/2,z) end end
wait(3) --every 3 seconds the maze changes (you'll probably want it longer haha) model:remove() end |
|
|
| Report Abuse |
|
|
|
| 29 Jun 2013 09:29 PM |
whoops, forgot to fix something,
try THIS one
gapX=15 gapZ=15 height=10 mazeRadius=200
while true do seed=math.random(1,1000000) --same seed = same maze
math.randomseed(seed) model=Instance.new("Model",game.Workspace) model.Name="MazeParts" for z=-mazeRadius/2,mazeRadius/2,gapZ do for x=-mazeRadius/2,mazeRadius/2,gapX do part=Instance.new("Part") part.Parent=model part.Anchored=true part.TopSurface="Smooth" if math.floor(math.random(1,2))==1 then --set the sizes, randomly facing right-left or left-right part.Size=Vector3.new(gapX,height,2) else part.Size=Vector3.new(2,height,gapZ) end part.CFrame=CFrame.new(x,height/2,z) end end
wait(3) --every 3 seconds the maze changes (you'll probably want it longer haha) model:remove() end |
|
|
| Report Abuse |
|
|