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

cannot create items from id 30001 to 30100

Marko999x

999x era
Premium User
Joined
Dec 14, 2017
Messages
2,755
Solutions
80
Reaction score
1,893
Location
Germany
heyo
as the title says
I cannot create any item from 30001 to 30100
what im doing wrong?
im using tfs 1.3
thanks
 
Can you post your data/talkactions/scripts/create_item.lua
Lua:
local invalidIds = {
    1, 2, 3, 4, 5, 6, 7, 10, 11, 13, 14, 15, 19, 21, 26, 27, 28, 35, 43
}

function onSay(player, words, param)
    if not player:getGroup():getAccess() then
        return true
    end

    if player:getAccountType() < ACCOUNT_TYPE_GOD then
        return false
    end

    local split = param:splitTrimmed(",")

    local itemType = ItemType(split[1])
    if itemType:getId() == 0 then
        itemType = ItemType(tonumber(split[1]))
        if not tonumber(split[1]) or itemType:getId() == 0 then
            player:sendCancelMessage("There is no item with that id or name.")
            return false
        end
    end

    if table.contains(invalidIds, itemType:getId()) then
        return false
    end

    local count = tonumber(split[2])
    if count then
        if itemType:isStackable() then
            count = math.min(10000, math.max(1, count))
        elseif not itemType:isFluidContainer() then
            count = math.min(100, math.max(1, count))
        else
            count = math.max(0, count)
        end
    else
        if not itemType:isFluidContainer() then
            count = 1
        else
            count = 0
        end
    end

    local result = player:addItem(itemType:getId(), count)
    if result then
        if not itemType:isStackable() then
            if type(result) == "table" then
                for _, item in ipairs(result) do
                    item:decay()
                end
            else
                result:decay()
            end
        end
        player:getPosition():sendMagicEffect(CONST_ME_MAGIC_GREEN)
    end
    return false
end
 

Those IDs are reserved? Couldn’t tell you why, but these lines are the problem.

edit: I see they were/are reserved for fluids. You should be able to remove those lines and everything should work fine.
 
Last edited:

Those IDs are reserved? Couldn’t tell you why, but these lines are the problem.
I think that range was used for fluid types, here's an exempt from a 8.6 items.xml file (the ID's were probably just moved further up at some point)

XML:
    <item id="20001" name="water"/>
    <item id="20002" name="blood"/>
    <item id="20003" name="beer"/>
    <item id="20004" name="slime"/>
    <item id="20005" name="lemonade"/>
    <item id="20006" name="milk"/>
    <item id="20007" name="manafluid"/>
    <item id="20010" name="lifefluid"/>
    <item id="20011" name="oil"/>
    <item id="20013" name="urine"/>
    <item id="20014" name="coconut milk"/>
    <item id="20015" name="wine"/>
    <item id="20019" name="mud"/>
    <item id="20021" name="fruit juice"/>
    <item id="20026" name="lava"/>
    <item id="20027" name="rum"/>
    <item id="20028" name="swamp"/>
    <item id="20035" name="tea"/>
    <item id="20043" name="mead"/>
 
I think that range was used for fluid types, here's an exempt from a 8.6 items.xml file (the ID's were probably just moved further up at some point)

XML:
    <item id="20001" name="water"/>
    <item id="20002" name="blood"/>
    <item id="20003" name="beer"/>
    <item id="20004" name="slime"/>
    <item id="20005" name="lemonade"/>
    <item id="20006" name="milk"/>
    <item id="20007" name="manafluid"/>
    <item id="20010" name="lifefluid"/>
    <item id="20011" name="oil"/>
    <item id="20013" name="urine"/>
    <item id="20014" name="coconut milk"/>
    <item id="20015" name="wine"/>
    <item id="20019" name="mud"/>
    <item id="20021" name="fruit juice"/>
    <item id="20026" name="lava"/>
    <item id="20027" name="rum"/>
    <item id="20028" name="swamp"/>
    <item id="20035" name="tea"/>
    <item id="20043" name="mead"/>
Someone else pointed it out earlier in the thread, I just skipped over it. Though it’s probably a good idea to open a PR to remove those lines since the IDs were already changed.
 
Someone else pointed it out earlier in the thread, I just skipped over it.
Oh, same, didn't read it either :rolleyes: I just remembered there was a range for liquid types at one point

Though it’s probably a good idea to open a PR to remove those lines since the IDs were already changed.
 
Back
Top