• 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+ [TFS 1.5 / 7.72] cannot use object - transforms.lua

Erambo

New Member
Joined
Oct 5, 2022
Messages
2
Reaction score
0
Hello Otlanders,

Default datapack from Nekiro TFS 1.5 7.72 branch

Issue:
"You cannot use this object" - result when trying to use torch (itemId: 2050)

Desc:
There are some lack of id's in transform.lua I guess... Even that, when I've added id's for torch, it works but just to mid step, then the torch burned endlessly, probably I added id's in wrong way or something but more important for me is: it is really broken in default datapack for TFS 1.5 7.72 or I'm doing something wrong?

🙏 Additional newbie question:
If it is really broken, so does the default datapack contain more of these things? Appreciate for any additional info.

Best regards!



📓 transform.lua
Lua:
local transformItems = {
    [1479] = 1480, [1480] = 1479, -- street lamp
    [1634] = 1635, [1635] = 1634, -- table
    [1636] = 1637, [1637] = 1636, -- table
    [1638] = 1639, [1639] = 1638, -- table
    [1640] = 1641, [1641] = 1640, -- table
    [1786] = 1787, [1787] = 1786, -- oven
    [1788] = 1789, [1789] = 1788, -- oven
    [1790] = 1791, [1791] = 1790, -- oven
    [1792] = 1793, [1793] = 1792, -- oven
    [1945] = 1946, [1946] = 1945, -- lever
    [2037] = 2038, [2038] = 2037, -- wall lamp
    [2039] = 2040, [2040] = 2039, -- wall lamp
    [2058] = 2059, [2059] = 2058, -- torch bearer
    [2060] = 2061, [2061] = 2060, -- torch bearer
    [2064] = 2065, [2065] = 2064, -- table lamp
    [2066] = 2067, [2067] = 2066, -- wall lamp
    [2068] = 2069, [2069] = 2068, -- wall lamp
    [2096] = 2097, [2097] = 2096, -- pumpkinhead
    [2578] = 2579, -- trap
    [3697] = 3698, [3698] = 3697, -- sacred statue
    [3699] = 3700, [3700] = 3699, -- sacred statue
    [3743] = 4404, [4404] = 3743, -- bamboo lamp
    [3943] = 3944, [3944] = 3943, -- torch bearer
    [3945] = 3946, [3946] = 3945, -- torch bearer
    [3947] = 3948, [3948] = 3947, -- wall lamp
    [3949] = 3950, [3950] = 3949, -- wall lamp
}

local transformTo = Action()

function transformTo.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local transformIds = transformItems[item:getId()]
    if not transformIds then
        return false
    end

    item:transform(transformIds)
    return true
end

for i, v in pairs(transformItems) do
    transformTo:id(i)
end

transformTo:register()

📓part of items.xml
XML:
<item id="2050" article="a" name="torch">
        <attribute key="weight" value="500"/>
        <attribute key="stopduration" value="1"/>
    </item>
    <item id="2051" article="a" name="lit torch">
        <attribute key="weight" value="500"/>
        <attribute key="decayTo" value="2053"/>
        <attribute key="duration" value="600"/>
    </item>
    <item id="2052" article="a" name="torch">
        <attribute key="weight" value="450"/>
        <attribute key="stopduration" value="1"/>
    </item>
    <item id="2053" article="a" name="lit torch">
        <attribute key="weight" value="450"/>
        <attribute key="decayTo" value="2055"/>
        <attribute key="duration" value="300"/>
    </item>
    <item id="2054" article="a" name="torch">
        <attribute key="weight" value="400"/>
        <attribute key="stopduration" value="1"/>
    </item>
    <item id="2055" article="a" name="lit torch">
        <attribute key="weight" value="400"/>
        <attribute key="decayTo" value="2056"/>
        <attribute key="duration" value="300"/>
    </item>
    <item id="2056" article="a" name="burnt down torch">
        <attribute key="weight" value="350"/>
    </item>
 
instead of adding them to transform.lua you can create a new file in your scripts/action folder called decayTo.lua and paste this
Lua:
local decayItems = {
    [1873] = 1874, [1874] = 1873, -- cuckoo clock
    [1875] = 1876, [1876] = 1875, -- cuckoo clock
    [2041] = 2042, [2042] = 2041, -- candelabrum
    [2044] = 2045, [2045] = 2044, -- lamp
    [2047] = 2048, [2048] = 2047, -- candlestick
    [2050] = 2051, [2051] = 2050, -- torch
    [2052] = 2053, [2053] = 2052, -- torch
    [2054] = 2055, [2055] = 2054, -- torch
    [2162] = 2163, [2163] = 2162, -- magic light wand
}

local transformTo = Action()

function transformTo.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local transformIds = decayItems[item:getId()]
    if not transformIds then
        return false
    end

    item:transform(transformIds)
    item:decay()
    return true
end

for k, v in pairs(decayItems) do
    transformTo:id(k)
end

transformTo:register()
 
Thanks @emil92b - regarding to this issue, look at that commit:
https://github.com/nekiro/TFS-1.5-Downgrades/commit/bf87f945f64c61cbc6c90a8708ef71a001da4088

Is this a couse?
 
Back
Top