local config = { -- level needed to make the quest level = 150, -- 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 = 61111 -- only if status is false this will be used }, -- vocation requirement, positions and item configuration { vocations = {1, 5}, itemId = 2175, playerPos = {x=725, y=891, z=7}, -- Initial position in the Stone tile newPos = {x=723, y=875, z=7}, -- Position of the reward room. itemPos = {x=725, y=890, z=7} -- Position of Spellbook "Sorcerer". }, { vocations = {2, 6}, itemId = 2674, playerPos = {x=721, y=895, z=7}, -- Initial position in the Stone tile newPos = {x=723, y=876, z=7}, -- Position of the reward room. itemPos = {x=719, y=895, z=7} -- Position of Red apple "Druid". }, { vocations = {3, 7}, itemId = 2498, playerPos = {x=729, y=895, z=7}, -- Initial position in the Stone tile newPos = {x=724, y=875, z=7}, -- Position of the reward room. itemPos = {x=731, y=895, z=7} -- Position of Royal Helmet "Paladin". }, { vocations = {4, 8}, itemId = 7408, playerPos = {x=725, y=899, z=7}, -- Initial position in the Stone tile newPos = {x=32672, y=32070, z=7}, --Position of the reward room. itemPos = {x=724, y=876, z=7} --Position of Wyvern Fang "Knight". } } function onUse(cid) local players = {} 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) 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 end return TRUE end