• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua TFS 1.2 - System.lua on actions - Not working

Allesn

Member
Joined
May 4, 2011
Messages
204
Solutions
1
Reaction score
24
Hello, I have a problem with my actions.

I put an actionID and uniqueID in a chest using remeres, so for that to be a quest, however, the item comes up repeatedly and always exits the message: "You have found a item, but you have no room ..." and the storage isn't set on player.

Thats my system.lua:
LUA:
local specialQuests = {
    [2215] = 2215, -- Annihilator
    [40000] = 40000,
    [40001] = 40001,
    [40002] = 40002,
    [26300] = 26300,
    [26400] = 26400,
    [26500] = 26500,
    [27300] = 27300,
    [27400] = 27400,
    [27500] = 27500,
    [28300] = 28300,
    [28400] = 28400,
    [28500] = 28500,
    [40003] = 40003,
    [40004] = 40004,
    [40005] = 40005,
    [40006] = 40006,
    [40007] = 40007,
    [40008] = 40008,
    [40009] = 40009,
    [40010] = 40010,
    [40011] = 40011,
    [40012] = 40012,
    [40013] = 40013,
    [40014] = 40014,
    [40015] = 40015,
    [40016] = 40016,
    [40017] = 40017,
    [40018] = 40018,
    [40019] = 40019,
    [40020] = 40020,
    [40021] = 40021,
    [40022] = 40022,
    [40023] = 40023,
    [40024] = 40024,
    [40025] = 40025,
    [40026] = 40026,
    [40027] = 40027,
    [40028] = 40028,
    [40029] = 40029,
    [40030] = 40030,
    [40031] = 40031,
    [40032] = 40032,
    [40033] = 40033,
    [40034] = 40034,
    [40035] = 40035,
    [40036] = 40036,
    [40037] = 40037,
    [40038] = 40038,
    [40039] = 40039,
    [40040] = 40040,
    [40041] = 40041,
    [40042] = 40042,
    [40043] = 40043,
    [40044] = 40044,
    [40045] = 40045,
    [40046] = 40046,
    [40047] = 40047,
    [40048] = 40048,
    [40049] = 40049,
    [40050] = 40050,
    [40051] = 40051,
    [40052] = 40052,
    [40053] = 40053,
    [40054] = 40054,
    [40055] = 40055,
    [40056] = 40056,
    [40057] = 40057,
    [40058] = 40058,
    [40059] = 40059,
    [40060] = 40060,
    [40061] = 40061,
    [40062] = 40062,
    [40063] = 40063,
    [40064] = 40064,
    [40065] = 40065,
    [40066] = 40066,
    [40067] = 40067,
    [40068] = 40068,
    [40069] = 40069,
    [40070] = 40070,
    [40071] = 40071,
    [40072] = 40072,
    [40073] = 40073,
    [40074] = 40074,
    [40075] = 40075,
    [40076] = 40076,
    [40077] = 40077,
    [40078] = 40078,
    [40079] = 40079,
    [40080] = 40080,
    [40081] = 40081,
    [40082] = 40082,
    [40083] = 40083,
    [40084] = 40084,
    [40085] = 40085,
    [40086] = 40086, --frizenarena1
    [40087] = 40087, --frizenarena1
    [40088] = 40088, --frizenarena1
    [40089] = 40089, --frizenarena2
    [40090] = 40090, --frizenarena2
    [40091] = 40091, --frizenarena2
    [40092] = 40092, --frizenarena3
    [40093] = 40093, --frizenarena3
    [40094] = 40094, --frizenarena3
}

