local holes = {468, 481, 483, 231, 482}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isInArray(holes, itemEx.itemid) == TRUE then
doTransformItem(itemEx.uid, itemEx.itemid + 1)
doDecayItem(itemEx.uid)
elseif itemEx.itemid == 231 then
local rand = math.random(1, 100)
if rand == 1 then
doCreateItem(2159, 1, toPosition)
elseif rand > 95 then
doSummonCreature("Scarab", toPosition)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
else
return FALSE
end
return TRUE
end
Doesn't work for me on tfs..i was looking around on different ot forums and i found a script for it, it was for evo but i fixed it a bit and now it works for TFS.
I used action id 1593 but you can change it to whatever you want.
But the problem with the holes not wanting to change back to sand is still there.PHP:local holes = {468, 481, 483} function onUse(cid, item, fromPosition, itemEx, toPosition) sandrand = math.random(1, 10) if itemEx.itemid == 0 then return 0 end if (itemEx.actionid >= 1593 and sandrand == 5) then if itemEx.itemid == 231 then doCreateItem(489, 1, toPosition) doSendMagicEffect(toPositions,2) doDecayItem(itemEx.uid) else doSendMagicEffect(toPosition,2) end return 1 end if isInArray(holes, itemEx.itemid) == TRUE then doTransformItem(itemEx.uid, itemEx.itemid + 1) doDecayItem(itemEx.uid) elseif itemEx.itemid == 231 then rand = math.random(1, 100) if rand > 95 then doSummonCreature("Scarab", toPosition) elseif rand == 1 then doCreateItem(2159, 1, toPosition) else doSendMagicEffect(toPosition,2) end else return 0 end return 1 end
local holes = {468, 481, 483}
function onUse(cid, item, fromPosition, itemEx, toPosition)
sandrand = math.random(1, 10)
if itemEx.itemid == 0 then
return 0
end
if (itemEx.actionid >= 1593 and sandrand == 5) then
if itemEx.itemid == 231 then
doCreateItem(489, 1, toPosition)
doSendMagicEffect(toPositions,2)
doDecayItem(itemEx.uid)
else
doSendMagicEffect(toPosition,2)
end
return 1
end
if isInArray(holes, itemEx.itemid) == TRUE then
doTransformItem(itemEx.uid, itemEx.itemid+1)
doDecayItem(itemEx.uid)
elseif itemEx.itemid == 231 then
rand = math.random(1, 100)
if rand > 95 then
doSummonCreature("Scarab", toPosition)
elseif rand == 1 then
doCreateItem(2159, 1, toPosition)
else
doSendMagicEffect(toPosition,2)
end
else
return 0
end
return 1
end
function decayItem(params)
local item = getThingfromPos(params.itempos)
local toitem = params.toitem
if toitem == nil or toitem == 0 then
doRemoveItem(item.uid,1)
else
doTransformItem(item.uid,toitem)
end
end
function doDecayItemTo(itempos, toitem, timer)
params = {itempos=itempos, toitem=toitem}
addEvent(decayItem, timer*1000, params)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local holes = {468, 481, 483}
aID = 1593 --Action Id the ground tile must have to turn into a hole.
ticks = 30 --How many seconds the hole will last before turning into a normal tile again
topos = {x=toPosition.x, y=toPosition.y, z=toPosition.z}
sandrand = math.random(1, 10)
if itemEx.itemid == 0 then
return 0
end
if (itemEx.actionid == aID and sandrand == 5) then
if itemEx.itemid == 231 then
doTransformItem(itemEx.uid,482)
doSendMagicEffect(toPosition,2)
doDecayItemTo(toPosition, itemEx.itemid, ticks)
else
doSendMagicEffect(toPosition,2)
end
return 1
end
if isInArray(holes, itemEx.itemid) == TRUE then
doTransformItem(itemEx.uid, itemEx.itemid+1)
doDecayItem(itemEx.uid)
elseif itemEx.itemid == 231 then
rand = math.random(1, 100)
if rand > 95 then
doSummonCreature("Scarab", toPosition)
elseif rand == 1 then
doCreateItem(2159, 1, toPosition)
else
doSendMagicEffect(toPosition,2)
end
else
return 0
end
return 1
end