• 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+ shovel action tfs 1.5 772

bpm91

Advanced OT User
Joined
May 23, 2019
Messages
1,021
Solutions
7
Reaction score
163
Location
Brazil
YouTube
caruniawikibr
Bug 1
Shovel using the shovel on creatures or even stones that are on top of the sand number 231
aaa.png

and 2
attempt to fix the poff in new id.
hello, I was trying to configure my shovel to "poff" the new id sand "area free" so that players could not scarab. however I am not able to make the synthase, however when trying this I discovered that I can use the shovel on top of anything on top of id 231 sand.
how do i block the shovel on creatures for example, and only work on top of sand 231.
and second: how do I make the shovel hit the sand at id 5581 but nothing happens. just the const me poff.
Actions: tools/shovel
LUA:
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 target.actionid == 100 and randomValue <= 20 then
            target:transform(489)
            target:decay()
        elseif randomValue < 3 then
            Game.createItem(2159, 1, toPosition)
        elseif randomValue > 90 then
            Game.createMonster("Scarab", toPosition)

        end
        toPosition:sendMagicEffect(CONST_ME_POFF)
    else
        return false
    end
    return true
end
Lib Actions shovel

local groundIds = {354, 355} -- pick usable ground
local sandIds = {231,5581} -- desert sand


LUA:
function onUseShovel(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 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)
        elseif randomValue > 95 then
            Game.createMonster("Scarab", toPosition)
        end
        toPosition:sendMagicEffect(CONST_ME_POFF)
    
    else
        return false
    end
    
    return true
end
 
Solution
@bpm91

remembering that in this script you can't use the shovel on top of anything, monster, player, items... it has to be on top of sand/stonepile, like old days

LUA:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    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 == 100 and randomValue <= 25 then...
@bpm91

remembering that in this script you can't use the shovel on top of anything, monster, player, items... it has to be on top of sand/stonepile, like old days

LUA:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    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 == 100 and randomValue <= 25 then
            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
 
Solution
Back
Top