• 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+ Pick to stone and floor transform at POI

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,492
Solutions
27
Reaction score
858
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi again! I've found this very old script to transform the lava tiles of poi into walkable ground.
Lua:
--- Script by J.Dre and small edit by Knight God

local t = {
    {x = 1310, y = 811, z = 11, stackpos = 0}, ------1
    {x = 1310, y = 812, z = 11, stackpos = 0},  ------2
    {x = 1310, y = 813, z = 11, stackpos = 0}, ----10
    {x = 1311, y = 811, z = 11, stackpos = 0},
    {x = 1311, y = 812, z = 11, stackpos = 0},
    {x = 1311, y = 813, z = 11, stackpos = 0},     ---- 11
    {x = 1312, y = 808, z = 11, stackpos = 0},
    {x = 1312, y = 809, z = 11, stackpos = 0},
    {x = 1312, y = 810, z = 11, stackpos = 0},
    {x = 1312, y = 811, z = 11, stackpos = 0},
    {x = 1312, y = 812, z = 11, stackpos = 0}, -------- 12
    {x = 1313, y = 808, z = 11, stackpos = 0},
    {x = 1313, y = 809, z = 11, stackpos = 0},
    {x = 1313, y = 810, z = 11, stackpos = 0},
    {x = 1313, y = 811, z = 11, stackpos = 0},
    {x = 1313, y = 812, z = 11, stackpos = 0},
    {x = 1314, y = 807, z = 11, stackpos = 0},
    {x = 1314, y = 808, z = 11, stackpos = 0},
    {x = 1314, y = 809, z = 11, stackpos = 0},
    {x = 1314, y = 810, z = 11, stackpos = 0},
    {x = 1314, y = 811, z = 11, stackpos = 0},
    {x = 1314, y = 812, z = 11, stackpos = 0},
    {x = 1314, y = 813, z = 11, stackpos = 0},
    {x = 1315, y = 807, z = 11, stackpos = 0},
    {x = 1315, y = 808, z = 11, stackpos = 0},
    {x = 1315, y = 809, z = 11, stackpos = 0},
    {x = 1315, y = 810, z = 11, stackpos = 0},
    {x = 1315, y = 811, z = 11, stackpos = 0},
    {x = 1315, y = 812, z = 11, stackpos = 0},
    {x = 1315, y = 813, z = 11, stackpos = 0},
    {x = 1316, y = 807, z = 11, stackpos = 0},
    {x = 1316, y = 808, z = 11, stackpos = 0},
    {x = 1316, y = 809, z = 11, stackpos = 0},
    {x = 1316, y = 810, z = 11, stackpos = 0},
    {x = 1316, y = 811, z = 11, stackpos = 0},
    {x = 1316, y = 812, z = 11, stackpos = 0},
    {x = 1317, y = 807, z = 11, stackpos = 0},
    {x = 1317, y = 808, z = 11, stackpos = 0},
    {x = 1317, y = 809, z = 11, stackpos = 0},
    {x = 1318, y = 807, z = 11, stackpos = 0},
    {x = 1318, y = 808, z = 11, stackpos = 0},
    {x = 1318, y = 809, z = 11, stackpos = 0},
    {x = 1319, y = 807, z = 11, stackpos = 0},
    {x = 1319, y = 808, z = 11, stackpos = 0}, ------- 44
    {x = 1319, y = 809, z = 11, stackpos = 0}
}
 
    local effect = {
    [1] = {pos = {1310,811,11}, effect = {67}},
    [2] = {pos = {1310,812,11}, effect = {67}},
    [3] = {pos = {1310,813,11}, effect = {67}},
    [4] = {pos = {1311,811,11}, effect = {67}},
    [5] = {pos = {1311,812,11}, effect = {67}},
    [6] = {pos = {1311,813,11}, effect = {67}},
    [7] = {pos = {1312,808,11}, effect = {67}},
    [8] = {pos = {1312,809,11}, effect = {67}},
    [9] = {pos = {1312,810,11}, effect = {67}},
    [10] = {pos = {1312,811,11}, effect = {67}},
    [11] = {pos = {1312,812,11}, effect = {67}},
    [12] = {pos = {1313,808,11}, effect = {67}},
    [13] = {pos = {1313,809,11}, effect = {67}},
    [14] = {pos = {1313,810,11}, effect = {67}},
    [15] = {pos = {1313,811,11}, effect = {67}},
    [16] = {pos = {1313,812,11}, effect = {67}},
    [17] = {pos = {1314,807,11}, effect = {67}},
    [18] = {pos = {1314,808,11}, effect = {67}},
    [19] = {pos = {1314,809,11}, effect = {67}},
    [20] = {pos = {1314,810,11}, effect = {67}},
    [21] = {pos = {1314,811,11}, effect = {67}},
    [22] = {pos = {1314,812,11}, effect = {67}},
    [23] = {pos = {1314,813,11}, effect = {67}},
    [24] = {pos = {1315,807,11}, effect = {67}},
    [25] = {pos = {1315,808,11}, effect = {67}},
    [26] = {pos = {1315,809,11}, effect = {67}},
    [27] = {pos = {1315,810,11}, effect = {67}},
    [28] = {pos = {1315,811,11}, effect = {67}},
    [29] = {pos = {1315,812,11}, effect = {67}},
    [30] = {pos = {1315,813,11}, effect = {67}},
    [31] = {pos = {1316,807,11}, effect = {67}},
    [32] = {pos = {1316,808,11}, effect = {67}},
    [33] = {pos = {1316,809,11}, effect = {67}},
    [34] = {pos = {1316,810,11}, effect = {67}},
    [35] = {pos = {1316,811,11}, effect = {67}},
    [36] = {pos = {1316,812,11}, effect = {67}},
    [37] = {pos = {1317,807,11}, effect = {67}},
    [38] = {pos = {1317,808,11}, effect = {67}},
    [39] = {pos = {1317,809,11}, effect = {67}},
    [40] = {pos = {1318,807,11}, effect = {67}},
    [41] = {pos = {1318,808,11}, effect = {67}},
    [42] = {pos = {1318,809,11}, effect = {67}},
    [43] = {pos = {1319,807,11}, effect = {67}},
    [44] = {pos = {1319,808,11}, effect = {67}},
    [45] = {pos = {1319,809,11}, effect = {67}}
    }

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if(itemEx.uid == 1022 and itemEx.itemid == 1304) then
        for i = 1, #t do
            doCreateItem(5815, 1, t[i])
        end
        doTransformItem(itemEx.uid, 2256)
        doSendMagicEffect(toPosition, CONST_ME_SMOKE)
    end
    for _, area in pairs(effect) do
        doSendMagicEffect({x=area.pos[1],y=area.pos[2],z=area.pos[3]},area.effect[1])
    end
    return true
