--Assume seed for 2 chunks is T4AC D2HG
--loop through seed, chunk1.type = Tree, Chunk ID = "T4AC"
--Save the seed, each time game loads you redo that loop,
-- [Tree or Deposit 1, 2] [Amount of Trees or Deposits, 1-8] [Three digit id] [3 digit arrange]
--15012464 [1 = ore] [5 deposits] [ore 012] [Arrangement of deposits 464]
-- 32 bit seed
-- 22222222222222222222222222222222
-- every other digit: even = tree, odd = deposits
-- loop through 2 digits at a time, gap 3, divide by 12, answer is amount of deposits
seed = (math.random() + 1) * 1e8
seed = seed - seed % 1
print(seed)
chunkMax = 100
seedString = seed .. ""
function charAt(String, index)
return string.sub(String, index, index)
end
function round(number, amnt)
return math.floor(number * (10 ^ amnt)) / (10 ^ amnt)
end
function math.clamp(val, min, max)
return math.max(min, math.min(max, val))
end
n = 0
m = 1
for i = 1, 3 do
n = n + 1
if (n > 50) then n = n-50 end
chunkType = (charAt(seedString, 2*i) % 2 == 0)
print(chunkType)
depositCount = (string.sub(seedString, m, m + 1) / 12)
depositCount = math.clamp(round(depositCount, 0), 1, 8)
m = m + 3
print(depositCount)
end
To embed this project on your website, copy the following code and paste it into your website's HTML: