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

Many Rewards in Chest.

Karoxer

Member
Joined
Mar 13, 2018
Messages
21
Reaction score
5
Hello,
I've got problem with making chest with multiple rewards inside. In past it was just about set ActionID 2000, set any UniqueID (for example 12345) and choose items in black squares of chest inside RME.
I'm using TFS 1.2 (10.98 client) and this function doesn't work. I used "search" tool and read some articles about it but scripts implemented there don't work. My request is about make for me any script that allow me to set more than 1 reward in chest or other container (like orc corpse etc.). Now I can make only reward by typing item ID into UniqueID :( I'm creating own map and gonna be really usefull to test my reward chest's.


I'm using this script, which is posted in most other threads with problems like mine (probably its standard script placed in tfs folders)
Actions/scripts/quests/quests
LUA:
local annihilatorReward = {1990, 2400, 2431, 2494}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if item.uid <= 1250 or item.uid >= 30000 then
        return false
    end

    local itemType = ItemType(item.uid)
    if itemType:getId() == 0 then
        return false
    end

    local itemWeight = itemType:getWeight()
    local playerCap = player:getFreeCapacity()
    if table.contains(annihilatorReward, item.uid) then
        if player:getStorageValue(30015) == -1 then
            if playerCap >= itemWeight then
                if item.uid == 1990 then
                    player:addItem(1990, 1):addItem(2326, 1)
                else
                    player:addItem(item.uid, 1)
                end
                player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
                player:setStorageValue(30015, 1)
            else
                player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
            end
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
        end
    elseif player:getStorageValue(item.uid) == -1 then
        if playerCap >= itemWeight then
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. '.')
            player:addItem(item.uid, 1)
            player:setStorageValue(item.uid, 1)
        else
            player:sendTextMessage(MESSAGE_INFO_DESCR, 'You have found a ' .. itemType:getName() .. ' weighing ' .. itemWeight .. ' oz it\'s too heavy.')
        end
    else
        player:sendTextMessage(MESSAGE_INFO_DESCR, "It is empty.")
    end
    return true
end
Actions/actions
LUA:
    <!-- Quests -->
    <action itemid="1740" script="quests/quests.lua" /> <!-- Skrzynia Questowa -->
    <action actionid="12345" script="quests/quests.lua"/> <!-- Testing.. Dont work ;/ -->
    <action fromid="1747" toid="1749" script="quests/quests.lua" />
    <action uniqueid="30015" script="quests/annihilator.lua" />

Was trying to solve that problem with myself reading some kind of tutorials or tips/solutions from other threads, but all the time all i can do is to make reward only by typing its ID in UniquieID.
Can someonetell me which part of these script is incorrect or edit it to make it working.
Thanks for your time.
Greetings.
 
Last edited:
Back
Top