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 » Scripters
Home Search
 

Re: "Regen cannot be empty" error?

Previous Thread :: Next Thread 
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 08:58 PM
I'm trying to change smooth terrain's material via a script like this

local TopCorner = game.Workspace:WaitForChild("TerrainTop")
local BottomCorner = game.Workspace:WaitForChild("TerrainBottom")
local region = Region3.new(Vector3.new(TopCorner.Position),Vector3.new(BottomCorner.Position))
local region = region:ExpandToGrid(4) local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, 4)
local size = material.Size
for x = 1, size.X do
for y = 1, size.Y do
for z = 1, size.Z do
material[x][y][z] = Enum.Material.Sand
end
end
end

game.Workspace.Terrain:WriteVoxels(region,4,material,occupancy)

The local region = line is defined, it was just too long for ROBLOX to put it all on one line. Anyway, I was told the region was like a box of your terrain, and it started at the top and bottom corners. Why is region empty if I told it where the corners are?

u sicko!
Report Abuse
Wreckerbuster67 is not online. Wreckerbuster67
Joined: 29 Jul 2012
Total Posts: 1144
25 Jun 2015 09:01 PM
Isn't Position already a Vector3? So you might be doing Vector3.new(Vector3)
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:01 PM
So then do Vector3.new(TopCorner) ?

u sicko!
Report Abuse
Wreckerbuster67 is not online. Wreckerbuster67
Joined: 29 Jul 2012
Total Posts: 1144
25 Jun 2015 09:05 PM
No, try Region3.new(TopCorner.Position, BottomCorner.Position)
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:06 PM
Doing it that way brings up the same error, so I don't think its that line.

u sicko!
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:07 PM
Sorry I was ninja'd, that worked. Now it says "Region has to be aligned to the grid (use Region3:ExpandToGrid)" What does that mean?

u sicko!
Report Abuse
Wreckerbuster67 is not online. Wreckerbuster67
Joined: 29 Jul 2012
Total Posts: 1144
25 Jun 2015 09:10 PM
mind moving the local material, occupancy variables down a line?
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:14 PM
Lol I didn't notice they were on different lines, my bad. It still isn't working though.

u sicko!
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:15 PM
And by different I mean the same line of course.

u sicko!
Report Abuse
Wreckerbuster67 is not online. Wreckerbuster67
Joined: 29 Jul 2012
Total Posts: 1144
25 Jun 2015 09:16 PM
Try

Region3.new(TopCorner.Position, BottomCorner.Position):ExpandToGrid(4)
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:17 PM
Regen cannot be empty error again.

u sicko!
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
25 Jun 2015 09:28 PM
If your trying to get terrain region, use Region3int16, not Region3
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:33 PM
21:32:38.497 - local TopCorner = game.Workspace:WaitForChild("TerrainTop"):3: bad argument #1 to 'new' (Vector3int16 expected, got userdata)

ROBLOX doesn't like people messing with their terrain.

u sicko!
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
25 Jun 2015 09:41 PM
Region3int16.new(Vector3int16.new(),Vector3int16.new())
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:42 PM
Would I use that like this?

Region3int16.new(Vector3int16.new(Position),Vector3int16.new(Position))

u sicko!
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
25 Jun 2015 09:44 PM
Region3int16.new(Vector3int16.new(x,y,z),Vector3int16.new(x,y,z))
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:47 PM
I'm getting really annoyed now.
21:47:23.798 - ExpandToGrid is not a valid member
Here is what I did:
local TopCorner = game.Workspace:WaitForChild("TerrainTop")
local BottomCorner = game.Workspace:WaitForChild("TerrainBottom")
local region = Region3int16.new(Vector3int16.new(TopCorner.Position),Vector3int16.new(BottomCorner.Position))
local region2 = region:ExpandToGrid(4)
local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, 4)
local size = material.Size
for x = 1, size.X do
for y = 1, size.Y do
for z = 1, size.Z do
material[x][y][z] = Enum.Material.Sand
end
end
end

game.Workspace.Terrain:WriteVoxels(region,4,material,occupancy)

u sicko!
Report Abuse
Wreckerbuster67 is not online. Wreckerbuster67
Joined: 29 Jul 2012
Total Posts: 1144
25 Jun 2015 09:48 PM
Use region2 in the last line maybe
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:50 PM
I still got the same error.

u sicko!
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
25 Jun 2015 09:55 PM
You're supposed to do
Vector3int16.new(position.X,position.Y,position.Z)
Your code gives you a new Vector3int16 of (0,0,0) no matter what..
Also, here are the functions available for Region3int16:

http://wiki.roblox.com/index.php?title=Region3int16
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 09:59 PM
Thanks so much for that wiki link. So something like this?

local region = Vector3int16.new(TopCorner.Position.X,TopCorner.Position.Y,TopCorner.Position.Z)

u sicko!
Report Abuse
Wreckerbuster67 is not online. Wreckerbuster67
Joined: 29 Jul 2012
Total Posts: 1144
25 Jun 2015 10:00 PM
local region = Region3.new(game.Workspace:WaitForChild("TerrainTop").Position, game.Workspace:WaitForChild("TerrainBottom").Position)
region:ExpandToGrid(4)
local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, 4)
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 10:02 PM
22:02:06.710 - Region has to be aligned to the grid (use Region3:ExpandToGrid)
I feel like there has to be something obvious here since I keep getting the same errors.

u sicko!
Report Abuse
KlinkStudios is not online. KlinkStudios
Joined: 31 Oct 2013
Total Posts: 563
25 Jun 2015 10:11 PM
qq

u sicko!
Report Abuse
cxcharlie is not online. cxcharlie
Joined: 26 Aug 2009
Total Posts: 1414
25 Jun 2015 10:11 PM
LOL

local TopCorner = game.Workspace:WaitForChild("TerrainTop")
local BottomCorner = game.Workspace:WaitForChild("TerrainBottom")
local region = Region3.new(Vector3.new(TopCorner.X,TopCorner.Y,TopCorner.Z),Vector3.new(BottomCorner.X,BottomCorner.Y,BottomCorner.Z))
local region = region:ExpandToGrid(4) local material, occupancy = game.Workspace.Terrain:ReadVoxels(region, 4)
local size = material.Size
for x = 1, size.X do
for y = 1, size.Y do
for z = 1, size.Z do
material[x][y][z] = Enum.Material.Sand
end
end
end

game.Workspace.Terrain:WriteVoxels(region,4,material,occupancy)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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