Advertisement
Guest User

Untitled

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