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

C++ need script on shovel for Sand/holes... (bug)

Simonalina

Member
Joined
May 10, 2008
Messages
180
Solutions
1
Reaction score
15
Location
Sweden
When using Shovel on "7932" (large hole) ON Desert SAND...
Code:
20:53 You see a large hole.
It is loosely covered by some stones and earth.
Item ID: 7932


Lua:
local holes = {468, 481, 483, 7932, 23712} -- holes opened by shovel

it just makes "Poff" "Poff" "poff" (like using shovel in desert)

its like the shovel don't see the hole it just take the sand under it... anyone got any idea?
 
Solution
E
Lua:
function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 7932 then
        target:transform(7933)
        target:decay()
        return true
    end

    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)
        player:addAchievementProgress("The Undertaker", 500)
    elseif target.itemid == 20230 then -- swamp digging
        if...
Check your items.otb if you don't have Force Use ticked then do it and save then retry.
Maybe you can edit Stack order too so it reads the hole first not the sand I think so.
 
Check your items.otb if you don't have Force Use ticked then do it and save then retry.
Maybe you can edit Stack order too so it reads the hole first not the sand I think so.
Tried, nothing actually happend..

Tried "Stack order on TOP"

And force use.. No diffrent :/
 
Lua:
function onUseShovel(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 7932 then
        target:transform(7933)
        target:decay()
        return true
    end

    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)
        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
 
Last edited by a moderator:
Solution
yes that work! (Pretty cool just: if using shovel on Holes on "Sand" it will also dig for scarabs/scarab coins)

If you NOT wan't that (Thanks to @Evil Puncker)

Just add "
Lua:
    if target.itemid == 7932 then -- large hole
        target:transform(7933)
        target:decay()
            return true
 
Back
Top