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

Spo teh pro

New Member
Joined
Jan 3, 2008
Messages
319
Reaction score
1
Hello, I had an idea and I'd like to know if that's possible :p

Well, I'm sick of this many chestboxes for 1 quest because every item has a vocation requirement and I can't just reward one vocation for the quest so I have to give every vocation ONE item and I'd like to know if its possible like that:

ONE chest and every vocation get a different reward
for example if a paladin clicks on it he receive a crossbow and the next one is a knight and he will receive a sword or something

Would be really nice if anyone could do this for me, please ;*
 
Something like this?

Not tested, but it should work.
Code:
local cfg = {
	druid = 2643,
	sorc = 2643,
	knight = 2643,
	paladin = 2643
	}
	
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerFreeCap(cid) >= 150 then
	if getPlayerStorageValue(cid, 50000) == -1 then
		if isSorcerer(cid) then
			doPlayerAddItem(cid, cfg.sorc, 1)
		elseif isDruid(cid) then
			doPlayerAddItem(cid, cfg.druid, 1)
		elseif isPaladin(cid) then
			doPlayerAddItem(cid, cfg.paladin, 1)
		elseif isKnight(cid) then
			doPlayerAddItem(cid, cfg.knight, 1)
		end
		setPlayerStorageValue(cid, 50000, 1)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "It is empty.")
	end
else
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have enough cap.")
end
end
return TRUE
end
 
lol yea like that but if you can make it shorter by specifying the item in the table, but that might work.
Edit:

Lua:
local vocQ = {
	[1] = {item = }, -- specify the item that you want to give.--
	[2] = {item = }, -- vocations are as follows: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight.--
	[3] = {item = }, -- change any xxxxx value to what ever you want.
	[4] = {item = } 
	}
function onUse(cid, item, toPosition, itemEx, fromPosition)
	for voc, i in pairs(vocQ) do
		if item.actionid == xxxx then
			local opened = getPlayerStorageValue(cid, xxxxx)
			if opened == -1 then
				doPlayerSetStorageValue(cid, xxxxx, 1)
				if getPlayerVocation(cid) == voc or getPlayerVocation(cid) == voc+4 then
					doPlayerAddItem(cid, i.item)
					doPlayerSendTextMessage(cid, 25, "You recieved "..getItemNameById(i.item)..".")
				end
			else
				doPlayerSendCancel(cid, "It's empty.")
			end
		end
	end
return true
end
 
Last edited:
wow thanks the script looks good
I'll try it when I'm at home later, thank you!

I'm sorry that I posted it wrong, long time ago I used otland ;<
 
lol yea like that but if you can make it shorter by specifying the item in the table, but that might work.
Edit:

Lua:
local vocQ = {
	[1] = {item = }, -- specify the item that you want to give.--
	[2] = {item = }, -- vocations are as follows: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight.--
	[3] = {item = }, -- change any xxxxx value to what ever you want.
	[4] = {item = } 
	}
function onUse(cid, item, toPosition, itemEx, fromPosition)
	for voc, i in pairs(vocQ) do
		if item.actionid == xxxx then
			local opened = getPlayerStorageValue(cid, xxxxx)
			if opened == -1 then
				doPlayerSetStorageValue(cid, xxxxx, 1)
				if getPlayerVocation(cid) == voc or getPlayerVocation(cid) == voc+4 then
					doPlayerAddItem(cid, i.item)
					doPlayerSendTextMessage(cid, 25, "You recieved "..getItemNameById(i.item)..".")
				end
			else
				doPlayerSendCancel(cid, "It's empty.")
			end
		end
	end
return true
end

Thanks for your effort but could you explain where to put what?
I'm confused by reading this o_O

for example.. where to put action ID etc? because I dont know how to do that o_O

thanks ;P
 
