generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Terrain Script

Previous Thread :: Next Thread 
RadioactiveWafflez is not online. RadioactiveWafflez
Joined: 25 Jun 2010
Total Posts: 3453
08 May 2013 08:01 AM
for i = 1, 1000 do
p = Instance.new("Part")
p.Anchored = true
p.Position = Vector3.new(math.random(512,0), math.random(10,-10), math.random(100,-100))
p.Brickcolor = Brickcolor.random("Camo", "Bright green", "Dark green", "CGA brown", "Mid gray")
p.Size = Vector3.new(math.random(20, 10) , 20, math.random(20, 10))
wait(0.03) --0.02999999999999999 is minimum wait time, I believe.
end

It is supposed to generator a random 1000 block terrain.

1. Something is wrong in line 4
2. How would I add CFrame values?

Please help me? thanks
Report Abuse
ForceSky is not online. ForceSky
Joined: 30 Jul 2012
Total Posts: 2379
08 May 2013 08:08 AM
p.CFrame = CFrame.new(X, Y, Z)
Report Abuse
RadioactiveWafflez is not online. RadioactiveWafflez
Joined: 25 Jun 2010
Total Posts: 3453
08 May 2013 08:16 AM
Okay.

for i = 1, 1000 do
p = Instance.new("Part")
p.Anchored = true
p.Position = Vector3.new(math.random(512,0), math.random(10,-10), math.random(100,-100))
p.CFrame = CFrame.new(math.random(30, -30), math.random(30, -30), math.random(30, -30))
p.Brickcolor = Brickcolor.random("Camo", "Bright green", "Dark green", "CGA brown", "Mid gray")
p.Size = Vector3.new(math.random(20, 10) , 20, math.random(20, 10))
wait(0.03) --0.02999999999999999 is minimum wait time, I believe.
end

Okay, so, what is wrong with line 4 than, since the script will not run since something is apparently wrong with it...
Report Abuse
ForceSky is not online. ForceSky
Joined: 30 Jul 2012
Total Posts: 2379
08 May 2013 08:18 AM
I was thinking maybe you'd replace line 4 with my CFrame line. I'm not sure, however. Any output?
Report Abuse
RadioactiveWafflez is not online. RadioactiveWafflez
Joined: 25 Jun 2010
Total Posts: 3453
08 May 2013 08:26 AM
Okay, give me a minute
Report Abuse
RadioactiveWafflez is not online. RadioactiveWafflez
Joined: 25 Jun 2010
Total Posts: 3453
08 May 2013 08:28 AM
07:27:41.814 - Workspace.Script:4: bad argument #2 to 'random' (interval is empty)
Report Abuse
ForceSky is not online. ForceSky
Joined: 30 Jul 2012
Total Posts: 2379
08 May 2013 08:30 AM
Can you give me the script?
Report Abuse
RadioactiveWafflez is not online. RadioactiveWafflez
Joined: 25 Jun 2010
Total Posts: 3453
08 May 2013 08:34 AM
It's the script I posted.

Report Abuse
RadioactiveWafflez is not online. RadioactiveWafflez
Joined: 25 Jun 2010
Total Posts: 3453
08 May 2013 08:35 AM
Oh crap, I realized I just messed up...

I meant Angular CFrame, I should have said that.

Idiocy on my part.
Report Abuse
RadioactiveWafflez is not online. RadioactiveWafflez
Joined: 25 Jun 2010
Total Posts: 3453
08 May 2013 08:52 AM
for i = 1, 1000 do
p = Instance.new("Part")
p.Anchored = true
p.Position = Vector3.new(math.random(512,0), math.random(10,-10), math.random(100,-100))
p.CFrame = CFrame.Angles(math.random(30, -30), math.random(30, -30), math.random(30, -30))
p.Brickcolor = Brickcolor.random("Camo", "Bright green", "Dark green", "CGA brown", "Mid gray")
p.Size = Vector3.new(math.random(20, 10) , 20, math.random(20, 10))
wait(0.03) --0.02999999999999999 is minimum wait time, I believe.
end
Report Abuse
ForceSky is not online. ForceSky
Joined: 30 Jul 2012
Total Posts: 2379
08 May 2013 11:28 AM
Hm... I don't know.
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
08 May 2013 11:33 AM
number math.random(number lowerBound[, number upperBound])
The error you are getting is caused by having an upperBound that is smaller than lowerBound - it's illogical. Swap the order of the arguments.
Report Abuse
As8D is not online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
08 May 2013 11:35 AM
First of all...

you're doing stuff like:

math.random(100, 0)

100 is LARGER than 0. Therefore, no interval.

Also, try look up Perlin Noise or Diamondsquare generator in the Free Models.


- As, OH DAMN DINNER ! NOW UMGZ
Report Abuse
Dr01d3k4 is not online. Dr01d3k4
Joined: 11 Oct 2007
Total Posts: 17916
08 May 2013 11:36 AM
Oh and:
p.Position = Vector3.new(math.random(512,0), math.random(10,-10), math.random(100,-100))
p.CFrame = CFrame.Angles(math.random(30, -30), math.random(30, -30), math.random(30, -30))
p.Brickcolor = Brickcolor.random("Camo", "Bright green", "Dark green", "CGA brown", "Mid gray")

should be:
local rand = math.random;
local rad = math.rad;
p.CFrame = CFrame.new(rand(0, 512), rand(-10, 10), rand(-100, 100)) * CFrame.Angles(rad(rand(-30, 30)), rad(rand(-30, 30)), rad(rand(-30, 30)));
local colours = {"Camo", "Bright green", "Dark green", "CGA brown", "Mid gray"};
p.BrickColor = BrickColor.new(colours[rad(1, #colours)]);
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image