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

TFS 0.X Loose Stone Pile - Bug with blood or another splash

potinho

Advanced OT User
Joined
Oct 11, 2009
Messages
1,403
Solutions
17
Reaction score
151
Location
Brazil
Good afternoon guys, how are you? I discovered a bug (at least I believe it is one): when I attack a monster or there is some liquid on top of the hole, I can't use a shovel on top, I have to wait for the liquid to disappear. Does anyone know how to fix this?

1654617179761.png
 
Solution
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.lua:eek:nUse
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.lua:eek:nUse
2022-07-04 15:07:05 - Description:
2022-07-04 15:07:05 - (luaGetThingFromPosition) Tile not found
Lua:
TOOLS.SHOVEL = function(cid...
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
 
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
the first solution seems like the best one, can u show me how to do this?
 
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
 
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
2022-06-07 15:43:14 - [Error - Test Interface]
2022-06-07 15:43:14 - data/actions/scripts/tools/shovel.lua
2022-06-07 15:43:14 - Description:
2022-06-07 15:43:14 - data/actions/scripts/tools/shovel.lua:4: attempt to index global 'toPosition' (a nil value)
2022-06-07 15:43:14 - [Error - Event::checkScript] Cannot load script (data/actions/scripts/tools/shovel.lua)
 
Look at your onUse function and change toPosition to your parameter names.

Probably topos, since your server is ancient.
I'd imagine that itemEx is going to have the same issue.
 
Look at your onUse function and change toPosition to your parameter names.

Probably topos, since your server is ancient.
I'd imagine that 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:

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
 
Why you doesnt post your shovel script here?
Sorry 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
already did, its this part

Lua:
function onUse(...)
    return TOOLS.SHOVEL(...)
end
 
That function is in data/actions/lib/actions.lua
thanks!

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!
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
 
I had not this problem, but i did make a wipe tool. To get away any liquid.

wipe.lua
Lua:
--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

Add at actions:
XML:
    <action itemid="18328" script="tools/wipe.lua" />
Of course you can use different item for it if you want.

EDIT, I just noticed its in 0.X tfs.
The script is made for 1.x (except 1.5 ofc)
 
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
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
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
 
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
Thanks @Xikini.

As I said above, sorry for being a noob, I didn't know how the structure worked properly. Now I'm getting to know a little more about my server. Anyway it worked, thanks a lot again!
 
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?

2022-07-03 17:05:57 - [Error - Action Interface]
2022-07-03 17:05:57 - data/actions/scripts/tools/shovel.lua:eek:nUse
2022-07-03 17:05:57 - Description:
2022-07-03 17:05:57 - (luaGetThingFromPosition) Tile not found
 
Last edited:
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.lua:eek:nUse
2022-07-03 17:05:57 - Description:
2022-07-03 17:05:57 - (luaGetThingFromPosition) Tile not found
Tell us what prints when you get this error.
Lua:
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
 
Back
Top