tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 17 Jul 2016 10:29 AM |
how would i make the blocks generate like in epic mining 2 so when i break a block more blocks appear? so i wont have to load in a few million blocks when the scritpt reloads
|
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 17 Jul 2016 10:35 AM |
| Easy, when a block is mined you check the spaces around it and load more blocks if necessary. |
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 17 Jul 2016 10:47 AM |
but what if you mine into a cave it would just place blocks so you would never get into the cave
|
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 17 Jul 2016 10:51 AM |
| No? You would obviously check if it was already clear. |
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 18 Jul 2016 05:11 AM |
one last question, how would i check if there is a part(block) at position x,y,z?
|
|
|
| Report Abuse |
|
|
|
| 18 Jul 2016 05:19 AM |
| I belive there was a command FindOnRay thingy... btw hi there! |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2016 05:46 AM |
| You will figure it out after a lot more practice |
|
|
| Report Abuse |
|
|
| |
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 18 Jul 2016 09:27 AM |
oh i see, so i just shoot rays in all directions checking if there is a block there and if there is dont generate there?
|
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 18 Jul 2016 09:31 AM |
but how would i check if someone has already mined at position x,y,z?
|
|
|
| Report Abuse |
|
|
|
| 18 Jul 2016 09:57 AM |
if game.Workspace.Baseplate.Position.(X/Y/Z) [<>=<==>] [] then [] end -- like that
(you can use .Position on a "Part" and "Wedge") |
|
|
| Report Abuse |
|
|
| |
|
Tynezz
|
  |
| Joined: 28 Apr 2014 |
| Total Posts: 4945 |
|
|
| 18 Jul 2016 10:12 AM |
don't do these kind of projects until you go deeper into lua
anyways
function PartAtXYZ(x,y,z) for i,v in next,game.Workspace:GetChildren() do if v:IsA'BasePart' and v.Position=Vector3.new(x,y,z) then return v end end end |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2016 10:15 AM |
I would have just used three or four dimensional tables to do this, that way it's on a grid and you're not relying on getting the position with Vector3s.
|
|
|
| Report Abuse |
|
|
|
| 18 Jul 2016 10:31 AM |
@Jarod
that's what I did lol |
|
|
| Report Abuse |
|
|
|
| 18 Jul 2016 10:34 AM |
although it wasn't that optimal
going to remake it real quick. |
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 18 Jul 2016 11:09 AM |
thanks everyone!, i got it to work
|
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 19 Jul 2016 10:09 AM |
hrmmm, sometimes when i mine a block the y of the block becomes 1.52587890625e-005, always that same number everytime :P, i do not know why, it just keeps coming
|
|
|
| Report Abuse |
|
|
L2000
|
  |
| Joined: 03 Apr 2008 |
| Total Posts: 77448 |
|
|
| 19 Jul 2016 10:14 AM |
Why r u checking every part's position?
First like Jarod said you want this to be a grid, not position-based - otherwise you'll have those issues with people having already mined the block
Second if you do use Positions you don't have to check every Position because that's a built-in method of Workspace http://wiki.roblox.com/index.php?title=API:Class/Workspace/FindPartsInRegion3
https://www.youtube.com/watch?v=DelhLppPSxY |
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 19 Jul 2016 10:16 AM |
And when i check the block itself its y is 0
|
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 19 Jul 2016 10:17 AM |
that actually seems much much more efficient
|
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 19 Jul 2016 10:18 AM |
but i dont actually check every part, i store it in a table, i just get the blocks position and put it in the table
|
|
|
| Report Abuse |
|
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
| |
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
| |
|
tekkit
|
  |
| Joined: 18 Mar 2012 |
| Total Posts: 130 |
|
|
| 21 Jul 2016 06:25 AM |
Well i just just used math.floor(y + .5) and it works now :)
|
|
|
| Report Abuse |
|
|