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

Vocation Chest

noshirtstan

New Member
Joined
Aug 2, 2020
Messages
68
Reaction score
2
Hey folks, I've scoured through the forums to find a script that will allow me to have a player interact with it and get specific items based on their vocation.

So far, all the scripts I've tried have failed miserably.

Wondering if anyone has a script for TFS 1.2 that will work for this application.

Thanks!
 
Solution
use this code (Action)
Lua:
local config, str = {
    [1] = {vocs = {1, 2, 5, 6}, itemid = XXXX, text = "Mage"},
    [2] = {vocs = {3, 7}, itemid = XXXX, text = "Paladin"},
    [3] = {vocs = {4, 8}, itemid = XXXX, text = "knight"}
}, 25398

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if not player then return false end
    if player:getStorageValue(str) > 0 then
        player:sendCancelMessage("This chest is empty.")
        return true
    end
    for i = 1, #config do
        local paso = config[i]
        local pvoc = player:getVocation():getId()
        if isInArray(config[i].vocs, pvoc) then
            player:addItem(config[i].itemid, 1)...
use this code (Action)
Lua:
local config, str = {
    [1] = {vocs = {1, 2, 5, 6}, itemid = XXXX, text = "Mage"},
    [2] = {vocs = {3, 7}, itemid = XXXX, text = "Paladin"},
    [3] = {vocs = {4, 8}, itemid = XXXX, text = "knight"}
}, 25398

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local player = Player(cid)
    if not player then return false end
    if player:getStorageValue(str) > 0 then
        player:sendCancelMessage("This chest is empty.")
        return true
    end
    for i = 1, #config do
        local paso = config[i]
        local pvoc = player:getVocation():getId()
        if isInArray(config[i].vocs, pvoc) then
            player:addItem(config[i].itemid, 1)
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have found "..config[i].text..".")
            player:getPosition():sendMagicEffect(15)
        end
    end
    player:setStorageValue(str, 1)
    return true
end
 
Solution
I can confirm the above code works.
Which made me confused because I tought that was the non-working script lol

1596821137886.png
 
Back
Top