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

MoveEvent [Events][TFS 1.X] Runes backpack Medivia-styled

@Diarreamental
This topic is little outdated because its from 2018, but I had fixed version of this script:

Lua:
    -- Rune emblem system :: backpacks only for certain runes //
    if toPosition.x == CONTAINER_POSITION then
        local niceContainer = nil
        if toCylinder:isCreature() then
            local target = self:getSlotItem(toPosition.y)
            if target then
                niceContainer = NICE_CONTAINERS_SET[target:getId()]
            end
        else
            local target = toCylinder:getItem(toPosition.z)
            if target and target:isContainer() then
                niceContainer = NICE_CONTAINERS_SET[target:getId()]
            else
                niceContainer = NICE_CONTAINERS_SET[toCylinder:getId()]
            end
        end

        if niceContainer then
            local fit = false
            if type(niceContainer) == 'table' then
                if isInArray(niceContainer, item:getId()) then
                    fit = true
                end
            elseif item:getId() == niceContainer then
                fit = true
            end

            if not fit then
                self:sendTextMessage(MESSAGE_STATUS_SMALL, "You may carry only specific items in this backpack.")
                return false
            end
        end
    end
    -- // Rune emblem system

Try this and let me know if it's working properly now :)
Thanks you a lot bro I'll test it I. A while and I'll let you know how it goes, thanks you
 
@Diarreamental
This topic is little outdated because its from 2018, but I had fixed version of this script
Try this and let me know if it's working properly now :)
i still with issues
Code:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua
data/events/scripts/player.lua:130: attempt to index global 'toPosition' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/events/scripts/player.lua:130: in main chunk
[Warning - Events::load] Can not load script: player.lua

if toPosition.x == CONTAINER_POSITION then <<LINE 130

Lua:
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
    if(toPosition.x == 0xFFFF) then
        if(toPosition.y >= 64) then
            local container = self:getContainerById(toPosition.y-64)
            if(container) then
                local backpack = backpacks[container:getId()]
                if(backpack and not(isInArray(backpack, item:getId()))) then
                    self:sendTextMessage(MESSAGE_STATUS_SMALL, "You may carry only runes of specific type in this backpack, nothing else.")
                    return false
                else
                    local slot = toPosition.z
                    if(slot < container:getSize()) then
                        local c = container:getItem(slot)
                        if(c and c:isContainer()) then
                            backpack = backpacks[c:getId()]
                            if(backpack and not(isInArray(backpack, item:getId()))) then
                                self:sendTextMessage(MESSAGE_STATUS_SMALL, "You may carry only runes of specific type in this backpack, nothing else.")
                                return false
                            end
                        end
                    end
                end
            end
        else
            local container = self:getSlotItem(toPosition.y)
            if(container) then
                local backpack = backpacks[container:getId()]
                if(backpack and not(isInArray(backpack, item:getId()))) then
                    self:sendTextMessage(MESSAGE_STATUS_SMALL, "You may carry only runes of specific type in this backpack, nothing else.")
                    return false
                end
            end
        end
    end
    return true
end
-- Rune emblem system :: backpacks only for certain runes
    local runy = {
        {backpack = 5322, runes = 3174}, -- LMM
        {backpack = 5320, runes = 3198}, -- Heavy Magic Missile
        {backpack = 5321, runes = 3152}, -- Intense Healing Rune
        {backpack = 5319, runes = 2304}, -- Great Fireball
        {backpack = 5326, runes = 3160}, -- Ultimate Healing Rune
        {backpack = 5318, runes = 3200}, -- Explosion
        {backpack = 5324, runes = 3180}, -- Magic Wall
        {backpack = 5325, runes = 3155}, -- Sudden Death Rune

    }

    -- Rune emblem system :: backpacks only for certain runes //
    if toPosition.x == CONTAINER_POSITION then  <<LINE 130
        local niceContainer = nil
        if toCylinder:isCreature() then
            local target = self:getSlotItem(toPosition.y)
            if target then
                niceContainer = NICE_CONTAINERS_SET[target:getId()]
            end
        else
            local target = toCylinder:getItem(toPosition.z)
            if target and target:isContainer() then
                niceContainer = NICE_CONTAINERS_SET[target:getId()]
            else
                niceContainer = NICE_CONTAINERS_SET[toCylinder:getId()]
            end
        end

        if niceContainer then
            local fit = false
            if type(niceContainer) == 'table' then
                if isInArray(niceContainer, item:getId()) then
                    fit = true
                end
            elseif item:getId() == niceContainer then
                fit = true
            end

            if not fit then
                self:sendTextMessage(MESSAGE_STATUS_SMALL, "You may carry only specific items in this backpack.")
                return false
            end
        end
    end
    -- // Rune emblem system
 
Back
Top