Gail Truth Man
Member
- Joined
- Oct 18, 2011
- Messages
- 611
- Reaction score
- 7
Hi guys,
I need a working desintegrate rune: (Desintegrate - TibiaWiki - Quests, Items, Spells, and more).
Right now the scripts works, yet it ALSO removes items from a distance. (which it shouldn't, you should only be able to use it when you stand next to it)
My script: [data/spells/lib/support/desintegrate_rune.lua]
I need a working desintegrate rune: (Desintegrate - TibiaWiki - Quests, Items, Spells, and more).
Right now the scripts works, yet it ALSO removes items from a distance. (which it shouldn't, you should only be able to use it when you stand next to it)
My script: [data/spells/lib/support/desintegrate_rune.lua]
Code:
local unremovable = {} -- itemids of human dead bodies.
local function doRemoveObject(cid, pos, rb)
local object = getThingfromPos(pos)
if(object.uid > 0 and
isCreature(object.uid) == FALSE and
isItemMoveable(object.itemid) == TRUE and
isInArray(unremovable, object.itemid) == FALSE) then
doRemoveItem(object.uid)
doRemoveObject(cid, pos, true)
return LUA_NO_ERROR
elseif(object.uid > 0) then
pos.stackpos = pos.stackpos + 1
return doRemoveObject(cid, pos, rb)
elseif(not rb) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return LUA_ERROR
end
end
function onCastSpell(cid, var)
local pos = variantToPosition(var)
if(pos.x ~= 0 and pos.y ~= 0 and pos.z ~= 0) then
pos.stackpos = 1
return doRemoveObject(cid, pos)
end
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return LUA_ERROR
end