• 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!

Solved For lua doubt

Shackal

Alien Project
Joined
Feb 7, 2009
Messages
211
Reaction score
17
Location
Brazil
Hello friends,

Why it don't work:
Code:
--
        local fromPos =   {x = 32312, y = 31933, z = 8}
        local toPos =     {x = 32316, y = 31936, z = 8}
        local x, y, z
        for x = fromPos.x, toPos.x do
            for y = fromPos.y, toPos.y do
                for z = fromPos.z, toPos.z do
                    Position(x, y, z):getTile():getItemById(355):transform(406)
                end
            end
        end

Thankss!!
 
Code:
        for z = fromPos.z, toPos.z do
            for x = fromPos.x, toPos.x do
                for y = fromPos.y, toPos.y do
                    local item = Position(x,y,z):getTile():getItemById(355)
                    if item then
                        item:transform(406)
                    end
                end
            end
        end
you want to put z first so it loops x/y positions per floor instead of z floors per x/y
edit: you also dont need local x, y, z since when you put a var name in a loop you can use it afterwards
 
Back
Top