• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua {Unsolved} Inserting coordinates into a table?

Cadyan

Well-Known Member
Joined
Mar 30, 2008
Messages
845
Reaction score
63
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.


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:
I want to insert AVAILABLE coordinates (canAddThing), and summon spiders on the inserted coordinates randomly.
 
The code below can replace the current doSummonCreature() to randomly summon spiders in the inserted positions.

for _, position in pairs(raidPos) do
if math.random(1, 10) >= 1 then -- 10%
doSummonCreature("Spider", position)
end
end
 
The code below can replace the current doSummonCreature() to randomly summon spiders in the inserted positions.

for _, position in pairs(raidPos) do
if math.random(1, 10) >= 1 then -- 10%
doSummonCreature("Spider", position)
end
end
My script already does that. You obviously don't understand what I am trying to ask - I want to know HOW TO INSERT coordinates into tables. Also.. if I am already doing it right then tell me lol
 
Last edited:
Back
Top