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

[HELP] The Full of Ancients Helmet

Nottinghster

Tibia World RPG Developer
Joined
Oct 24, 2007
Messages
1,623
Solutions
6
Reaction score
539
Location
Brazil - Rio de Janeiro
GitHub
Nottinghster
Hello OTLanders!

I'm having a little problem... when I step on the tile, create the helmet but don't remove the pieces.
What I need to change on script?

Code:
local pos = {x=33198, y=32876, z=11, stackpos=2} 
function onStepIn(cid, item, position) 
    if isPlayer(cid) == TRUE then 
        local it = {} 
        for i = 2335, 2341 do 
            local _i = getTileItemById(pos, i).uid 
            if _i > 0 then it[i] = _i else return end 
        end 
        for _, v in ipairs(it) do		
            doRemoveItem(v) 
        end 
        doCreateItem(2342, 1, pos) 
        doSendMagicEffect(pos, CONST_ME_FIREAREA) 
    end 
end

Thanks!
 
You mean this will add helemt even if items not on tile

try that :
LUA:
local pos = {x=33198, y=32876, z=11, stackpos=2} 
local pieces = {2335, 2341}
function onStepIn(cid, item, position) 
    if isPlayer(cid) == TRUE then 
        local it = {} 
        for i = 1,#pieces do 
            local items = getTileItemById(pos, pieces[i]).uid 
            if items > 0 then
				table.insert(it,items)
			end
        end 
		if #it < #pieces then
			doPlayerSendCancel(cid,"Seem you dont have the two pieces.")
			it = {}
		else
			for _, v in ipairs(it) do		
				doRemoveItem(v) 
			end 
			doCreateItem(2342, 1, pos) 
			doSendMagicEffect(pos, CONST_ME_FIREAREA) 
			it={}
		end
	end
return true
end
 
Last edited:
LUA:
local pos = {x=33198, y=32876, z=11}
function onStepIn(cid, item, position)
	if isPlayer(cid) == TRUE then 
		local it = {} 
		for i = 2335, 2341 do 
			local _i = getTileItemById(pos, i).uid 
			if _i > 0 then table.insert(it, _i) else return end 
		end 
		for _, v in ipairs(it) do		
			doRemoveItem(v) 
		end 
		doCreateItem(2342, 1, pos) 
		doSendMagicEffect(pos, CONST_ME_FIREAREA) 
	end 
end
or (don't forget tileitem="1" in movements.xml)
LUA:
function onAddItem(moveItem, tileItem, position, cid)
	for i = 2335, 2341 do
		if moveItem.itemid ~= i and getTileItemById(position, i).uid < 1 then return end
	end
	for i = 2335, 2341 do
		local v = getTileItemById(position, i).uid
		doRemoveItem(v > 0 and v or moveItem.uid)
	end
	doCreateItem(2342, 1, position)
	doSendMagicEffect(position, CONST_ME_FIREAREA)
end
 
Last edited:
Back
Top