Advertisement
refrop

mountains map *sound*

May 24th, 2018
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1.  
  2. --MADE BY refrop
  3. --Made by commag
  4.  
  5. local s = Instance.new("Sound")
  6.  
  7. s.Name = "Sound"
  8. s.SoundId = "http://www.roblox.com/asset/?id=169736440"
  9. s.Volume = 70
  10. s.Looped = false
  11. s.archivable = false
  12.  
  13. s.Parent = game.Workspace
  14.  
  15. wait(3)
  16.  
  17. s:play()
  18.  
  19. c = script:Clone()
  20. c.Parent = game.Lighting
  21. s = Instance.new("Sky")
  22. s.Name = "loltroll"
  23. s.SkyboxBk = "http://www.roblox.com/asset/?id=368385273"
  24. s.SkyboxDn = "http://www.roblox.com/asset/?id=48015300"
  25. s.SkyboxFt = "http://www.roblox.com/asset/?id=368388290"
  26. s.SkyboxLf = "http://www.roblox.com/asset/?id=368390615"
  27. s.SkyboxRt = "http://www.roblox.com/asset/?id=368385190"
  28. s.SkyboxUp = "http://www.roblox.com/asset/?id=48015387"
  29. s.Parent = game.Lighting
  30.  
  31.  
  32. wait(0.225555)
  33. t = game.Teams:GetChildren()
  34. for i = 1, #t do
  35. if t[i] == true then
  36. t[i].Name = math.random()
  37. end
  38. end
  39.  
  40. -- @CloneTrooper1019, 2015
  41.  
  42. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  43. -- CONFIGURATION:
  44. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  45.  
  46. baseHeight = 10
  47. -- ^ The main height factor for the terrain.
  48.  
  49. mountainHeight = 3
  50. -- ^ How tall should mountains be relative to the baseHeight of the terrain
  51.  
  52. mountainMaterialWeight = 0.8
  53. -- ^ The chance that a mountain terrain chunk will generate using slate rather than rock
  54. -- Should be a number between 0 and 1
  55. -- 0 = only rock, 1 = only slate, 0.5 = half n half
  56.  
  57. chunkScale = 3
  58. -- ^ The grid scale for terrain generation.
  59.  
  60. renderDist = 120
  61. -- ^ The length/width of chunks in voxels that should be around the player at all times
  62.  
  63. xScale = 22.5
  64. -- ^ How much we should strech the X scale of the generation noise
  65.  
  66. zScale = 22.5
  67. -- ^ How much we should strech the Z scale of the generation noise
  68.  
  69. waterLevel = -0.25
  70. -- ^ Determines if we should generate ponds if the height level goes below this
  71. -- Should be a number between -1 and 1
  72. -- -1 = no water, 0 = all grass levels are filled with water, 1 = The entire map is flooded with water (Except for tall mountains)
  73.  
  74. seed = math.random()
  75. -- ^ Seed for determining the height map of the terrain.
  76. -- By default its random.
  77.  
  78. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  79.  
  80. local chunks = {}
  81.  
  82. function chunkExists(chunkX,chunkZ)
  83. if not chunks[chunkX] then
  84. chunks[chunkX] = {}
  85. end
  86. return chunks[chunkX][chunkZ]
  87. end
  88.  
  89. function fillSmoothBlock(x,z,begY,endY,material)
  90. local location = CFrame.new(x*4+2, (begY+endY)*4/2, z*4+2)
  91. local fill = Vector3.new(4, (endY-begY)*4, 4)
  92. workspace.Terrain:FillBlock(location,fill,material)
  93. end
  94.  
  95. function mountLayer(x,heightY,z,material)
  96. -- Fill in Lakes/Ponds
  97. local waterFill = baseHeight * waterLevel
  98. if heightY < waterFill then
  99. material = Enum.Material.Sand -- Make the material sand.
  100. fillSmoothBlock(x,z,heightY-1,waterFill,Enum.Material.Water) -- Fill some water in.
  101. end
  102. -- Fill in the main terrain.
  103. fillSmoothBlock(x,z,-baseHeight,heightY,material)
  104. end
  105.  
  106. function makeChunk(chunkX,chunkZ)
  107. local rootPos = Vector3.new(chunkX*chunkScale,0,chunkZ*chunkScale)
  108. chunks[chunkX][chunkZ] = true -- Acknowledge the chunk's existance.
  109. for x = 0,chunkScale-1 do
  110. for z = 0,chunkScale-1 do
  111. local cx = (chunkX*chunkScale) + x
  112. local cz = (chunkZ*chunkScale) + z
  113. local noise = math.noise(seed,cx/xScale,cz/zScale)
  114. local isMountain = (noise > 0)
  115. local material,materialScale do
  116. if not isMountain then
  117. material = Enum.Material.Grass
  118. materialScale = 1
  119. else
  120. materialScale = mountainHeight
  121. if math.random() > mountainMaterialWeight then
  122. material = Enum.Material.Slate
  123. else
  124. material = Enum.Material.Rock
  125. end
  126. end
  127. end
  128. local cy = noise*baseHeight*materialScale
  129. mountLayer(cx,cy,cz,material)
  130. end
  131. end
  132. end
  133.  
  134. function doAreaFill(location)
  135. local chunkX,chunkZ = math.floor(location.X/4/chunkScale),math.floor(location.Z/4/chunkScale)
  136. local range = math.max(1,renderDist/chunkScale)
  137. for x = -range,range do
  138. for z = -range,range do
  139. local cx,cz = chunkX + x,chunkZ + z
  140. if not chunkExists(cx,cz) then
  141. makeChunk(cx,cz)
  142. end
  143. end
  144. end
  145. end
  146.  
  147. while true do
  148. for _,v in pairs(game.Players:GetPlayers()) do
  149. spawn(function ()
  150. local char = v.Character
  151. if char then
  152. local torso = char:findFirstChild("Torso")
  153. if torso then
  154. doAreaFill(torso.Position)
  155. end
  156. end
  157. end)
  158. end
  159. wait(1)
  160. end
  161.  
  162. ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement