How can I insert coordinates into a table, like this?
I want to insert coordinates (found with "canAddThing") into the table named raidPos, and then summon spiders on the inserted coordinates randomly.
I want to insert coordinates (found with "canAddThing") into the table named raidPos, and then summon spiders on the inserted coordinates randomly.
Code:
area1a = {x = 12011, y = 9152, z = 8}
area1b = {x = 12121, y = 9229, z = 8}
local raidPos = {}
for x = area1a.x, area1b.x do
for y = area1a.y, area1b.y do
for z = area1a.z, area1b.z do
if canAddThing({x = x, y = y, z = z}) then
table.insert(raidPos, {x = x, y = y, z = z})
end
end
end
end
doSummonCreature("Spider", raidPos[math.random(1,#raidPos)])
Last edited: