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

Solved TFS 1.3 pick not working to open holes

betoxz

Member
Joined
Dec 16, 2007
Messages
139
Reaction score
10
Location
Mexico, Monterrey
Hello people, I cant make the pick work on my server, shovel and rope is working but pick does not...

in my action.xml I have this:

Lua:
    <action itemid="2553" script="tools/pick.lua" />

in my pick.lua I have this:
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    return onUsePick(player, item, fromPosition, target, toPosition, isHotkey)
end

and on actions.lua
Code:
local groundIds = {354, 355} -- pick usable ground

function onUsePick(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 11227 then -- shiny stone refining
        local chance = math.random(1, 100)
        if chance == 1 then
            player:addItem(ITEM_CRYSTAL_COIN) -- 1% chance of getting crystal coin
        elseif chance <= 6 then
            player:addItem(ITEM_GOLD_COIN) -- 5% chance of getting gold coin
        elseif chance <= 51 then
            player:addItem(ITEM_PLATINUM_COIN) -- 45% chance of getting platinum coin
        else
            player:addItem(2145) -- 49% chance of getting small diamond
        end
        player:addAchievementProgress("Petrologist", 100)
        target:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
        target:remove(1)
        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

    if table.contains(groundIds, ground.itemid) and ground.actionid == actionIds.pickHole then
        ground:transform(392)
        ground:decay()

        toPosition.z = toPosition.z + 1
        tile:relocateTo(toPosition)
    end

    return true
end


I am using the correct ground 354 and 355, but still nothing happens..
error.png

Does anyone knows what's wrong?

SOLVED: I HAD TO ASSIGN action id 105 to the ground to make it work.
 
Last edited:
Hello people, I cant make the pick work on my server, shovel and rope is working but pick does not...

in my action.xml I have this:

Lua:
    <action itemid="2553" script="tools/pick.lua" />

in my pick.lua I have this:
Code:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    return onUsePick(player, item, fromPosition, target, toPosition, isHotkey)
end

and on actions.lua
Code:
local groundIds = {354, 355} -- pick usable ground

function onUsePick(player, item, fromPosition, target, toPosition, isHotkey)
    if target.itemid == 11227 then -- shiny stone refining
        local chance = math.random(1, 100)
        if chance == 1 then
            player:addItem(ITEM_CRYSTAL_COIN) -- 1% chance of getting crystal coin
        elseif chance <= 6 then
            player:addItem(ITEM_GOLD_COIN) -- 5% chance of getting gold coin
        elseif chance <= 51 then
            player:addItem(ITEM_PLATINUM_COIN) -- 45% chance of getting platinum coin
        else
            player:addItem(2145) -- 49% chance of getting small diamond
        end
        player:addAchievementProgress("Petrologist", 100)
        target:getPosition():sendMagicEffect(CONST_ME_BLOCKHIT)
        target:remove(1)
        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

    if table.contains(groundIds, ground.itemid) and ground.actionid == actionIds.pickHole then
        ground:transform(392)
        ground:decay()

        toPosition.z = toPosition.z + 1
        tile:relocateTo(toPosition)
    end

    return true
end


I am using the correct ground 354 and 355, but still nothing happens..
View attachment 53292

Does anyone knows what's wrong?

SOLVED: I HAD TO ASSIGN action id 105 to the ground to make it work.
You need to put actionid 105 on the ground tile
 
Back
Top