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

Action Desert/Vocation Quest Script [7.92+]

Colandus

Advanced OT User
Senator
Joined
Jun 6, 2007
Messages
2,434
Solutions
19
Reaction score
218
Location
Sweden
Code:
local config = { 
    -- level needed to make the quest
    level = 20, 

    -- if players should be able to do the quest unlimited amount of times (not conflicting quest rewards)
    redo = {
        status = true, -- true = unlimited, false = once
        storageValue = 4535 -- only if status is false this will be used
    },
  
    -- vocation requirement, positions and item configuration
    { 
        vocations = {1, 5}, 
        itemId = 2175, 
        playerPos = {x=32677, y=32089, z=8},
        newPos = {x=32671, y=32069, z=8},
        itemPos = {x=32679, y=32089, z=8} 
    }, 
  
    { 
        vocations = {2, 6}, 
        itemId = 2674, 
        playerPos = {x=32669, y=32089, z=8},
        newPos = {x=32672, y=32069, z=8}, 
        itemPos = {x=32667, y=32089, z=8} 
    }, 
  
    { 
        vocations = {3, 7}, 
        itemId = 2455, 
        playerPos = {x=32673, y=32085, z=8},
        newPos = {x=32671, y=32070, z=8}, 
        itemPos = {x=32673, y=32083, z=8} 
    }, 
  
    { 
        vocations = {4, 8}, 
        itemId = 2376, 
        playerPos = {x=32673, y=32093, z=8},
        newPos = {x=32672, y=32070, z=8}, 
        itemPos = {x=32673, y=32094, z=8} 
    } 
} 

function onUse(cid)
    local players = {}
    local items = {}
    for _, v in ipairs(config) do
 
        v.playerPos.stackpos = 253
        local player = getThingfromPos(v.playerPos).uid
 
        if isPlayer(player) == FALSE then
            return doPlayerSendCancel(cid, "There are not enough players.")
        elseif getPlayerLevel(player) < config.level then
            players.level = true
        elseif isInArray(v.vocations, getPlayerVocation(player)) == FALSE then
            players.vocation = true
        elseif config.redo.status and getPlayerStorageValue(cid, config.redo.storageValue) ~= TRUE then
            players.done = true
        else
            v.itemPos.stackpos = 1
            local item = getThingfromPos(v.itemPos)
 
            if item.itemid ~= v.itemId then
                players.item = true
            else
                table.insert(players, player)
                table.insert(items, item.uid)
            end
        end
    end

    if players.level then
        doPlayerSendCancel(cid, "All players need to be level " .. config.level .. " or above.")
    elseif players.vocation then
        doPlayerSendCancel(cid, "All players must stand on the correct tiles.")
    elseif players.done then
        doPlayerSendCancel(cid, "A player in your team has already done this quest.")
    elseif players.item then
        doPlayerSendCancel(cid, "All items must be on the correct positions.")
    else
        for k, player in ipairs(players) do
            doSendMagicEffect(getCreaturePosition(player), CONST_ME_POFF)
            doTeleportThing(player, config[k].newPos)
            doSendMagicEffect(getCreaturePosition(player), CONST_ME_TELEPORT)
        end
        
        for _, item in ipairs(items) do
            doRemoveItem(item)
        end
    end
 
    return TRUE
end

This is an updated version of my very old desert quest script and if you use the old one I recommend you to switch to this one :) I think that most real tibia map servers are using my old script and if they do, please update to this one :D

The code will take the most reasonable warnings first. As you can see it will warn first if there is not enough players, second if they are not correct level, third if they are not on correct tiles, and finally if the items are not at correct position. It's very simple to change the order if you wish. E.g. you could be thinking that it should check if players are on correct tiles before it check level then you'd simply move the place of the if-statements and nothing more...
 
Last edited:
Thanks Pitufo. Hope all real map users are smart to replace my old less efficient script with this one ;)
 
Yes they will.

Added support to enable/disable abillity of redoing quest unlimited amount of times.
 
Im using this script for The Forgotten Server 0.3.2 and im not getting it to work, I edited all the postions and everything is right but it keeps saying (All players must stand on the correct tiles.) when the Pally pulls the lever.

Anyone know if this script works for TFS 0.3.2?

If not is there a working vocation script for this version of TFS?

thanks for any help.
 
Colandus, but if some1 is making this quest, other players cant push the lever ??

I need this !!
 
PHP:
    elseif players.vocation then
        doPlayerSendCancel(cid, "All players must stand on the correct tiles.")
Then there is a player with a wrong vocation on a wrong tile ;).

Regards,
Shawak
 
Thanks working great.
__________________
klekSu.png

You are welcome on kleksoria.com!
Please visit new open tibia forum with it's own ots list. otservers.net!
 
Last edited:
It's working! But the paladin can move the switch when all items are not in right place and no message shows up in game. But the console get some errors..
 
updated, now items are removed too (forgot to do it first)
 
Back
Top