2022-07-04 15:07:04 - -----
2022-07-04 15:07:04 - 65535
2022-07-04 15:07:04 - 64
2022-07-04 15:07:04 - 0
2022-07-04 15:07:04 -
2022-07-04 15:07:04 - [Error - Action Interface]
2022-07-04 15:07:04 - data/actions/scripts/tools/shovel.luanUse
2022-07-04 15:07:04 - Description:
2022-07-04 15:07:04 - (luaGetThingFromPosition) Tile not found
2022-07-04 15:07:05 - -----
2022-07-04 15:07:05 - 65535
2022-07-04 15:07:05 - 64
2022-07-04 15:07:05 - 0
2022-07-04 15:07:05 -
2022-07-04 15:07:05 - [Error - Action Interface]
2022-07-04 15:07:05 - data/actions/scripts/tools/shovel.luanUse
2022-07-04 15:07:05 - Description:
2022-07-04 15:07:05 - (luaGetThingFromPosition) Tile not found
TOOLS.SHOVEL = function(cid...
the first solution seems like the best one, can u show me how to do this?yes.
loop through the position use stackpos and see if any of the items match the hole, then do regular function
Or, call it a feature and teach the players to bring a liquid carrying container with them to scoop up the blood off the floor
local shovelable_holes = {111, 222, 333} -- this already exists.. idk what it's named
for i = 0, 255 do
local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i}
local target = getThingFromPos(check_pos)
if target.itemid <= 0 then
break
elseif isInArray(shovelable_holes, target.itemid) then
itemEx = target
break
end
end
-- then do normal functions
2022-06-07 15:43:14 - [Error - Test Interface]Something like this
Lua:local shovelable_holes = {111, 222, 333} -- this already exists.. idk what it's named for i = 0, 255 do local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i} local target = getThingFromPos(check_pos) if target.itemid <= 0 then break elseif isInArray(shovelable_holes, target.itemid) then itemEx = target break end end -- then do normal functions
onUse
function and change toPosition
to your parameter names.topos
, since your server is ancient.itemEx
is going to have the same issue.Sorry for beeing a noob, but not understand what i have to change or do, follow my shovel script with this modification:Look at youronUse
function and changetoPosition
to your parameter names.
Probablytopos
, since your server is ancient.
I'd imagine thatitemEx
is going to have the same issue.
local shovelable_holes = {111, 222, 333} -- this already exists.. idk what it's named
for i = 0, 255 do
local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i}
local target = getThingFromPos(check_pos)
if target.itemid <= 0 then
break
elseif isInArray(shovelable_holes, target.itemid) then
itemEx = target
break
end
end
-- then do normal functions
function onUse(...)
return TOOLS.SHOVEL(...)
end
Why you doesnt post your shovel script here?
Why you doesnt post your shovel script here?
already did, its this partSorry for beeing a noob, but not understand what i have to change or do, follow my shovel script with this modification:
Lua:local shovelable_holes = {111, 222, 333} -- this already exists.. idk what it's named for i = 0, 255 do local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i} local target = getThingFromPos(check_pos) if target.itemid <= 0 then break elseif isInArray(shovelable_holes, target.itemid) then itemEx = target break end end -- then do normal functions function onUse(...) return TOOLS.SHOVEL(...) end
function onUse(...)
return TOOLS.SHOVEL(...)
end
That function is in data/actions/lib/actions.luaalready did, its this part
Lua:function onUse(...) return TOOLS.SHOVEL(...) end
thanks!That function is in data/actions/lib/actions.lua
TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition)
if(isInArray(HOLES, itemEx.itemid)) then
local newId = itemEx.itemid + 1
if(itemEx.itemid == 8579) then
newId = 8585
end
doTransformItem(itemEx.uid, newId)
doDecayItem(itemEx.uid)
elseif(isInArray(SAND, itemEx.itemid)) then
local rand = math.random(1, 100)
local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND})
if(isInArray(SPOTS, ground.itemid) and rand <= 20) then
doTransformItem(itemEx.uid, 489)
doDecayItem(itemEx.uid)
elseif(rand >= 1 and rand <= 5) then
doCreateItem(2159, 1, toPosition)
elseif(rand > 85) then
doCreateMonster("Scarab", toPosition, false)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
return true
end
as @Alberto Cabrera said, open data/actions/lib/actions.lua and search for the ROPE SCRIPT, copy and paste here!already did, its this part
Lua:function onUse(...) return TOOLS.SHOVEL(...) end
hereas @Alberto Cabrera said, open data/actions/lib/actions.lua and search for the ROPE SCRIPT, copy and paste here!
TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition)
if(isInArray(HOLES, itemEx.itemid)) then
local newId = itemEx.itemid + 1
if(itemEx.itemid == 8579) then
newId = 8585
end
doTransformItem(itemEx.uid, newId)
doDecayItem(itemEx.uid)
elseif(isInArray(SAND, itemEx.itemid)) then
local rand = math.random(1, 100)
local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND})
if(isInArray(SPOTS, ground.itemid) and rand <= 20) then
doTransformItem(itemEx.uid, 489)
doDecayItem(itemEx.uid)
elseif(rand >= 1 and rand <= 5) then
doCreateItem(2159, 1, toPosition)
elseif(rand > 85) then
doCreateMonster("Scarab", toPosition, false)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
return true
end
--18328
local ids = {
[2016] = true,
[2017] = true,
[2018] = true,
[2019] = true,
[2020] = true,
[2021] = true,
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if ids[target:getId()] then
target:remove()
player:say('There, spotlessly clean!', TALKTYPE_MONSTER_SAY)
else
player:say('You can not clean this!', TALKTYPE_MONSTER_SAY)
end
return true
end
<action itemid="18328" script="tools/wipe.lua" />
Something like this
Lua:local shovelable_holes = {111, 222, 333} -- this already exists.. idk what it's named for i = 0, 255 do local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i} local target = getThingFromPos(check_pos) if target.itemid <= 0 then break elseif isInArray(shovelable_holes, target.itemid) then itemEx = target break end end -- then do normal functions
Answer is already in your thread.here
Lua:TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition) if(isInArray(HOLES, itemEx.itemid)) then local newId = itemEx.itemid + 1 if(itemEx.itemid == 8579) then newId = 8585 end doTransformItem(itemEx.uid, newId) doDecayItem(itemEx.uid) elseif(isInArray(SAND, itemEx.itemid)) then local rand = math.random(1, 100) local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND}) if(isInArray(SPOTS, ground.itemid) and rand <= 20) then doTransformItem(itemEx.uid, 489) doDecayItem(itemEx.uid) elseif(rand >= 1 and rand <= 5) then doCreateItem(2159, 1, toPosition) elseif(rand > 85) then doCreateMonster("Scarab", toPosition, false) end doSendMagicEffect(toPosition, CONST_ME_POFF) end return true end
TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition)
for i = 0, 255 do
local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i}
local target = getThingFromPos(check_pos)
if target.itemid <= 0 then
break
elseif isInArray(HOLES, target.itemid) then
itemEx = target
break
end
end
if(isInArray(HOLES, itemEx.itemid)) then
local newId = itemEx.itemid + 1
if(itemEx.itemid == 8579) then
newId = 8585
end
doTransformItem(itemEx.uid, newId)
doDecayItem(itemEx.uid)
elseif(isInArray(SAND, itemEx.itemid)) then
local rand = math.random(1, 100)
local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND})
if(isInArray(SPOTS, ground.itemid) and rand <= 20) then
doTransformItem(itemEx.uid, 489)
doDecayItem(itemEx.uid)
elseif(rand >= 1 and rand <= 5) then
doCreateItem(2159, 1, toPosition)
elseif(rand > 85) then
doCreateMonster("Scarab", toPosition, false)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
return true
end
Thanks @Xikini.Answer is already in your thread.
Why are you still bumping?
Lua:TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition) for i = 0, 255 do local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i} local target = getThingFromPos(check_pos) if target.itemid <= 0 then break elseif isInArray(HOLES, target.itemid) then itemEx = target break end end if(isInArray(HOLES, itemEx.itemid)) then local newId = itemEx.itemid + 1 if(itemEx.itemid == 8579) then newId = 8585 end doTransformItem(itemEx.uid, newId) doDecayItem(itemEx.uid) elseif(isInArray(SAND, itemEx.itemid)) then local rand = math.random(1, 100) local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND}) if(isInArray(SPOTS, ground.itemid) and rand <= 20) then doTransformItem(itemEx.uid, 489) doDecayItem(itemEx.uid) elseif(rand >= 1 and rand <= 5) then doCreateItem(2159, 1, toPosition) elseif(rand > 85) then doCreateMonster("Scarab", toPosition, false) end doSendMagicEffect(toPosition, CONST_ME_POFF) end return true end
Giving this error when player use on equip or backpack item, how to supress this?Answer is already in your thread.
Why are you still bumping?
Lua:TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition) for i = 0, 255 do local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i} local target = getThingFromPos(check_pos) if target.itemid <= 0 then break elseif isInArray(HOLES, target.itemid) then itemEx = target break end end if(isInArray(HOLES, itemEx.itemid)) then local newId = itemEx.itemid + 1 if(itemEx.itemid == 8579) then newId = 8585 end doTransformItem(itemEx.uid, newId) doDecayItem(itemEx.uid) elseif(isInArray(SAND, itemEx.itemid)) then local rand = math.random(1, 100) local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND}) if(isInArray(SPOTS, ground.itemid) and rand <= 20) then doTransformItem(itemEx.uid, 489) doDecayItem(itemEx.uid) elseif(rand >= 1 and rand <= 5) then doCreateItem(2159, 1, toPosition) elseif(rand > 85) then doCreateMonster("Scarab", toPosition, false) end doSendMagicEffect(toPosition, CONST_ME_POFF) end return true end
Tell us what prints when you get this error.Giving this error when player use on equip or backpack item, how to supress this?
2022-07-03 17:05:57 - [Error - Action Interface]
2022-07-03 17:05:57 - data/actions/scripts/tools/shovel.luanUse
2022-07-03 17:05:57 - Description:
2022-07-03 17:05:57 - (luaGetThingFromPosition) Tile not found
TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition)
print("-----")
print(toPosition.x, toPosition.y, toPosition.z)
for i = 0, 255 do
local check_pos = {x = toPosition.x, y = toPosition.y, z = toPosition.z, stackpos = i}
local target = getThingFromPos(check_pos)
if target.itemid <= 0 then
break
elseif isInArray(HOLES, target.itemid) then
itemEx = target
break
end
end
if(isInArray(HOLES, itemEx.itemid)) then
local newId = itemEx.itemid + 1
if(itemEx.itemid == 8579) then
newId = 8585
end
doTransformItem(itemEx.uid, newId)
doDecayItem(itemEx.uid)
elseif(isInArray(SAND, itemEx.itemid)) then
local rand = math.random(1, 100)
local ground = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_GROUND})
if(isInArray(SPOTS, ground.itemid) and rand <= 20) then
doTransformItem(itemEx.uid, 489)
doDecayItem(itemEx.uid)
elseif(rand >= 1 and rand <= 5) then
doCreateItem(2159, 1, toPosition)
elseif(rand > 85) then
doCreateMonster("Scarab", toPosition, false)
end
doSendMagicEffect(toPosition, CONST_ME_POFF)
end
return true
end