• 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 1.X+ Bug/problem open hole in sand if there is splash in the spot

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,990
Solutions
9
Reaction score
334
Location
Chile
Hello I have an issue an is the following

if the player want to open a hole in sand it's not possible if there's is a splash on spot where the hole should appear. so player have to wait till the splash dissapears in order to open the hole

how i can fix this?
Sin título.png
As you can see there's not problem at all. the problem appears when there's liquid in the floor spot, i get the the message you cannot use this object


Sin título1.png
 
Change your shovel script to check for the ground tile on the position the shovel is being used on, instead of the item the shovel is being used on.

Something like this?
Sorry, I'm rusty.
Lua:
local position = toPosition
if not position or position.x == CONTAINER_POSITION then
    return true
end

local tile = Tile(position)
if not tile then
    return true
end

local ground = tile:getGround()
if not ground then
    return true
end

-- now you can do regular shovel function
 
Last edited:
i added that part of code but does not work if there is liquid i still get the message " you can not use this object
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local position = toPosition
if not position or position.x == CONTAINER_POSITION then
    return true
end

local tile = Tile(position)
if not tile then
    return true
end

local ground = tile:getGround()
if not ground then
    return true
end
--code xikini end
    local tile = Tile(toPosition)
    if not tile then
        return false
    end
  
    if table.contains({468, 481, 483}, target.itemid) then
        target:transform(target.itemid + 1)
        target:decay()
    elseif target.itemid == 231 then
        local posSand = {
                fromPos = Position(33018, 32894, 7),
                toPos = Position(33306, 32530, 7)
        }
        local randomValue = math.random(1, 100)
        if target.actionid == 25001 and randomValue <= 25 then --ers 100kuego fue 25002
            target:transform(489)
            target:decay()
        elseif randomValue <= 3 and player:getPosition():isInRange(posSand.fromPos, posSand.toPos) then
            Game.createItem(2159, 1, toPosition)
        elseif randomValue > 95 and player:getPosition():isInRange(posSand.fromPos, posSand.toPos) then
            Game.createMonster("Scarab", toPosition)

        end
        toPosition:sendMagicEffect(CONST_ME_POFF)
    elseif target.itemid == 5581 then
        toPosition:sendMagicEffect(CONST_ME_POFF)
    else
        return false
    end

    return true
end

    for i = 1, #POOLS do
        local pool = getTileItemById(toPosition, POOLS[i]).uid
        if pool > 0 then
            doRemoveItem(pool,1)
        end
    end

    --doDecayItem(itemEx.uid)
    --return true
--end
this is my shovel.lua
and this is mi actions/lib/actions.lua shovel code with your code added in it
Code:
function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey)
        local position = toPosition
if not position or position.x == CONTAINER_POSITION then
    return true
end

local tile = Tile(position)
if not tile then
    return true
end

local ground = tile:getGround()
if not ground then
    return true
end

    local groundId = ground:getId()
    if table.contains(holes, groundId) then
        ground:transform(groundId + 1)
        ground:decay()

        toPosition.z = toPosition.z + 1
        tile:relocateTo(toPosition)
        player:addAchievementProgress("The Undertaker", 500)
    elseif target.itemid == 7932 then -- large hole
        target:transform(7933)
        target:decay()
        player:addAchievementProgress("The Undertaker", 500)
    elseif target.itemid == 20230 then -- swamp digging
        if (player:getStorageValue(PlayerStorageKeys.swampDigging)) <= os.time() then
            local chance = math.random(100)
            if chance >= 1 and chance <= 42 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You dug up a dead snake.")
                player:addItem(3077)
            elseif chance >= 43 and chance <= 79 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You dug up a small diamond.")
                player:addItem(2145)
            elseif chance >= 80 then
                player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You dug up a leech.")
                player:addItem(20138)
            end
            player:setStorageValue(PlayerStorageKeys.swampDigging, os.time() + 7 * 24 * 60 * 60)
            player:getPosition():sendMagicEffect(CONST_ME_GREEN_RINGS)
        end
    elseif table.contains(sandIds, groundId) then
        local randomValue = math.random(1, 100)
        if target.actionid == actionIds.sandHole and randomValue <= 20 then
            ground:transform(489)
            ground:decay()
        elseif randomValue == 1 then
            Game.createItem(2159, 1, toPosition)
            player:addAchievementProgress("Gold Digger", 100)
        elseif randomValue > 95 then
            Game.createMonster("Scarab", toPosition)
        end
        toPosition:sendMagicEffect(CONST_ME_POFF)
    else
        return false
    end

    return true
end

i get no erors in console
 
Have you ever stopped to think that if you put a script that ignores the liquid, there will be an open hole with liquid "flying over" an open hole, or people can open holes with firefields for example? n I think your thinking is right in doing this. but then you know

perhaps it would make more sense if the shovel removed the liquid from the floor as an extra function.
 
Have you ever stopped to think that if you put a script that ignores the liquid, there will be an open hole with liquid "flying over" an open hole, or people can open holes with firefields for example? n I think your thinking is right in doing this. but then you know

perhaps it would make more sense if the shovel removed the liquid from the floor as an extra function.
well im looking for it.
 
well im looking for it.
if im not wrong, the default script from nekiro downgrade works like that, no?

The problem is, you will open holes even player, field or something is in the spot different from old days

Lua:
local holes = {468, 481, 483}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = Tile(toPosition)
    if not tile then
        return false
    end

    local ground = tile:getGround()
    if not ground then
        return false
    end

    local groundId = ground:getId()
    if table.contains(holes, groundId) then
        ground:transform(groundId + 1)
        ground:decay()

        toPosition.z = toPosition.z + 1
        tile:relocateTo(toPosition)
    elseif groundId == 231 then
        local randomValue = math.random(1, 100)
        if randomValue == 1 then
            Game.createItem(2159, 1, toPosition)
        elseif randomValue > 95 then
            Game.createMonster("Scarab", toPosition)
        end
        toPosition:sendMagicEffect(CONST_ME_POFF)
    else
        return false
    end

    return true
end
 
Back
Top