• 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 Specific item on specific location removes 4 stones.

auda

Advanced OT User
Joined
Jun 29, 2014
Messages
273
Reaction score
233
Location
Sweden
Hi!
A script I'm working on to have at a specific place is a puzzle where you need to move two certain items (statues) to two specific locations in order to remove 4 stones. How do I add so that the stones will be removed if both statues are on the exact position they are supposed to be, and if one or both are removed the stones will reappear. Thanks!

Code:
local statue1pos = {x=1154, y=1102, z=11, stackpos=1}
local statue2pos = {x=1145, y=1106, z=11, stackpos=1}

local stone1pos = {x=1148, y=1110, z=11, stackpos=1}
local stone2pos = {x=1149, y=1110, z=11, stackpos=1}
local stone3pos = {x=1150, y=1110, z=11, stackpos=1}
local stone4pos = {x=1151, y=1110, z=11, stackpos=1}

function onUse(cid, item, fromPos, item2, toPos)
    if item.itemid == 1442 and item.itemid == 1477 then
        doRemoveItem(getThingfromPos(stone1pos, stone2pos, stone3pos, stone4pos).uid)
    else
        doCreateItem(1304, 1, stone1pos)
        doCreateItem(1304, 1, stone2pos)
        doCreateItem(1304, 1, stone3pos)
        doCreateItem(1304, 1, stone4pos)
                               
    end
end

Is this maybe a OnAddItem function in movements?
 
Maybe something like this could work:

Code:
local c = {
   [1] = {x=1154, y=1102, z=11, stackpos=1},
   [2] = {x=1145, y=1106, z=11, stackpos=1},
   --
   [3] = {x=1148, y=1110, z=11, stackpos=1},
   [4] = {x=1149, y=1110, z=11, stackpos=1},
   [5] = {x=1150, y=1110, z=11, stackpos=1},
   [6] = {x=1151, y=1110, z=11, stackpos=1}
}

function onAddItem(tileitem, moveitem, pos)
   if getThingfromPos(c[1]).itemid == 1442 then
     if getThingfromPos(c[2]).itemid == 1477 then
       for i = 3,6 do
         doRemoveItem(getThingfromPos(c[i]).uid, 1)
       end
     end
   end
end
 
Back
Top