multrayzor
New Member
- Joined
- Mar 17, 2014
- Messages
- 58
- Reaction score
- 2
So...with all the distros i used none of them came with a simple well explained quest chest action, and i didnt have any luck finding a good one, so i started working on this:
The concept is, whichever reward you want, you just have to put it as the chest unique id, but for the quests where you have to chose from certain rewards, all you will have to do is add a list with the reward ids on this script. I havent test it yet, but would love to have some feedback on this.
Yours,
Gabe
Code:
specialquests = {
{5803, 6528, 2453}, --poi
{2400, 2494, 2431, 2112} --anni
}
special = false
function onUse(cid, item, frompos, item2, topos)
prize = item.uid
for i, quests in ipairs(specialquests) do
result = 0
for j, reward in ipairs(quests) do
result = result + getPlayerStorageValue(cid, reward)
if reward == prize then
special = true
if result == -j then
doPlayerAddItem(cid, prize, 1)
doPlayerSendTextMessage(cid,22,'You have found something inside!')
setPlayerStorageValue(cid, reward, 1)
result = 0
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
else
return 0
end
end
end
if not special and prize > 0 and prize < 9000 then
queststatus = getPlayerStorageValue(cid,prize)
if queststatus == -1 then
doPlayerSendTextMessage(cid,22,'You have found something inside!')
doPlayerAddItem(cid,prize,1)
setPlayerStorageValue(cid,prize,1)
else
doPlayerSendTextMessage(cid,22,"It is empty.")
end
return 1
else
return 0
end
end
The concept is, whichever reward you want, you just have to put it as the chest unique id, but for the quests where you have to chose from certain rewards, all you will have to do is add a list with the reward ids on this script. I havent test it yet, but would love to have some feedback on this.
Yours,
Gabe