• 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 Destroy Field Rune Not Working Rep++

maskeeN

New Member
Joined
Dec 25, 2008
Messages
5
Reaction score
0
I dont know what's wrong, the rune is not working, its just poff when me and someone else use it... rep+
 
Use mine then?
Code:
local unremovable = {3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066}
local function isRemovable(v)
	return type(v) == "table" and v.uid > 65535 and v.actionid == 0 and isMoveable(v.uid) and not isInArray(unremovable, v.itemid) and not isCreature(v.uid) or false
end

local function findFirstRemovable(pos)
	while getThingfromPos(pos).uid > 0 do
		if isRemovable(getThingfromPos(pos)) then
			return pos.stackpos
		end
		pos.stackpos = pos.stackpos + 1
	end
end
local function doRemoveObject(cid, pos)
	pos.stackpos = 1
	local i, first = 0, getThingfromPos(pos)
	if not isRemovable(first) then
		local k = findFirstRemovable(pos)
		if type(k) == "number" then
			pos.stackpos = k
		end
	end
	while isRemovable(getThingfromPos(pos)) do
		doRemoveItem(getThingfromPos(pos).uid)
		i = i + 1
		if not isRemovable(getThingfromPos(pos)) then
			local k = findFirstRemovable(pos)
			if type(k) == "number" then
				pos.stackpos = k
			end
		end
	end

	if i > 0 then
		doSendMagicEffect(pos, CONST_ME_BLOCKHIT)
		return LUA_NO_ERROR
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	return LUA_ERROR
end

function onCastSpell(cid, var)
	local pos = variantToPosition(var)
	if(pos.x ~= 0 and pos.y ~= 0 and pos.z ~= 0 and not getTileInfo(pos).protection) then
		return doRemoveObject(cid, pos)
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	return LUA_ERROR
end
 
post the script here that is located

Server>Data>Spells>Scripts>and then within there find the Desrtoy Field .lua or whatever and post the script here.

local unremovable = {3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066}
local function isRemovable(v)
return type(v) == "table" and v.uid > 65535 and v.actionid == 0 and isMoveable(v.uid) and not isInArray(unremovable, v.itemid) and not isCreature(v.uid) or false
end

local function findFirstRemovable(pos)
while getThingfromPos(pos).uid > 0 do
if isRemovable(getThingfromPos(pos)) then
return pos.stackpos
end
pos.stackpos = pos.stackpos + 1
end
end
local function doRemoveObject(cid, pos)
pos.stackpos = 1
local i, first = 0, getThingfromPos(pos)
if not isRemovable(first) then
local k = findFirstRemovable(pos)
if type(k) == "number" then
pos.stackpos = k
end
end
while isRemovable(getThingfromPos(pos)) do
doRemoveItem(getThingfromPos(pos).uid)
i = i + 1
if not isRemovable(getThingfromPos(pos)) then
local k = findFirstRemovable(pos)
if type(k) == "number" then
pos.stackpos = k
end
end
end

if i > 0 then
doSendMagicEffect(pos, CONST_ME_BLOCKHIT)
return LUA_NO_ERROR
end

doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return LUA_ERROR
end

function onCastSpell(cid, var)
local pos = variantToPosition(var)
if(pos.x ~= 0 and pos.y ~= 0 and pos.z ~= 0 and not getTileInfo(pos).protection) then
return doRemoveObject(cid, pos)
end

doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
return LUA_ERROR
end
 
Use mine then?
Code:
local unremovable = {3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066}
local function isRemovable(v)
	return type(v) == "table" and v.uid > 65535 and v.actionid == 0 and isMoveable(v.uid) and not isInArray(unremovable, v.itemid) and not isCreature(v.uid) or false
end

local function findFirstRemovable(pos)
	while getThingfromPos(pos).uid > 0 do
		if isRemovable(getThingfromPos(pos)) then
			return pos.stackpos
		end
		pos.stackpos = pos.stackpos + 1
	end
end
local function doRemoveObject(cid, pos)
	pos.stackpos = 1
	local i, first = 0, getThingfromPos(pos)
	if not isRemovable(first) then
		local k = findFirstRemovable(pos)
		if type(k) == "number" then
			pos.stackpos = k
		end
	end
	while isRemovable(getThingfromPos(pos)) do
		doRemoveItem(getThingfromPos(pos).uid)
		i = i + 1
		if not isRemovable(getThingfromPos(pos)) then
			local k = findFirstRemovable(pos)
			if type(k) == "number" then
				pos.stackpos = k
			end
		end
	end

	if i > 0 then
		doSendMagicEffect(pos, CONST_ME_BLOCKHIT)
		return LUA_NO_ERROR
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	return LUA_ERROR
end

function onCastSpell(cid, var)
	local pos = variantToPosition(var)
	if(pos.x ~= 0 and pos.y ~= 0 and pos.z ~= 0 and not getTileInfo(pos).protection) then
		return doRemoveObject(cid, pos)
	end

	doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
	doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
	return LUA_ERROR
end



I do it, but i dont know why its not working :s
 
Oh sorry, my script is for desintegrating.

Try this:
Code:
local function doRemoveField(cid, pos)
	local field = getTileItemByType(pos, ITEM_TYPE_MAGICFIELD)
	if(field.itemid ~=0) 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
 
Oh sorry, my script is for desintegrating.

Try this:
Code:
local function doRemoveField(cid, pos)
	local field = getTileItemByType(pos, ITEM_TYPE_MAGICFIELD)
	if(field.itemid ~=0) 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

Thank You! :)
 
Back
Top