• 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

Intermediate OT User
Joined
Oct 11, 2009
Messages
1,397
Solutions
17
Reaction score
148
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...
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
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
 
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, item, fromPosition, itemEx, toPosition)
    if toPosition.x == 65535 then -- if the target of the shovel is in the player inventory..
        return true -- do nothing
    end
    
    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
 
Solution
Lua:
TOOLS.SHOVEL = function(cid, item, fromPosition, itemEx, toPosition)
    if toPosition.x == 65535 then -- if the target of the shovel is in the player inventory..
        return true -- do nothing
    end
   
    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
Works, thank you!
 
Back
Top