You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want a random combination of chunk with weighted chance with math.Randomseed in which if the chunk position is the same and the seed is the same,Its gonna give the same result
-
What is the issue? WIth me adding the chunk posx and z then minus with the seed i get some stripe,Even with no weighted chance it occur,
-
**What solutions have you tried so far?**Ive tryed using another formula but i need it to be the same in the same seed and not repetitive,And also with Weighted chance
weighed chance stuff
local function getchance(tablestuff)
local weight = 0
for _,Chance in pairs(tablestuff) do
weight += Chance.Chance.Value
end
local randomn = math.random(1,weight)
weight = 0
for prize,Chance in pairs(tablestuff) do
weight += Chance.Chance.Value
if weight >= randomn then
return Chance
end
end
end
Seed for each chunk
---Seed detemainer
math.randomseed(chunkPosX*Chunk.WIDTH_SIZE_X+chunkPosZ*Chunk.WIDTH_SIZE_Z+seed)