SHOW:
|
|
- or go back to the newest paste.
1 | --This isn't mine, i would of never thought of making this but its cool-- | |
2 | HeightVariation=4.75 --The Higher this number is the more "Hilly" the maps are going to get.(Measured in Studs) | |
3 | BiomeSize=420 --This is half the length/width of the Biome Squares | |
4 | PartsPerBiome=125 | |
5 | TreesInForest=55 | |
6 | TreesInSavannah=3 | |
7 | MaxBlockSize=100 | |
8 | MinimumBlockSize=80 | |
9 | BiomeSquares=3 --Choose an integer 1-5, 5 will have 25 Biome squares, and 1 will have 1. | |
10 | ||
11 | ||
12 | game.Lighting.TimeOfDay = "12:00:00" | |
13 | function Swamp(x,z) | |
14 | local Colors = {"Bright green","Dark green", "Camo", "Earth green", "Br. yellowish green"} | |
15 | local f=Instance.new("Part") | |
16 | f.Anchored = true | |
17 | f.Name="Waka" | |
18 | f.Color = Color3.new(0, 0, 1) | |
19 | f.CFrame = CFrame.new(x, 7, z) | |
20 | f.Transparency = 0.4 | |
21 | f.CanCollide = false | |
22 | f.Size = Vector3.new(BiomeSize*2, 20, BiomeSize*2) | |
23 | f.Parent = game.Workspace | |
24 | for i=1,PartsPerBiome do | |
25 | local h = Instance.new("SpawnLocation") | |
26 | h.Position = Vector3.new(math.random(x-BiomeSize, x+BiomeSize), 1+math.random(-1*HeightVariation, HeightVariation), math.random(z-BiomeSize, z+BiomeSize)) | |
27 | h.Anchored = true | |
28 | h.Name = "Waka" | |
29 | h.BrickColor = BrickColor.new(Colors[math.random(1, #Colors)]) | |
30 | h.Size = Vector3.new(math.random(MinimumBlockSize,MaxBlockSize), math.random(4, 50), math.random(MinimumBlockSize, MaxBlockSize)) | |
31 | h:clone().Parent = game.Workspace | |
32 | wait(0.001) | |
33 | end | |
34 | end | |
35 | function Mount(x,z) | |
36 | local Colors = {"Medium stone grey", "Black", "Light stone grey"} | |
37 | local f=Instance.new("Part") | |
38 | f.Anchored = true | |
39 | f.Name="Waka" | |
40 | f.BrickColor = BrickColor.new("Medium stone grey") | |
41 | f.CFrame = CFrame.new(x, 7, z) | |
42 | f.Transparency = 0 | |
43 | f.CanCollide = true | |
44 | f.Size = Vector3.new(BiomeSize*2, 20, BiomeSize*2) | |
45 | f.Parent = game.Workspace | |
46 | for i=1,PartsPerBiome do | |
47 | local h = Instance.new("SpawnLocation") | |
48 | h.Position = Vector3.new(math.random(x-BiomeSize, x+BiomeSize), 17+math.random(-1*HeightVariation, HeightVariation), math.random(z-BiomeSize, z+BiomeSize)) | |
49 | h.Anchored = true | |
50 | h.Name = "Waka" | |
51 | h.BrickColor = BrickColor.new(Colors[math.random(1, #Colors)]) | |
52 | h.Size = Vector3.new(math.random(MinimumBlockSize,MaxBlockSize), math.random(4, 50), math.random(MinimumBlockSize, MaxBlockSize)) | |
53 | h:clone().Parent = game.Workspace | |
54 | wait(0.001) | |
55 | end | |
56 | end | |
57 | function Sand(x,z) | |
58 | local Colors = {"Cool yellow", "CGA brown", "Deep orange", "Pastel yellow"} | |
59 | local f=Instance.new("Part") | |
60 | f.Anchored = true | |
61 | f.Name="Waka" | |
62 | f.BrickColor = BrickColor.new("Deep orange") | |
63 | f.CFrame = CFrame.new(x, 7, z) | |
64 | f.Transparency = 0 | |
65 | f.CanCollide = true | |
66 | f.Size = Vector3.new(BiomeSize*2, 20, BiomeSize*2) | |
67 | f.Parent = game.Workspace | |
68 | for i=1,PartsPerBiome do | |
69 | local h = Instance.new("SpawnLocation") | |
70 | h.Position = Vector3.new(math.random(x-BiomeSize, x+BiomeSize), 17+math.random(-1*HeightVariation, HeightVariation), math.random(z-BiomeSize, z+BiomeSize)) | |
71 | h.Anchored = true | |
72 | h.Name = "Waka" | |
73 | h.BrickColor = BrickColor.new(Colors[math.random(1, #Colors)]) | |
74 | h.Size = Vector3.new(math.random(MinimumBlockSize,MaxBlockSize), math.random(4, 50), math.random(MinimumBlockSize, MaxBlockSize)) | |
75 | h:clone().Parent = game.Workspace | |
76 | wait(0.001) | |
77 | end | |
78 | end | |
79 | function Forest(x,z) | |
80 | local Colors = {"Bright green"} | |
81 | local f=Instance.new("Part") | |
82 | f.Anchored = true | |
83 | f.Name="Waka" | |
84 | f.BrickColor = BrickColor.new("Bright green") | |
85 | f.CFrame = CFrame.new(x, 7, z) | |
86 | f.Transparency = 0 | |
87 | f.CanCollide = true | |
88 | f.Size = Vector3.new(BiomeSize*2, 20, BiomeSize*2) | |
89 | f.Parent = game.Workspace | |
90 | for i=1,PartsPerBiome do | |
91 | local h = Instance.new("SpawnLocation") | |
92 | h.Position = Vector3.new(math.random(x-BiomeSize, x+BiomeSize), 17+math.random(-1*HeightVariation, HeightVariation), math.random(z-BiomeSize, z+BiomeSize)) | |
93 | h.Anchored = true | |
94 | h.Name = "Waka" | |
95 | h.BrickColor = BrickColor.new(Colors[math.random(1, #Colors)]) | |
96 | h.Size = Vector3.new(math.random(MinimumBlockSize,MaxBlockSize), math.random(4, 50), math.random(MinimumBlockSize, MaxBlockSize)) | |
97 | h:clone().Parent = game.Workspace | |
98 | wait(0.001) | |
99 | end | |
100 | local Base = Instance.new("Part") | |
101 | Base.Name = "Trunk" | |
102 | Base.formFactor = "Custom" | |
103 | Base.TopSurface = 0 | |
104 | Base.BottomSurface = 0 | |
105 | Base.Anchored = true | |
106 | Base.BrickColor = BrickColor.new("Reddish brown") | |
107 | local Leaves = Base:Clone() | |
108 | Leaves.Name = "Leaves" | |
109 | Leaves.CanCollide = false | |
110 | Leaves.BrickColor = BrickColor.new("Dark green") | |
111 | local leafmesh = Instance.new("SpecialMesh") | |
112 | leafmesh.MeshType = "FileMesh" | |
113 | leafmesh.MeshId = "http://www.roblox.com/asset/?id=1290033" | |
114 | leafmesh.TextureId = "http://www.roblox.com/asset/?id=2861779" | |
115 | leafmesh.Parent = Leaves | |
116 | Instance.new("CylinderMesh",Base) | |
117 | function dot(c1,c2) | |
118 | local m = CFrame.Angles(math.pi/2,0,0) | |
119 | return (c1*m).lookVector:Dot((c2*m).lookVector) | |
120 | end | |
121 | local leaf_mult = { | |
122 | Vector3.new(1.5,1.5,1.2); | |
123 | Vector3.new(1.5,1,1.5); | |
124 | Vector3.new(1.2,1.5,1.5); | |
125 | Vector3.new(1.5,1.5,1.5); | |
126 | } | |
127 | ||
128 | function Branch(base,c) | |
129 | if c <= 0 then | |
130 | local leaves = Leaves:Clone() | |
131 | local vol = base.Size.x+base.Size.y+base.Size.z | |
132 | leaves.Mesh.Scale = leaf_mult[math.random(1,#leaf_mult)]*math.random(vol/3*10,vol/3*12)/10 | |
133 | leaves.Size = leaves.Mesh.Scale*0.75 | |
134 | leaves.CFrame = base.CFrame * CFrame.new(0,base.Size.y/2,0) | |
135 | leaves.Parent = base.Parent | |
136 | else | |
137 | local pos = base.CFrame*CFrame.new(0,base.Size/2,0) | |
138 | local height = base.Size.y | |
139 | local width = base.Size.x | |
140 | local nb = math.random(2,2) | |
141 | local r = math.random(45,135) | |
142 | local da = math.random(20+55/c,40+40/c) | |
143 | local ba = math.random(-da/3,da/3) | |
144 | for i=0,nb-1 do | |
145 | local branch = base:Clone() | |
146 | branch.Name = "Branch" | |
147 | local h = height*math.random(95,115)/100 | |
148 | local new = branch.CFrame * CFrame.new(0,height/2,0) * CFrame.Angles(0,0,math.rad(ba)) | |
149 | new = new * CFrame.Angles(0,i*(math.pi*2/nb)+r,math.rad(da/2)) * CFrame.new(0,h/2,0) | |
150 | local w = dot(new,branch.CFrame)*width*0.9 | |
151 | ||
152 | branch.Size = Vector3.new(w,h,w) | |
153 | branch.CFrame = new | |
154 | branch.Parent = base.Parent | |
155 | ||
156 | Branch(branch,c-1) | |
157 | end | |
158 | end | |
159 | end | |
160 | ||
161 | ||
162 | function _G.Tree(location,complexity,width,height) | |
163 | local tree = Instance.new("Model") | |
164 | tree.Name = "Waka" | |
165 | tree.archivable = false | |
166 | tree.Parent = workspace | |
167 | local base = Base:Clone() | |
168 | base.Parent = tree | |
169 | base.Size = Vector3.new(width,height,width) | |
170 | -- move up by half its height, and rotate randomly | |
171 | base.CFrame = location * CFrame.new(0,height/2,0) * CFrame.Angles(0,math.rad(math.random(1,360)),0) | |
172 | -- start branching | |
173 | Branch(base,complexity) | |
174 | return tree | |
175 | end | |
176 | for i=1,TreesInForest do | |
177 | _G.Tree(CFrame.new(math.random(x-BiomeSize, x+BiomeSize), 17, math.random(z-BiomeSize, z+BiomeSize)),3,4,20) | |
178 | end | |
179 | end | |
180 | function Savannah(x,z) | |
181 | local Colors = {"Bright green"} | |
182 | local f=Instance.new("Part") | |
183 | f.Anchored = true | |
184 | f.Name="Waka" | |
185 | f.BrickColor = BrickColor.new("Bright green") | |
186 | f.CFrame = CFrame.new(x, 7, z) | |
187 | f.Transparency = 0 | |
188 | f.CanCollide = true | |
189 | f.Size = Vector3.new(BiomeSize*2, 20, BiomeSize*2) | |
190 | f.Parent = game.Workspace | |
191 | for i=1,PartsPerBiome do | |
192 | local h = Instance.new("SpawnLocation") | |
193 | h.Position = Vector3.new(math.random(x-BiomeSize, x+BiomeSize), 17+math.random(-1*HeightVariation, HeightVariation), math.random(z-BiomeSize, z+BiomeSize)) | |
194 | h.Anchored = true | |
195 | h.Name = "Waka" | |
196 | h.BrickColor = BrickColor.new(Colors[math.random(1, #Colors)]) | |
197 | h.Size = Vector3.new(math.random(MinimumBlockSize,MaxBlockSize), math.random(4, 50), math.random(MinimumBlockSize, MaxBlockSize)) | |
198 | h:clone().Parent = game.Workspace | |
199 | wait(0.001) | |
200 | end | |
201 | local Base = Instance.new("Part") | |
202 | Base.Name = "Trunk" | |
203 | Base.formFactor = "Custom" | |
204 | Base.TopSurface = 0 | |
205 | Base.BottomSurface = 0 | |
206 | Base.Anchored = true | |
207 | Base.BrickColor = BrickColor.new("Reddish brown") | |
208 | local Leaves = Base:Clone() | |
209 | Leaves.Name = "Leaves" | |
210 | Leaves.CanCollide = false | |
211 | Leaves.BrickColor = BrickColor.new("Dark green") | |
212 | local leafmesh = Instance.new("SpecialMesh") | |
213 | leafmesh.MeshType = "FileMesh" | |
214 | leafmesh.MeshId = "http://www.roblox.com/asset/?id=1290033" | |
215 | leafmesh.TextureId = "http://www.roblox.com/asset/?id=2861779" | |
216 | leafmesh.Parent = Leaves | |
217 | Instance.new("CylinderMesh",Base) | |
218 | function dot(c1,c2) | |
219 | local m = CFrame.Angles(math.pi/2,0,0) | |
220 | return (c1*m).lookVector:Dot((c2*m).lookVector) | |
221 | end | |
222 | local leaf_mult = { | |
223 | Vector3.new(1.5,1.5,1.2); | |
224 | Vector3.new(1.5,1,1.5); | |
225 | Vector3.new(1.2,1.5,1.5); | |
226 | Vector3.new(1.5,1.5,1.5); | |
227 | } | |
228 | ||
229 | function Branch(base,c) | |
230 | if c <= 0 then | |
231 | local leaves = Leaves:Clone() | |
232 | local vol = base.Size.x+base.Size.y+base.Size.z | |
233 | leaves.Mesh.Scale = leaf_mult[math.random(1,#leaf_mult)]*math.random(vol/3*10,vol/3*12)/10 | |
234 | leaves.Size = leaves.Mesh.Scale*0.75 | |
235 | leaves.CFrame = base.CFrame * CFrame.new(0,base.Size.y/2,0) | |
236 | leaves.Parent = base.Parent | |
237 | else | |
238 | local pos = base.CFrame*CFrame.new(0,base.Size/2,0) | |
239 | local height = base.Size.y | |
240 | local width = base.Size.x | |
241 | local nb = math.random(2,2) | |
242 | local r = math.random(45,135) | |
243 | local da = math.random(20+55/c,40+40/c) | |
244 | local ba = math.random(-da/3,da/3) | |
245 | for i=0,nb-1 do | |
246 | local branch = base:Clone() | |
247 | branch.Name = "Branch" | |
248 | local h = height*math.random(95,115)/100 | |
249 | local new = branch.CFrame * CFrame.new(0,height/2,0) * CFrame.Angles(0,0,math.rad(ba)) | |
250 | new = new * CFrame.Angles(0,i*(math.pi*2/nb)+r,math.rad(da/2)) * CFrame.new(0,h/2,0) | |
251 | local w = dot(new,branch.CFrame)*width*0.9 | |
252 | ||
253 | branch.Size = Vector3.new(w,h,w) | |
254 | branch.CFrame = new | |
255 | branch.Parent = base.Parent | |
256 | ||
257 | Branch(branch,c-1) | |
258 | end | |
259 | end | |
260 | end | |
261 | ||
262 | ||
263 | function _G.Tree(location,complexity,width,height) | |
264 | local tree = Instance.new("Model") | |
265 | tree.Name = "Waka" | |
266 | tree.archivable = false | |
267 | tree.Parent = workspace | |
268 | local base = Base:Clone() | |
269 | base.Parent = tree | |
270 | base.Size = Vector3.new(width,height,width) | |
271 | -- move up by half its height, and rotate randomly | |
272 | base.CFrame = location * CFrame.new(0,height/2,0) * CFrame.Angles(0,math.rad(math.random(1,360)),0) | |
273 | -- start branching | |
274 | Branch(base,complexity) | |
275 | return tree | |
276 | end | |
277 | for i=1,TreesInSavannah do | |
278 | _G.Tree(CFrame.new(math.random(x-BiomeSize, x+BiomeSize), 1, math.random(z-BiomeSize, z+BiomeSize)),3,4,20) | |
279 | end | |
280 | end | |
281 | function find(X,Z) | |
282 | local R=math.random(1,5) | |
283 | if R==1 then | |
284 | Swamp(X,Z) | |
285 | end | |
286 | if R==2 then | |
287 | Mount(X,Z) | |
288 | end | |
289 | if R==3 then | |
290 | Sand(X,Z) | |
291 | end | |
292 | if R==4 then | |
293 | Forest(X,Z) | |
294 | end | |
295 | if R==5 then | |
296 | Savannah(X,Z) | |
297 | end | |
298 | end | |
299 | if BiomeSquares==1 then | |
300 | find(BiomeSize*-3,BiomeSize*-3) | |
301 | end | |
302 | if BiomeSquares==2 then | |
303 | find(BiomeSize*-3,BiomeSize*-3) | |
304 | find(BiomeSize*-1,BiomeSize*-3) | |
305 | find(BiomeSize*-3,BiomeSize*-1) | |
306 | find(BiomeSize*-1,BiomeSize*-1) | |
307 | end | |
308 | if BiomeSquares==3 then | |
309 | find(BiomeSize*-3,BiomeSize*-3) | |
310 | find(BiomeSize*-1,BiomeSize*-3) | |
311 | find(BiomeSize,BiomeSize*-3) | |
312 | find(BiomeSize*-3,BiomeSize*-1) | |
313 | find(BiomeSize*-1,BiomeSize*-1) | |
314 | find(BiomeSize,BiomeSize*-1) | |
315 | find(BiomeSize*-3,BiomeSize) | |
316 | find(BiomeSize*-1,BiomeSize) | |
317 | find(BiomeSize,BiomeSize) | |
318 | end | |
319 | if BiomeSquares==4 then | |
320 | find(BiomeSize*-3,BiomeSize*-3) | |
321 | find(BiomeSize*-1,BiomeSize*-3) | |
322 | find(BiomeSize,BiomeSize*-3) | |
323 | find(BiomeSize*3,BiomeSize*-3) | |
324 | find(BiomeSize*-3,BiomeSize*-1) | |
325 | find(BiomeSize*-1,BiomeSize*-1) | |
326 | find(BiomeSize,BiomeSize*-1) | |
327 | find(BiomeSize*3,BiomeSize*-1) | |
328 | find(BiomeSize*-3,BiomeSize) | |
329 | find(BiomeSize*-1,BiomeSize) | |
330 | find(BiomeSize,BiomeSize) | |
331 | find(BiomeSize*3,BiomeSize) | |
332 | find(BiomeSize*-3,BiomeSize*3) | |
333 | find(BiomeSize*-1,BiomeSize*3) | |
334 | find(BiomeSize,BiomeSize*3) | |
335 | find(BiomeSize*3,BiomeSize*3) | |
336 | end | |
337 | if BiomeSquares==5 then | |
338 | find(BiomeSize*-3,BiomeSize*-3) | |
339 | find(BiomeSize*-1,BiomeSize*-3) | |
340 | find(BiomeSize,BiomeSize*-3) | |
341 | find(BiomeSize*3,BiomeSize*-3) | |
342 | find(BiomeSize*5,BiomeSize*-3) | |
343 | find(BiomeSize*-3,BiomeSize*-1) | |
344 | find(BiomeSize*-1,BiomeSize*-1) | |
345 | find(BiomeSize,BiomeSize*-1) | |
346 | find(BiomeSize*3,BiomeSize*-1) | |
347 | find(BiomeSize*5,BiomeSize*-1) | |
348 | find(BiomeSize*-3,BiomeSize) | |
349 | find(BiomeSize*-1,BiomeSize) | |
350 | find(BiomeSize,BiomeSize) | |
351 | find(BiomeSize*3,BiomeSize) | |
352 | find(BiomeSize*5,BiomeSize) | |
353 | find(BiomeSize*-3,BiomeSize*3) | |
354 | find(BiomeSize*-1,BiomeSize*3) | |
355 | find(BiomeSize,BiomeSize*3) | |
356 | find(BiomeSize*3,BiomeSize*3) | |
357 | find(BiomeSize*5,BiomeSize*3) | |
358 | find(BiomeSize*-3,BiomeSize*5) | |
359 | find(BiomeSize*-1,BiomeSize*5) | |
360 | find(BiomeSize,BiomeSize*5) | |
361 | find(BiomeSize*3,BiomeSize*5) | |
362 | find(BiomeSize*5,BiomeSize*5) | |
363 | end |