• 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+ getItemID --> item in pos

roriscrave

Advanced OT User
Joined
Dec 7, 2011
Messages
1,188
Solutions
34
Reaction score
200
how can i check Item ID that is in the pos?
i'm using tfs 1.3.

there is an item on the floor (1000, 1000, 7), where I don't know your ID
I need a code that will move this item from the pos (1000, 1000, 7) to the pos (1005, 1000, 7)
 
Last edited:
Solution
E
I think I expressed it wrong, there is an item on the floor (1000, 1000, 7), where I don't know your ID,
I need a code that will move this item to the pos (1005, 1000, 7)
Lua:
function doRelocate(fromPos, toPos)
    if fromPos == toPos then
        return false
    end

    local fromTile = Tile(fromPos)
    if fromTile == nil then
        return false
    end

    if Tile(toPos) == nil then
        return false
    end

    for i = fromTile:getThingCount() - 1, 0, -1 do
        local thing = fromTile:getThing(i)
        if thing then
            if thing:isItem() then
                if ItemType(thing:getId()):isMovable() then
                    thing:moveTo(toPos)
                end
            elseif thing:isCreature() then...

Lua:
function getTileItemById(position, itemId, ...)
    local t = Tile(position)
    if t == nil then
        return pushThing(nil)
    end
    return pushThing(t:getItemById(itemId, ...))
end
I think I expressed it wrong, there is an item on the floor (1000, 1000, 7), where I don't know your ID,
I need a code that will move this item to the pos (1005, 1000, 7)
 
I think I expressed it wrong, there is an item on the floor (1000, 1000, 7), where I don't know your ID,
I need a code that will move this item to the pos (1005, 1000, 7)
Lua:
function doRelocate(fromPos, toPos)
    if fromPos == toPos then
        return false
    end

    local fromTile = Tile(fromPos)
    if fromTile == nil then
        return false
    end

    if Tile(toPos) == nil then
        return false
    end

    for i = fromTile:getThingCount() - 1, 0, -1 do
        local thing = fromTile:getThing(i)
        if thing then
            if thing:isItem() then
                if ItemType(thing:getId()):isMovable() then
                    thing:moveTo(toPos)
                end
            elseif thing:isCreature() then
                thing:teleportTo(toPos)
            end
        end
    end
    return true
end
 
Solution
Back
Top