• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Action 8.6 - Desert Quest (Vocation Quest) - switch

Codex NG

Recurrent Flamer
Joined
Jul 24, 2015
Messages
2,994
Solutions
12
Reaction score
1,657
You will need to fill out the coordinates and items needed, of course this script could be used for other purposes as well.
Code:
-- table based on base vocations
local p = {
    [1] = { --sorcerer
        player = {
            position = {x = 0, y = 0, z = 0},
            toPos = {x = 0, y = 0, z = }
        },
        item = {
            position = {x = 0, y = 0, z = 0},
            itemid = 0
        }
    },
    [2] = { -- druid
        player = {
            position = {x = 0, y = 0, z = 0},
            toPos = {x = 0, y = 0, z = 0}
        },
        item = {
            position = {x = 0, y = 0, z = 0},
            itemid = 0
        }
    },
    [3] = { -- paladin
        player = {
            position = {x = 0, y = 0, z = 0},
            toPos = {x = 0, y = 0, z = 0}
        },
        item = {
            position = {x = 0, y = 0, z = 0},
            itemid = 0
        }
    },
    [4] = { -- knight
        player = {
            position = {x = 0, y = 0, z = 0},
            toPos = {x = 0, y = 0, z = 0}
        },
        item = {
            position = {x = 0, y = 0, z = 0},
            itemid = 0
        }
    }
}

local playerMinimumLevel = 20

-- get a vocation's base vocation
function getBaseVocation(vocation)
    if vocation >= 5 and vocation <= 8 then
        return vocation - 4
    elseif vocation >= 9 and vocation <= 12 then
        return vocation - 8
    end
    return vocation
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
    local questItems, questPlayers = {}, {}
    for i = 1, #p do
        local pid = getTopCreature(p[i].player.position).uid
        if isPlayer(pid) then
            if getPlayerLevel(pid) >= playerMinimumLevel then
                if getBaseVocation( getPlayerVocation(pid) ) == i then
                    local neededItem = getTileItemById(p[i].item.position, p[i].item.itemid).uid
                    if neededItem > 0 then
                        table.insert(questItems, neededItem)
                        table.insert(questPlayers, pid)
                    else
                        doPlayerSendCancel(cid, "Some items are missing.")
                        return false
                    end
                else
                    doPlayerSendCancel(cid, "A vocation is on the wrong spot.")
                    return false
                end
            else
                doPlayerSendCancel(cid, getCreatureName(pid) .. ", is not high enough in level, they must be atleast level " .. playerMinimumLevel .. ".")
                return false
            end
        else
            doPlayerSendCancel(cid, "A player is missing.")
            return false
        end
    end
    for x = 1, #questPlayers do
        doRemoveItem(questItems[x])
        doPlayerSendTextMessage(questPlayers[x], MESSAGE_INFO_DESCR, "Good luck!")
        doTeleportThing(questPlayers[x], p[x].player.toPos)
    end
    return true
end
 
Thanks Codex, was looking for this, exactly for 8.6
Will try! :D
 
Back
Top