i have re-made the script a little and here is what you have to configure
about it: (it is under 'local cfg')
questChestAId = #### change the number to the action id that you have to set
in the map editor for that particular chest.
questChestStorage = ##### change the numbers for an unused storage, this
is so that a player can get the chest reward only once.
Lua:
local cfg = {
	questChestAId = 5500, -- if you want to make another quest chest like this one, make a copy of this file, rename it and change this aid to something else. --
	questChestStorage = 45008 -- if you have made a copy of this file and has changed the aid make sure you change the storage too, storage must be an unused storage.--
	}
local vocQ =  {
        [1] = {item = }, -- specify the item that you want to give.--
        [2] = {item = }, -- vocations are as follows: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight.--
        [3] = {item = }, 
        [4] = {item = }
        }
function onUse(cid, item, toPosition, itemEx, fromPosition)
    for voc, i in pairs(vocQ) do
        if item.actionid == cfg.questChestAId then
            local opened = getPlayerStorageValue(cid, cfg.questChestStorage)
            if opened == -1 then
                doPlayerSetStorageValue(cid, cfg.questChestStorage, 1)
                    if getPlayerVocation(cid) == voc or getPlayerVocation(cid) == voc+4 then
                        doPlayerAddItem(cid, i.item)
                        doPlayerSendTextMessage(cid, 25, "You recieved "..getItemNameById(i.item)..".")
                    end
            else
                doPlayerSendCancel(cid, "It's empty.")
			end
        end
    end
return true
end
also you have to specify the items that you want the players of their particular vocation to receive.
now in the map editor you have to place the action id that the script has to the chest that you want.
and in actions.xml: copy this:
PHP:
<action actionid="5500" event="script" value="vocationquest.lua"/>
the action id in there is also the one that is in chest that you placed in the map editor.
I hope this explains how to make this work.
 
dont forget to add promo vocations too
Lua:
local vocQ =   {
        [1] = {item = }, -- specify the item that you want to give.--
        [2] = {item = }, -- vocations are as follows: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight.--
        [3] = {item = },
        [4] = {item = },
        [5] = {item = },
        [6] = {item = },
        [7] = {item = },
        [8] = {item = }
        }
 
Code:
 local cfg =  {
        questChestAId = 5500, -- if you want to make another quest chest like this one, make a copy of this file, rename it and change this aid to something else. --
        questChestStorage = 45008 -- if you have made a copy of this file and has changed the aid make sure you change the storage too, storage must be an unused storage.--
        }
  local vocQ =    {
        [1] = {item = 2421 }, -- specify the item that you want to give.--
        [2] = {item = 2421}, -- vocations are as follows: 1 = sorcerer, 2 = druid, 3 = paladin, 4 = knight.--
        [3] = {item = 2421},
        [4] = {item = 2421},
        [5] = {item = 2421},
        [6] = {item = 2421},
        [7] = {item = 2421},
        [8] = {item = 2421}
        } 
function onUse(cid, item, toPosition, itemEx, fromPosition)
    for voc, i in pairs(vocQ) do
        if item.actionid == cfg.questChestAId then
            local opened = getPlayerStorageValue(cid, cfg.questChestStorage)
            if opened == -1 then
                doPlayerSetStorageValue(cid, cfg.questChestStorage, 1)
                    if getPlayerVocation(cid) == voc or getPlayerVocation(cid) == voc+4 then
                        doPlayerAddItem(cid, i.item)
                        doPlayerSendTextMessage(cid, 25, "You recieved "..getItemNameById(i.item)..".")
                    end
            else
                doPlayerSendCancel(cid, "It's empty.")
                        end
        end
    end
return true
end

Code:
<action actionid="5500" event="script" value="quests/hotm.lua"/>

That's what I got atm and it doesnt work (the file is called hotm)

When I click on the chest it says "It's empty."
 
Last edited:
umm can you help me? im also getting chest emty and im changing storage to different numbers

nvm it manage to eventualy work for me. i needed action and unique id
 
Last edited:
hello, i have a question
this script works perfectly fine, the only problem that i have with this is that you cant open the chests on other characters on your account.
so what do i need to change/add in order for it to make it so that all characters on your account can use the chests?
(im sort of working on a "starter items" chest)
 
Back
Top