my best guess at this point is that first line outside the script
Code: Select all
local firstrock = trueam i on the right track with this or is it something else ive done
Code: Select all
local firstrock = true
script.on_event(defines.events.on_chunk_generated, function(event)
local SelectedRock = math.random(1,15)
--log(serpent.block(event))
local tx = event.area.left_top.x
local ty = event.area.left_top.y
local bx = event.area.right_bottom.x
local by = event.area.right_bottom.y
local Randx = math.random(tx,bx)
local Randy = math.random(ty,by)
local tiles = {}
local x = Randx - 5
local y = Randy - 5
local a=0
local b=0
local RandChance
if firstrock == true then
SelectedRock = 1
RandChance = math.random(0,40)
else
RandChance = math.random(0,480)
end
if RandChance == 5 then
for i = 0,121 do
table.insert(tiles,{name="grass-1", position={x,y}})
x = x+1
a=a+1
if a==11 then
x=Randx-5
y=y+1
b=b+1
a=0
if b==11 then
y=Randy-5
b=0
end
end
end
game.surfaces["nauvis"].set_tiles(tiles)
game.surfaces["nauvis"].create_entity{name=Rocks[SelectedRock],position={Randx,Randy},amount=math.random(1000000,15000000)}
if firstrock == true then
firstrock = false
end
end
end)
