• 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 Destroy Field Rune

MxSoft

Leave Tibia, Live Life.
Joined
Dec 22, 2009
Messages
1,804
Solutions
1
Reaction score
43
Location
Mexico
Hi i got another error in console, is this one:
[URL=http://img713.imageshack.us/i/destroyfield.png/] Uploaded with ImageShack.us[/URL]
Code:
UNREMOVABLE_FIELDS = {1497, 1498, 1499, 1505, 1506, 1507, 1508, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 11094, 11095}

local function doRemoveField(cid, pos)
	local field = getTileItemByType(pos, ITEM_TYPE_MAGICFIELD)
	if(not isInArray(UNREMOVABLE_FIELDS, field.itemid)) then
		doRemoveItem(field.uid)
		doSendMagicEffect(pos, CONST_ME_POFF)
		return true
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	return false
end

function onCastSpell(cid, var)
	local pos = variantToPosition(var)
	if(pos.x == CONTAINER_POSITION) then
		pos = getThingPos(cid)
	end

	if(pos.x ~= 0 and pos.y ~= 0) then
		return doRemoveField(cid, pos)
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
	return false
end
 
I have not found or an error in your script, try using that to see if it's this mistake

UNREMOVABLE_FIELDS = {1497, 1498, 1505, 1506, 1507, 1508, 7465, 7466, 7467, 7468, 7469, 7470, 7471, 7472, 7473, 11094, 11095}

local function doRemoveField(cid, pos)
local field = getTileItemByType(pos, ITEM_TYPE_MAGICFIELD)
if(not isInArray(UNREMOVABLE_FIELDS, field.itemid)) then
doRemoveItem(field.uid)
doSendMagicEffect(pos, CONST_ME_POFF)
return true
end

doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return false
end

function onCastSpell(cid, var)
local pos = variantToPosition(var)
if(pos.x == CONTAINER_POSITION) then
pos = getThingPos(cid)
end

if(pos.x ~= 0 and pos.y ~= 0) then
return doRemoveField(cid, pos)
end

doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return false
end
 
Back
Top