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

Lua task system

julhinhuu

New Member
Joined
Jul 16, 2011
Messages
35
Reaction score
0
Hello good Morning;
I would like you to help me with a task system that the player could make as many as you want, as long as this so player will be able to start the task a week later and the same schedule the last time he did, and the most important that this task show the amount of monsters missing and already bush.
Example : 03:12 [ Dragon Task ] ( 1/600 ), that I hope to help me.
 
Take a look at this tutorial about monster tasks:
https://otland.net/threads/npc-mission.211063/

You can set a timed storage on the player so he can repeat the task after a certain time, in your case a week.

Code:
player:setStorageValue(storageNumber, os.time() + timeInSeconds)

Then check if the player has the storage or not:
Code:
if player:getStorageValue(storageNumber) >= os.time() then
-- still valid.
else
-- not valid.
end
 
Take a look at this tutorial about monster tasks:
https://otland.net/threads/npc-mission.211063/

You can set a timed storage on the player so he can repeat the task after a certain time, in your case a week.

Code:
player:setStorageValue(storageNumber, os.time() + timeInSeconds)

Then check if the player has the storage or not:
Code:
if player:getStorageValue(storageNumber) >= os.time() then
-- still valid.
else
-- not valid.
end

I own a task system I think very good ta just giving error count when monsters and kill others also error.
You have not killed the 600 dragon, now you killed 9 , left 609. His term is up 09/03/16 03:00:31 .

only view of the script is increasing .
follows the script:

Code:
local task = {
   ['dragon'] = {total = 600, stoTime = 96586, stoKill = 96587, amount = 1}
}

function onKill(cid, target, lastHit)
   local player = Player(cid)
   local monstro = Monster(target)
   if not monstro then
     return true
   end
   if monstro:getMaster() then
     return true
   end
   local dragon = task[monstro:getName():lower()]
   if player:getStorageValue(dragon.stoTime) >= os.time() then
     if player:getStorageValue(dragon.stoKill) < 0 then
       player:setStorageValue(dragon.stoKill,0)
     end
     player:setStorageValue(dragon.stoKill, player:getStorageValue(dragon.stoKill) + dragon.amount)
     if player:getStorageValue(dragon.stoKill) >= dragon.total then
       player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task Finalizada] (%d/%d)',monstro:getName(),dragon.total,dragon.total))
     else
       player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, string.format('[%s Task] (%d/%d)',monstro:getName(),player:getStorageValue(dragon.stoKill),dragon.total))
     end
   end
   return true
end
 
Last edited by a moderator:
I own a task system I think very good ta just giving error count when monsters and kill others also error.
You have not killed the 600 dragon, now you killed 9 , left 609. His term is up 09/03/16 03:00:31 .

only view of the script is increasing .
follows the script:
Provide a screen shot of the error so someone can help you.
 
line 15 is this..
Code:
if player:getStorageValue(dragon.stoTime) >= os.time() then
I have no idea how the error correlates with the script you posted.
 

Similar threads

Back
Top