• 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!

[action] Pick doDecayItemTo

subyth

New Member
Joined
May 1, 2009
Messages
56
Reaction score
4
Hello! I have a pick script. It usually works, but if I use / reload action with the open hole, it does not close.

Code:
--Pick script using action ids by AGS or God Lord
local aID = 777 --Action Id the ground tile must have to turn into a hole.
local ticks = 30 --How many seconds the hole will last before turning into a normal tile again
local GRASS = {4526, 4527, 4528, 4529, 4530, 4531, 4532, 4533, 4534, 4535, 4536, 4537, 4538, 4529, 4540, 4541, 4567, 4568, 4569, 4756} --grass tiles it can be used on
local DIRT = {351, 352, 353, 354, 355} --dirt tiles it can be used on
local SNOW = {671, 6683, 6684, 6685, 6686, 7002} --snow tiles it can be used on

function onUse(cid, item, fromPosition, itemEx, toPosition)
local toPosition = {x=toPosition.x, y=toPosition.y, z=toPosition.z, stackpos=0} --do not edit this

if itemEx.actionid == aID then
if isInArray(GRASS, itemEx.itemid) then
doTransformItem(itemEx.uid,470)
doDecayItemTo(toPosition, itemEx.itemid, ticks)
elseif isInArray(DIRT, itemEx.itemid) then
doTransformItem(itemEx.uid,392)
doDecayItemTo(toPosition, itemEx.itemid, ticks)
elseif itemEx.itemid == 231 then
doTransformItem(itemEx.uid,482)
doDecayItemTo(toPosition, itemEx.itemid, ticks)
elseif isInArray(SNOW, itemEx.itemid) then
doTransformItem(itemEx.uid,485)
doDecayItemTo(toPosition, itemEx.itemid, ticks)
elseif itemEx.itemid == 7200 then
doTransformItem(itemEx.uid,7236)
end
end
return true
end

OBS: Where to pick up the script, create a file sent in LIB, really necessary?

Code:
function decayItem(itempos, toitem)
local item = getThingFromPos(itempos)
if (not toitem) or toitem == 0 then
doRemoveItem(item.uid,1)
else
doTransformItem(item.uid,toitem)
end
end

function doDecayItemTo(itempos, toitem, timer)
addEvent(decayItem, timer*1000, itempos, toitem)
return true
end

Thxx
 
it's not supposed to close when you reload action scripts
action scripts are only executed when you use something, reloading a script doesn't do anything for what's already been done
 
Why I have tested other pick scripts and none is working = /
It comes down to how /reload is meant to be used.

/reload anything

is meant for testing purposes. aka, when server is not up and online for everyone to use.
Yes, it's useful.
No, it's not meant to be used constantly, especially with timed events, which are run in that environment.

There is multiple "open holes" in items.xml
You could try changing some of these fake open holes, to actual working ones, then have the pick work with a specific AID..
Have the fake holes, have a "duration" which automatically decays them into normal dirt/mud.
Ensure that your script forces the decay feature to start counting, and you should be all set.
 
It comes down to how /reload is meant to be used.

/reload anything

is meant for testing purposes. aka, when server is not up and online for everyone to use.
Yes, it's useful.
No, it's not meant to be used constantly, especially with timed events, which are run in that environment.

There is multiple "open holes" in items.xml
You could try changing some of these fake open holes, to actual working ones, then have the pick work with a specific AID..
Have the fake holes, have a "duration" which automatically decays them into normal dirt/mud.
Ensure that your script forces the decay feature to start counting, and you should be all set.

Thxx! I will continue with this because my script works just will not use / reload. Indeed, with the open server can hurt.

Sorry inglish.
 
Back
Top