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

Creating items or using lever destroys the tile

Joriku

Working in the mines, need something?
Joined
Jul 16, 2016
Messages
1,076
Solutions
15
Reaction score
370
Location
Sweden
YouTube
Joriku
Hello,
How do you fix this?
If you create wrong item with /i command for example /i great mana pation, 100 it creates 100 items which you can't remove and if you use a lever this happens
07bb1469cb48e905a413701d053c498d.gif

66ca810b70d73199279b46b837b92b4a.gif
 
Last edited:
and because there is a limit of things you can put on top of 1 block
what is playing there, is so many many items or Sprits repeated in 1 single block, so of that.
is an anti-crash system
 
and because there is a limit of things you can put on top of 1 block
what is playing there, is so many many items or Sprits repeated in 1 single block, so of that.
is an anti-crash system
Allright, how do i disable it?
 
Soo, what is there to look for/edit in the source? i have no basic information about it :(
Check your create_item.lua script first (talkactions/scripts). Make sure that you can't spawn something that isn't a thing, using /i command.
If you're still able to do that then it's something messed up with source code.
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:split(",")

    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
 
Post your /i command 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, 1094
}

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:split(",")

    if(not split or not split[1]) then
        player:sendCancelMessage('Incorrect syntax use "/i itemName,quantity" OR "/i itemID,quantity".')
        return false
    end

    local itemType = ItemType(split[1])
    if itemType:getId() == 0 then
        itemType = ItemType(tonumber(split[1]))
        if 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 ~= nil 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 ~= nil 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
 
post the lever script you use
Theres alot of lever scripts, heres the one at rookgaard
Lua:
local config = {
    bridgePositions = {
        {position = Position(32099, 32205, 8), groundId = 9022, itemId = 4645},
        {position = Position(32100, 32205, 8), groundId = 4616},
        {position = Position(32101, 32205, 8), groundId = 9022, itemId = 4647}
    },
    leverPositions = {
        Position(32098, 32204, 8),
        Position(32104, 32204, 8)
    },
    relocatePosition = Position(32102, 32205, 8),
    relocateMonsterPosition = Position(32103, 32205, 8),
    bridgeId = 5770
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local leverLeft, lever = item.itemid == 1945
    for i = 1, #config.leverPositions do
        lever = Tile(config.leverPositions[i]):getItemById(leverLeft and 1945 or 1946)
        if lever then
            lever:transform(leverLeft and 1946 or 1945)
        end
    end

    local tile, tmpItem, bridge
    if leverLeft then
        for i = 1, #config.bridgePositions do
            bridge = config.bridgePositions[i]
            tile = Tile(bridge.position)

            tmpItem = tile:getGround()
            if tmpItem then
                tmpItem:transform(config.bridgeId)
            end

            if bridge.itemId then
                tmpItem = tile:getItemById(bridge.itemId)
                if tmpItem then
                    tmpItem:remove()
                end
            end
        end
    else
        for i = 1, #config.bridgePositions do
            bridge = config.bridgePositions[i]
            tile = Tile(bridge.position)

            tile:relocateTo(config.relocatePosition, true, config.relocateMonsterPosition)
            tile:getGround():transform(bridge.groundId)
            Game.createItem(bridge.itemId, 1, bridge.position)
        end

    end
    return true
end
 
Back
Top