local questsExperience = {
    [2215] = 100000, --anni
    [40000] = 50000, --dhq
    [40001] = 50000, --dhq
    [40002] = 50000, --dhq
    [26300] = 5000, --frizen arena
    [26400] = 1000, --frizen arena
    [26500] = 1000, --frizen arena
    [27300] = 20000, --frizen arena
    [27400] = 5000, --frizen arena
    [27500] = 5000, --frizen arena
    [28300] = 50000, --frizen arena
    [28400] = 10000, --frizen arena
    [28500] = 10000, --frizen arena
    [40003] = 5000, --bohcapitlif
    [40004] = 15000, --wrl
    [40005] = 15000, --wrl
    [40006] = 1000, --elf fort
    [40007] = 1000, --ef
    [40008] = 1000, --ef
    [40009] = 3000, --necro
    [40010] = 3000, --necro
    [40011] = 7500, --dls
    [40012] = 7500, --dls
    [40013] = 3500, --orc fort
    [40014] = 3500, --of
    [40015] = 3500, --of
    [40016] = 4000, --necroquest
    [40017] = 4000, --necro
    [40018] = 4000, --necro
    [40019] = 3000, --simonstaff
    [40020] = 5000, --coral comb
    [40021] = 500, --rotwormbonelordshield
    [40022] = 2000,
    [40023] = 1000, -- cyclopskarmia
    [40024] = 250, --amazon
    [40025] = 250, --amazon
    [40026] = 250, --amazon
    [40027] = 300, --amazon
    [40028] = 200, --swamptrolls
    [40029] = 2500, --desert
    [40030] = 2500, --desert
    [40031] = 10000, --bansheefinal
    [40032] = 10000, --bansheefinal
    [40033] = 10000, --bansheefinal
    [40034] = 10000, --bansheefinal
    [40035] = 15000, --behequest
    [40036] = 15000, --behequest
    [40037] = 15000, --behequest
    [40038] = 15000, --behequest
    [40039] = 5000, --gscrushelmet
    [40040] = 1500, --minopoh
    [40041] = 1500, --minopoh
    [40042] = 1500, --behoslugmyn
    [40043] = 1500, --behoslugmyn
    [40044] = 7500, --dwarfhell
    [40045] = 7500, --dwarfhell
    [40046] = 7500, --dwarfhell
    [40047] = 0, --inq1witches
    [40048] = 1000, --holyPOH
    [40049] = 7000, --deepithilien
    [40050] = 7000, --deepithilien
    [40051] = 7000, --deepithilien
    [40052] = 7000, --deepithilien
    [40053] = 3000, --wyvernfang
    [40054] = 50000, --infernalist
    [40055] = 50000, --infernalist
    [40056] = 5000, --herohonourshield
    [40057] = 50, --rookgard sword
    [40058] = 100, --rookgard wolfpaw
    [40059] = 100, --rookgard bearpaw
    [40060] = 100, --rookgard honeycomb
    [40061] = 250, --rookgard honeyflower
    [40062] = 400, --rookgard carlin sword
    [40063] = 750, --rookgard obsidian knife
    [40064] = 500, --rookgard katana
    [40065] = 1000, --rookgard timering
    [40066] = 50, --rookgard lily1
    [40067] = 10000, --poi1of3
    [40068] = 10000, --poi2of3
    [40069] = 10000, --poi3of3
    [40070] = 10000, --poi soft boots and assa outfit
    [40071] = 10000, --poi
    [40072] = 10000, --poi
    [40073] = 10000, --poi
    [40074] = 10000, --poi
    [40075] = 10000, --poidontdelete
    [40076] = 100000, --anni1of4
    [40077] = 100000, --anni2of4
    [40078] = 100000, --anni3of4
    [40079] = 100000, --anni4of4
    [40080] = 0, --nvm
    [40081] = 200000, --oak
    [40082] = 200000, --oak
    [40083] = 200000, --oak
    [40084] = 200000, --oak
    [40085] = 0, --oakdontdelete
    [40086] = 0, --frizenarena1
    [40087] = 0, --frizenarena1
    [40088] = 0, --frizenarena1
    [40089] = 0, --frizenarena2
    [40090] = 0, --frizenarena2
    [40091] = 0, --frizenarena2
    [40092] = 0, --frizenarena3
    [40093] = 0, --frizenarena3
    [40094] = 0, --frizenarena3
}

local questOutfits = {
    [2215] = {female = 542, male = 541}, --anni demon outfit
    [40070] = {female = 156, male = 152}, --poi assassin outfit
}

local tutorialIds = {
}

function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    local storage = specialQuests[item.actionid]
    if not storage then
        storage = item.uid
        if storage > 65535 then
            return false
        end
    end

    if player:getStorageValue(storage) > 0 then
        player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'The ' .. ItemType(item.itemid):getName() .. ' is empty.')
        return true
    end

    local items, reward = {}
    local size = item:isContainer() and item:getSize() or 0
    if size == 0 then
        reward = item:clone()
    else
        local container = Container(item.uid)
        for i = 0, container:getSize() - 1 do
            items[#items + 1] = container:getItem(i):clone()
        end
    end

    size = #items
    if size == 1 then
        reward = items[1]:clone()
    end

    local result = ''
    if reward then
        local ret = ItemType(reward.itemid)
        if ret:isRune() then
            result = ret:getArticle() .. ' ' ..  ret:getName() .. ' (' .. reward.type .. ' charges)'
        elseif ret:isStackable() and reward:getCount() > 1 then
            result = reward:getCount() .. ' ' .. ret:getPluralName()
        elseif ret:getArticle() ~= '' then
            result = ret:getArticle() .. ' ' .. ret:getName()
        else
            result = ret:getName()
        end
    else
        if size > 20 then
            reward = Game.createItem(item.itemid, 1)
        elseif size > 8 then
            reward = Game.createItem(1988, 1)
        else
            reward = Game.createItem(1987, 1)
        end

        for i = 1, size do
            local tmp = items[i]
            if reward:addItemEx(tmp) ~= RETURNVALUE_NOERROR then
                print('[Warning] QuestSystem:', 'Could not add quest reward to container')
            end
        end
        local ret = ItemType(reward.itemid)
        result = ret:getArticle() .. ' ' .. ret:getName()
    end

    if player:addItemEx(reward) ~= RETURNVALUE_NOERROR then
    print(player:addItemEx(reward))
    print(reward)
    print(RETURNVALUE_NOERROR)
        local weight = reward:getWeight()
        if player:getFreeCapacity() < weight then
            player:sendCancelMessage(string.format('You have found %s weighing %.2f oz. You have no capacity.', result, (weight / 100)))
        else
            player:sendCancelMessage('You have found ' .. result .. ', but you have no room to take it.')
        end
        return true
    end

    if questsExperience[storage] then
        player:addExperience(questsExperience[storage], true)
    end

    if questLog[storage] then
        player:setStorageValue(questLog[storage], 1)
    end

    if tutorialIds[storage] then
        player:sendTutorial(tutorialIds[storage])
        if item.uid == 50080 then
            player:setStorageValue(Storage.RookgaardTutorialIsland.SantiagoNpcGreetStorage, 3)
        end
    end

    if isInArray(hotaQuest, item.uid) then
        if player:getStorageValue(Storage.TheAncientTombs.DefaultStart) ~= 1 then
            player:setStorageValue(Storage.TheAncientTombs.DefaultStart, 1)
        end
    end

    player:sendTextMessage(MESSAGE_EVENT_ADVANCE, 'You have found ' .. result .. '.')
    player:setStorageValue(storage, 1)
    return true
end

Please, help me D:
 
Back
Top