Lava Titan
Developer
Heyo I created a "unique" quest system for my server it works 100% the way it is atm, but I'm having a issue, I can't realize how to make it give multiple rewards instead of just one reward, and if it gives multiple rewards, how to assign an aid to just one of those rewards :X
Any suggestions?
Any suggestions?
Code:
local config = {
[40000] = {rewards = {2092, 1}, set_aid = 1, aid = 61000, storage = 40000, msg = ""},
[40001] = {rewards = {2092, 1}, set_aid = 0, aid = 0, storage = 40001, msg = ""}
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
local names = ""
local chest_uid = config[item:getUniqueId()]
local ma_arround = getCustomSpectators(player:getPosition(), false, false, true, false, 7, 7, 7, 7)
if not player:isPlayer() then
return true
end
for i = 1, #ma_arround do
if(names == "") then
names = ma_arround[i]:getName()
else
names = names .. "\n"..ma_arround[i]:getName()
end
end
if #ma_arround <= 0 then
if player:getFreeCapacity() >= ItemType(chest_uid.rewards[1]):getWeight() then
if player:getStorageValue(chest_uid.storage) <= 0 then
if chest_uid.set_aid == 1 then
player:setStorageValue(chest_uid.storage, 1)
player:addItem(1987, 1):addItem(chest_uid.rewards[1], chest_uid.rewards[2]):setActionId(chest_uid.aid)
player:sendTextMessage(MESSAGE_INFO_DESCR, "You received a "..ItemType(chest_uid.rewards[1]):getName()..".")
else
player:setStorageValue(chest_uid.storage, 1)
player:addItem(1987, 1):addItem(chest_uid.rewards[1], chest_uid.rewards[2])
player:sendTextMessage(MESSAGE_INFO_DESCR, "You received a "..ItemType(chest_uid.rewards[1]):getName()..".")
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "You already completed this quest.")
end
else
player:sendTextMessage(MESSAGE_INFO_DESCR, "Your cap is too low.")
end
else
player:showTextDialog(item:getId(), "You cannot receive your rewards before kill the following monsters:\n\n"..names.."", false, 999)
end
return true
end