• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Pick.lua!

Valdora

New Member
Joined
Jan 31, 2011
Messages
134
Reaction score
0
Hello everyone!

I'm using Avest SQL Engine, and I'm having a problem with the pick.

It is working like it should, but it doesn't close the holes afterwards!
(The hole won't close once it has been opened by pick)

THIS IS THE CURRENT NON-WORKING SCRIPT:

LUA:
function onUse(cid, item, frompos, item2, topos)

aID = 55555 --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=topos.x, y=topos.y, z=topos.z}
GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756}
DIRT = {351, 352, 353, 354, 355}
SNOW = {671, 6683, 6684, 6685, 6686, 7002}

if item2.actionid == aID then
	if isInArray(GRASS, item2.itemid) == 1 then
		doTransformItem(item2.uid,470)
		doDecayItemTo(topos, item2.itemid, ticks)
	elseif isInArray(DIRT, item2.itemid) == 1 then
		doTransformItem(item2.uid,383)
		doDecayItemTo(topos, item2.itemid, ticks)
	elseif item2.itemid == 231 then
		doTransformItem(item2.uid,482)
		doDecayItemTo(topos, item2.itemid, ticks)
	elseif isInArray(SNOW, item2.itemid) == 1 then
		doTransformItem(item2.uid,485)
		doDecayItemTo(topos, item2.itemid, ticks)
	else
		doCreateItem(3324, 1, topos)
		doDecayItemTo(topos, 0, ticks) 
	end
elseif item2.itemid == 7200 then
	doTransformItem(item2.uid,7236)
end
end

PHP:
Lua Script Error: [Action Interface]
data/actions/scripts/tools/pick.lua:onUse

data/actions/scripts/tools/pick.lua:16: attempt to call global 'doDecayItemTo' 
<a nil value>[
stack traceback:
data/actions/scripts/tools/pick.lua:16: in function data/actions/scripts/tools/pick.lua:1>

Anybody out there's able to help?

Thanks in advance.
 
Last edited:
try mine:D

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if((itemEx.uid <= 65535 or itemEx.actionid > 0) and isInArray({354, 355}, itemEx.itemid)) then
		doTransformItem(itemEx.uid, 392)
		doDecayItem(itemEx.uid)
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		return true
	end

	if(itemEx.itemid == 7200) then
		doTransformItem(itemEx.uid, 7236)
		doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		return true
	end

	return false
end
 
try mine:D

LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if((itemEx.uid <= 65535 or itemEx.actionid > 0) and isInArray({354, 355}, itemEx.itemid)) then
		doTransformItem(itemEx.uid, 392)
		doDecayItem(itemEx.uid)
		doSendMagicEffect(toPosition, CONST_ME_POFF)
		return true
	end

	if(itemEx.itemid == 7200) then
		doTransformItem(itemEx.uid, 7236)
		doSendMagicEffect(toPosition, CONST_ME_BLOCKHIT)
		return true
	end

	return false
end


Avesta and TFS have different coding types.
 
LUA:
function onUse(cid, item, frompos, item2, topos)

aID = 55555 --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=topos.x, y=topos.y, z=topos.z}
GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756}
DIRT = {351, 352, 353, 354, 355}
SNOW = {671, 6683, 6684, 6685, 6686, 7002}

if item2.actionid == aID then
	if isInArray(GRASS, item2.itemid) == 1 then
		doTransformItem(item2.uid,470)
		doDecayItemTo(topos, item2.itemid, ticks)
	elseif isInArray(DIRT, item2.itemid) == 1 then
		doTransformItem(item2.uid,383)
		doDecayItemTo(topos, item2.itemid, ticks)
	elseif item2.itemid == 231 then
		doTransformItem(item2.uid,482)
		doDecayItemTo(topos, item2.itemid, ticks)
	elseif isInArray(SNOW, item2.itemid) == 1 then
		doTransformItem(item2.uid,485)
		doDecayItemTo(topos, item2.itemid, ticks)
	else
		doCreateItem(3324, 1, topos)
		doDecayItemTo(topos, 0, ticks) 
	end
elseif item2.itemid == 7200 then
	doTransformItem(item2.uid,7236)
end
end

Help to close the hole please..
 
LUA:
function onUse(cid, item, frompos, item2, topos)
	if item2.actionid == 55555 then
		if (item2.itemid >= 4526 and item2.itemid <= 4541) or isInArray({4567, 4568, 4569, 4756}, item2.itemid) == TRUE then
			doTransformItem(item2.uid, 470)
			doDecayItem(item2.uid)
		elseif item2.itemid >= 351 and item2.itemid <= 355 then
			doTransformItem(item2.uid,383)
			doDecayItem(item2.uid)
		elseif item2.itemid == 231 then
			doTransformItem(item2.uid, 482)
			doDecayItem(item2.uid)
		elseif (item2.itemid >= 6683 and item2.itemid <= 6686) or isInArray({671, 7002}, item2.itemid) == TRUE then
			doTransformItem(item2.uid,485)
			doDecayItem(item2.uid)
		else
			doDecayItem(doCreateItem(3324, 1, {x=topos.x, y=topos.y, z=topos.z}))
		end
		return TRUE
	elseif item2.itemid == 7200 then
		doTransformItem(item2.uid, 7236)
		return TRUE
	end
end
 
Thanks I will try.

Edit: I tried in life ring quest in thais beholder and it didn't close the hole. Anything that could be changed? I don't get any errors either.
 
Back
Top