• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Daily Quest

What do you mean by changing place?
I made this, maybe it's similar to what you want.
It's 1 chest that gives a different reward based on what day it is, as you can see every day of the week has an itemid.

Code:
local config = {
   storage = 27364,
   exhauststorage = 20932,
   days = {
     ["Monday"] = {itemid = 2476, count = 1, storagevalue = 1},
     ["Tuesday"] = {itemid = 2488, count = 1, storagevalue = 2},
     ["Wednesday"] = {itemid = 2195, count = 1, storagevalue = 3},
     ["Thursday"] = {itemid = 2497, count = 1, storagevalue = 4},
     ["Friday"] = {itemid = 2270, count = 1, storagevalue = 5},
     ["Saturday"] = {itemid = 2141, count = 1, storagevalue = 6},
     ["Sunday"] = {itemid = 2656, count = 1, storagevalue = 7}
   }
}


function onUse(cid, item, fromPosition, itemEx, toPosition)

     local x = config.days[os.date("%A",os.time())]
     if(not x) then
         print("[Error - Action Interface Daily Quest] - Day not found, write the days in English.")
         return true
     end
     if(getPlayerStorageValue(cid, config.storage) == x.storagevalue and exhaustion.check(cid, config.exhauststorage)) then
         return doPlayerSendCancel(cid, "The chest is empty, come back tomorrow for a new reward.")
     end
     local info = getItemInfo(x.itemid)
     if(x.count > 1) then
         text = x.count .. " " .. info.plural
     else
         text = info.article .. " " .. info.name
     end
     local item = doCreateItemEx(x.itemid, x.count)
     if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         text = "You have found a reward weighing " .. getItemWeight(item) .. " oz. It is too heavy or you have not enough space."
     else
         text = "You have received " .. text .. "."
         setPlayerStorageValue(cid, config.storage, x.storagevalue)
         exhaustion.set(cid, config.exhauststorage, 24*60*60)
     end
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
     return true
end

If you mean something else, can you try to explain it better?

Btw, don't test it with a god, the exhaustion won't work on that.
 
Thank you v
What do you mean by changing place?
I made this, maybe it's similar to what you want.
It's 1 chest that gives a different reward based on what day it is, as you can see every day of the week has an itemid.

Code:
local config = {
   storage = 27364,
   exhauststorage = 20932,
   days = {
     ["Monday"] = {itemid = 2476, count = 1, storagevalue = 1},
     ["Tuesday"] = {itemid = 2488, count = 1, storagevalue = 2},
     ["Wednesday"] = {itemid = 2195, count = 1, storagevalue = 3},
     ["Thursday"] = {itemid = 2497, count = 1, storagevalue = 4},
     ["Friday"] = {itemid = 2270, count = 1, storagevalue = 5},
     ["Saturday"] = {itemid = 2141, count = 1, storagevalue = 6},
     ["Sunday"] = {itemid = 2656, count = 1, storagevalue = 7}
   }
}


function onUse(cid, item, fromPosition, itemEx, toPosition)

     local x = config.days[os.date("%A",os.time())]
     if(not x) then
         print("[Error - Action Interface Daily Quest] - Day not found, write the days in English.")
         return true
     end
     if(getPlayerStorageValue(cid, config.storage) == x.storagevalue and exhaustion.check(cid, config.exhauststorage)) then
         return doPlayerSendCancel(cid, "The chest is empty, come back tomorrow for a new reward.")
     end
     local info = getItemInfo(x.itemid)
     if(x.count > 1) then
         text = x.count .. " " .. info.plural
     else
         text = info.article .. " " .. info.name
     end
     local item = doCreateItemEx(x.itemid, x.count)
     if(doPlayerAddItemEx(cid, item, false) ~= RETURNVALUE_NOERROR) then
         doSendMagicEffect(getThingPos(cid), CONST_ME_POFF)
         text = "You have found a reward weighing " .. getItemWeight(item) .. " oz. It is too heavy or you have not enough space."
     else
         text = "You have received " .. text .. "."
         setPlayerStorageValue(cid, config.storage, x.storagevalue)
         exhaustion.set(cid, config.exhauststorage, 24*60*60)
     end
     doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
     return true
end

If you mean something else, can you try to explain it better?

Btw, don't test it with a god, the exhaustion won't work on that.
Thank you very much limos! Gonna try it when coming home, I ment that the chest change place everyday, like rashid in rl tibia, but this is way much better!
 
Back
Top