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

Fix script

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
Hi there, I have this script that search for an unique item on a tile... So if there are 2 items, it won't work...

This script is for 16 levels of POI, so if you put over the levers some gps, it won't work...

The idea is to make that it search all items on that tile and if it has the correct itemID then it should work:

LUA:
local wall1pos = {x=458, y=1386, z=11, stackpos=1}
local wall2pos = {x=459, y=1386, z=11, stackpos=1}
local leverpos1 = {x=450, y=1412, z=11, stackpos=1}
local leverpos2 = {x=454, y=1385, z=12, stackpos=1}
local leverpos3 = {x=493, y=1390, z=12, stackpos=1}
local leverpos4 = {x=460, y=1412, z=13, stackpos=1}
local leverpos5 = {x=457, y=1419, z=12, stackpos=1}
local leverpos6 = {x=467, y=1417, z=12, stackpos=1}
local leverpos7 = {x=481, y=1407, z=13, stackpos=1}
local leverpos8 = {x=481, y=1387, z=11, stackpos=1}
local leverpos9 = {x=498, y=1381, z=13, stackpos=1}
local leverpos10 = {x=450, y=1405, z=13, stackpos=1}
local leverpos11 = {x=496, y=1402, z=14, stackpos=1}
local leverpos12 = {x=494, y=1383, z=11, stackpos=1}
local leverpos13 = {x=453, y=1371, z=11, stackpos=1}
local leverpos14 = {x=494, y=1408, z=12, stackpos=1}

function onUse(cid, item, frompos, item2, topos)

local wall1 = getThingfromPos(wall1pos)
local wall2 = getThingfromPos(wall2pos)

local lever1 = getThingfromPos(leverpos1)
local lever2 = getThingfromPos(leverpos2)
local lever3 = getThingfromPos(leverpos3)
local lever4 = getThingfromPos(leverpos4)
local lever5 = getThingfromPos(leverpos5)
local lever6 = getThingfromPos(leverpos6)
local lever7 = getThingfromPos(leverpos7)
local lever8 = getThingfromPos(leverpos8)
local lever9 = getThingfromPos(leverpos9)
local lever10 = getThingfromPos(leverpos10)
local lever11 = getThingfromPos(leverpos11)
local lever12 = getThingfromPos(leverpos12)
local lever13 = getThingfromPos(leverpos13)
local lever14 = getThingfromPos(leverpos14)

if (lever1.itemid == 1946 and lever2.itemid == 1946 and lever3.itemid == 1946 and lever4.itemid == 1946 and lever5.itemid == 1946 and lever6.itemid == 1946 and lever7.itemid == 1946 and lever8.itemid == 1946 and lever9.itemid == 1946 and lever10.itemid == 1946 and lever11.itemid == 1946 and lever12.itemid == 1946 and lever13.itemid == 1946 and lever14.itemid == 1946 and wall1.itemid == 0) then
doSendMagicEffect(wall1pos, 13)
doSendMagicEffect(wall2pos, 13)
doCreateItem(1304,1,wall1pos)
doCreateItem(1304,1,wall2pos)
    doTransformItem(item.uid,1945)
elseif (lever1.itemid == 1946 and lever2.itemid == 1946 and lever3.itemid == 1946 and lever4.itemid == 1946 and lever5.itemid == 1946 and lever6.itemid == 1946 and lever7.itemid == 1946 and lever8.itemid == 1946 and lever9.itemid == 1946 and lever10.itemid == 1946 and lever11.itemid == 1946 and lever12.itemid == 1946 and lever13.itemid == 1946 and lever14.itemid == 1946 and wall1.itemid == 1304) then
doSendMagicEffect(wall1pos, 2)
doSendMagicEffect(wall2pos, 2)
doRemoveItem(wall1.uid,1)
doRemoveItem(wall2.uid,1)
    doTransformItem(item.uid,1946)
else 
doPlayerSendCancel(cid,"You have not pulled all 15 levers.") 
	end
   return 1
end
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for _, v in ipairs({{x=450, y=1412, z=11},{x=454, y=1385, z=12},{x=493, y=1390, z=12},{x=460, y=1412, z=13},{x=457, y=1419, z=12},{x=467, y=1417, z=12},{x=481, y=1407, z=13},{x=481, y=1387, z=11},{x=498, y=1381, z=13},{x=450, y=1405, z=13},{x=496, y=1402, z=14},{x=494, y=1383, z=11},{x=453, y=1371, z=11},{x=494, y=1408, z=12}}) do
		if getTileItemById(v, 1946).uid == 0 then
			return doPlayerSendCancel(cid, 'You haven\'t pulled all 15 levers.')
		end
	end
	for _, v in ipairs({{x=458, y=1386, z=11},{x=459, y=1386, z=11}}) do
		if item.itemid == 1945 then
			doSendMagicEffect(v, CONST_ME_EXPLOSIONAREA)
			doRemoveItem(getTileItemById(v, 1304).uid)
		else
			doRelocate(v, {x=457, y=1386, z=11})
			doCreateItem(1304, 1, v)
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
[3:10:42.192] [Error - LuaInterface::loadFile] data/actions/scripts/PitsOfInferno/16Levers2.lua:17: 'end' expected (to close 'function' at line 1) near '<eof>'
[3:10:42.192] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/PitsOfInferno/16Levers2.lua)
[3:10:42.192] data/actions/scripts/PitsOfInferno/16Levers2.lua:17: 'end' expected (to close 'function' at line 1) near '<eof>'

Error xD
Just missed and end on the copy, works fine, but I can't rep you it says: You must spread some Reputation around before giving it to Cykotitan again.
 
Last edited:
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	for _, v in ipairs({{x=450, y=1412, z=11},{x=454, y=1385, z=12},{x=493, y=1390, z=12},{x=460, y=1412, z=13},{x=457, y=1419, z=12},{x=467, y=1417, z=12},{x=481, y=1407, z=13},{x=481, y=1387, z=11},{x=498, y=1381, z=13},{x=450, y=1405, z=13},{x=496, y=1402, z=14},{x=494, y=1383, z=11},{x=453, y=1371, z=11},{x=494, y=1408, z=12}}) do
		if getTileItemById(v, 1946).uid == 0 then
			return doPlayerSendCancel(cid, 'You haven\'t pulled all 15 levers.')
		end
	end
	for _, v in ipairs({{x=458, y=1386, z=11},{x=459, y=1386, z=11}}) do
		if item.itemid == 1945 then
			doSendMagicEffect(v, CONST_ME_EXPLOSIONAREA)
			doRemoveItem(getTileItemById(v, 1304).uid)
		else
			doRelocate(v, {x=457, y=1386, z=11})
			doCreateItem(1304, 1, v)
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end

/mindblown
 
Back
Top