end

But it is not working as it should :(
This is what should happen, minute 4:15
poiscript.png

And this is what the script I attached to the thread does
poi_test.png

Is far from working, this is a 50/50 request and support thread, hope someone can help me with it :)
Thanks in advance, regards!
 
Solution
Modified the above script to be more compatible with TFS 1.3+
Mine is based purely on positions, instead of actionid, since that stone acts strangely when being targeted with crosshairs.
Fixed minor bug of smoke magic effect, since it was going beside the stone position, instead of on it.
disabled bat animation, since real tibia doesn't have that effect, I don't think.
Left it in, in case people wanted to enable it or not.

Also note, that this replaces the regular pick.lua script.
Lua:
local stonePosition = Position(1313, 808, 11)
local lava = {598, 599, 600, 601}
local area = {from = {1310, 807, 11}, to = {1319, 813, 11}}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = Tile(toPosition)...
Tried to advance a little with this, I code awfull but I think someone can get the point of the script :p
Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
if(itemEx.uid == 1022 and itemEx.itemid == 1304) then ----- check if item is stone (1304) and has unique id (1022)
doSendMagicEffect(toPosition, CONST_ME_SMOKE)  ------------------ change for newer function // effect when the rock is broken

local lava = Tile(bridgePosition):getItemById(598) ----- get lava item.id 598
if lava then
lava:transform(5815)          ----- transform into walkable floor 5815
addEvent(revertBridge, 10 * 60 * 1000)       ------- start event to revert

    item:transform(2256) --- transform rock into metal trash
    addEvent(revertLever, 10 * 60 * 1000, toPosition)
    return true ----- the metal trash must return to rock with uniqueID and transform lava back
end
 
Firstly, I noticed a strange thing. If there is an item under the stone, the script does not work. Try to remove borders or any other items from under the stone.

I made it for you in a better way(I think so), I don't wanna write these all positions manually.
All you need is to set 3 variables:
area.from - change to the left top corner position,
area.to - change to the right bottom corner position
lava - here lava id(if you use many types of lava)

1637874710324.png
gif:
xd.gif
script:
Lua:
local area = {
            from = {x=936, y=1004, z=7}, -- left top corner
            to = {x=944, y=1008, z=7} -- right bottom corner
            }
local lava={598, 599, 600, 601}

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if itemEx.uid == 1022 and itemEx.itemid == 1304 then
        for x = area.from.x, area.to.x do
            for y = area.from.y, area.to.y do
                if isInArray(lava, getThingfromPos({x=x , y=y, z=area.from.z, stackpos = 0}).itemid) then
                    doSendMagicEffect({x=x, y=y, z=area.from.z},67)   
                    doTransformItem(getThingfromPos({x=x , y=y, z=area.from.z, stackpos = 0}).uid, 5815)                   
                end
            end
        end
   doTransformItem(itemEx.uid, 2256)
   doSendMagicEffect(toPosition, CONST_ME_SMOKE)
    end
return true
end
 
Modified the above script to be more compatible with TFS 1.3+
Mine is based purely on positions, instead of actionid, since that stone acts strangely when being targeted with crosshairs.
Fixed minor bug of smoke magic effect, since it was going beside the stone position, instead of on it.
disabled bat animation, since real tibia doesn't have that effect, I don't think.
Left it in, in case people wanted to enable it or not.

Also note, that this replaces the regular pick.lua script.
Lua:
local stonePosition = Position(1313, 808, 11)
local lava = {598, 599, 600, 601}
local area = {from = {1310, 807, 11}, to = {1319, 813, 11}}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local tile = Tile(toPosition)
    if tile then
        if toPosition == stonePosition and tile:getTopVisibleThing():getId() == 1304 then
            for x = area.from[1], area.to[1] do
                for y = area.from[2], area.to[2] do
                    local position = Position(x, y, area.from[3])
                    local ground = Tile(position):getGround()
                    if table.contains(lava, ground:getId()) then
                        --position:sendMagicEffect(CONST_ME_BATS)
                        ground:transform(5815)                  
                    end
                end
            end
            tile:getTopVisibleThing():transform(2256)
            Position(toPosition.x, toPosition.y + 1, toPosition.z):sendMagicEffect(CONST_ME_SMOKE)
            return true
        end
    end
    return onUsePick(player, item, fromPosition, target, toPosition, isHotkey)
end
 
Solution
Thanks a lot @jestem pro your script help us a lot when we start writing the solution with @Xikini.

I couldn't make the script work when I passed it into the server, but we did some prints on it and chat a bit to make everything work. I am very happy with the outcome, it works perfectly!! Again, thank you both!! Your help is always appreciated a lot c:

Regards!!
 
Back
Top