Advertisement
Derek1017

Terrain

May 25th, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.44 KB | None | 0 0
  1. -------------------------------------------
  2. --#----~~~dylanbuider~~~----#--    NEW: Tilt Affect for Terrain!
  3. -------------------------------------------
  4. ----()----Terrain Script v1.5----()----                         [ If You Use, Please Give me Credit :) Thank You. ]
  5. -------------------------------------------                                     Very Experimental Script. Have Fun :3
  6.  
  7.  
  8. local size = 40--Size of Terrain Bricks(Smallest Size)
  9. local maxsize = 70--Size of Terrain Bricks(Largest Size)
  10. local tilt = 0 --Tilt of terrain(0 for no tilt) Best to be between 0 to 12
  11.  
  12. local amount = 300 --Amount of Bricks
  13.  
  14. width = 200 -- Max Width of Terrain
  15. height = 30 --Max Height of Terrain(HAS TO BE EVEN NUMBER!!)
  16.  
  17. terrain = 2 --Type Of Terrain (0=Sphere,1=Brick,2=Cylinder)
  18.  
  19. water = false --Put false for no Water
  20. watersize = 4 --Size(If water is true) Best to be inBetween 2 to 12
  21. waterlevel = 1 --height of water(If water is true) Should be between 1 to 2 (Lower Number creates less land Above water)
  22.  
  23. customcolor = "Bright green" --Terrain BrickColor(If autocolor is false)
  24. material = "Plastic" --Terrain Material                                                                                                                                          
  25.                                                                                                                                                                                                
  26. autocolor = true --Automatic Terrain Coloring(set false for no autocolor)      
  27.  
  28. trees = true --Set to false if You want No trees     --->(A Bit Glitchy) :/
  29. treeamount = 30  --Number of Trees
  30. leavetrim = 0 --Shape Of Leaves(0=Sphere,1=Brick,2=Cylinder)    
  31. leavesize = 10 --Size of leaves                                                                                                                                                                                                                                              
  32. --                                                                                                                                                                                                    
  33. --                                                                                                                                                                                                  
  34. --------------------------------------                                                                               
  35. --Don't Mess with the Below--|                                                                             
  36. -------------------------------------------------------------------------------------------------------------------------------------------------------------
  37. local collect = Instance.new("Model")
  38. collect.Parent = game.Workspace
  39. collect.Name = "Terrain"
  40.  
  41. rock = "Dark stone grey"
  42. grass = {"Bright green","Bright green","Earth green"}
  43. sand = "Brick yellow"
  44.  
  45. local value = 0
  46. for i = 1,amount do -->Main function
  47. value = value +1
  48. print("Adding Terrain #"..value)
  49. local land = Instance.new("Part")
  50. land.Name = "Land "..value
  51. land.Parent = collect
  52. land.Anchored = true
  53. land.Shape = terrain
  54. land.Material = material
  55. e = math.random(size,maxsize)
  56. land.Size = Vector3.new(e,e,e)
  57. if autocolor == false then land.BrickColor = BrickColor.new(customcolor) end
  58. land.CFrame = CFrame.new(math.random(-width,width),math.random(0,height),math.random(-width,width))
  59. --land.CFrame = CFrame.new(math.random(-posX,posZ),math.random(-depth,height),math.random(-posX,posZ))
  60. land.CFrame = land.CFrame * CFrame.fromEulerAnglesXYZ(0,tilt,0)
  61. grasses = grass[math.random(1, #grass)]
  62. print("autocolor was set true! autocoloring...") --autocolor Responses below
  63. if autocolor == true and land.Position.y >= height/1.125 then land.BrickColor = BrickColor.new(rock) end
  64. if autocolor == true and land.Position.y >= height/4 and land.Position.y <= height/1.125 then land.BrickColor = BrickColor.new(grasses) end
  65. if autocolor == true and land.Position.y <= height/4 then land.BrickColor = BrickColor.new(sand) end
  66. wait()
  67. end
  68.            
  69. --extras v
  70.  
  71. local value2 = 0
  72. if trees == true then
  73. for t = 1,treeamount do --Who would of known the complications...of growing a Tree...
  74. value2 = value2 +1
  75. local tree = Instance.new("Model")
  76. tree.Parent = collect
  77. tree.Name = "Tree " ..value2
  78. local trunk = Instance.new("Part")
  79. trunk.Parent = tree
  80. trunk.Name = "Trunk"
  81. trunk.Material = "Wood"
  82. trunk.Anchored = true
  83. trunk.Size = Vector3.new(2,height +height*0.7,2)
  84. trunk.BrickColor = BrickColor.new("Reddish brown") --Hard To set CFrames for these
  85. trunk.CFrame = CFrame.new(math.random(-width,width),math.random(height/1.1,height +height*0.7),math.random(-width,width))
  86. local leaves = Instance.new("Part")
  87. leaves.Parent = tree
  88. leaves.Name = "Leaves"
  89. leaves.Material = "Ice" --Not Really Ice ._.
  90. leaves.Anchored = true
  91. leaves.Shape = leavetrim
  92. leaves.Size = Vector3.new(leavesize,leavesize,leavesize)
  93. leaves.BrickColor = BrickColor.new("Camo")
  94. leaves.CFrame = trunk.CFrame + Vector3.new(0,trunk.Size.y*0.5,0)
  95. wait()
  96. end
  97. end
  98.  
  99. if water == true then
  100. print("Ok to make Water")
  101. local water = Instance.new("Part")
  102. water.Name = "Water"
  103. water.Parent = collect
  104. water.Transparency = 0.5
  105. water.CanCollide = false
  106. water.Anchored = true
  107. water.TopSurface = "Smooth"
  108. water.BottomSurface = "Smooth"
  109. water.BrickColor = BrickColor.new("Bright blue")
  110. water.Size = Vector3.new(width*watersize,1,width*watersize)
  111. water.CFrame = CFrame.new(0,height/waterlevel,0) --Possible Glitches?
  112. end
  113.  
  114. print("Competed Terrain Generation")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement