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

How to make a questbox which can only be opened by a certain vocation?

Lua:
function onUse(cid, item, frompos, item2, topos)

     if item.uid == 4001 then
if(getPlayerVocation(cid) == 1) or (getPlayerVocation(cid) == 5) then
 queststatus = getPlayerStorageValue(cid,4001)
 if queststatus == -1 then
	doPlayerSendTextMessage(cid,25,'You have found something')
	doPlayerAddItem(cid,2457,1)
 	setPlayerStorageValue(cid,4001,1)
 else
 	doPlayerSendTextMessage(cid,22,"The chest is empty.")
end
 else
 	doPlayerSendTextMessage(cid,22,"This is only for sorcerers.")
end

end
return true
end

Edit: I tested it and it works. You only have to change the item id and the textmessage in what item you use. And incase you want it for other vocations, use 2/6 for druid, 3/7 for pally and 4/8 for knight.
 
Last edited:
Try made it fast
Lua:
local sorc = 1
local druid = 2
local paladin = 3
local knight = 4
local reward = ITEM ID

function onUse(cid, item, frompos, item2, topos)

if getPlayerVocation(cid) == sorc then
			queststatus = getPlayerStorageValue(cid,1111)
	   		if queststatus == -1 then
   			doPlayerAddItem(cid,reward,COUNT)
 	                setPlayerStorageValue(cid,1111,1)
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found '..getItemNameById(reward)..'.")
			else
			doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "The chest is empty.")
			end
		else
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "Your vocation can't open this chest.")
		end
	    return true
	end
 
Last edited:
Limos,

function onUse(cid, item, frompos, item2, topos)

if item.uid == 2182 then
if(getPlayerVocation(cid) == 1) or (getPlayerVocation(cid) == 5) then
queststatus = getPlayerStorageValue(cid,4001)
if queststatus == -1 then
doPlayerSendTextMessage(cid,25,'You have found something')
doPlayerAddItem(cid,2190,1)
setPlayerStorageValue(cid,4001,1)
else
doPlayerSendTextMessage(cid,22,"The chest is empty.")
end
else
doPlayerSendTextMessage(cid,22,"This is only for sorcerers.")
end

end
return true
end

If item uid 2182 that the uid from the chest do player add item 2190 is wand of vortex

i saved this in a lua file called quest sorc in action/quest

but it doesnt work nothing happens when chest opens I've set it to action id 2000 and 0 but nothing happens

ps: hoi :p
 
You have to put it in the actions.xml as unique id, like this:
XML:
<action uniqueid="2182" event="script" value="quests/vocbox.lua"/>
You don't need to use an action id for this script.
 
Back
Top