My server is 7.4 - 0.7
I need help creating 2 talkactions on my server.
1- Shows the player how much time is left for the exp boss to end.
2- Shows the player how many monsters are left to finish the tasks.
exp_boost:
task:
I need help creating 2 talkactions on my server.
1- Shows the player how much time is left for the exp boss to end.
2- Shows the player how many monsters are left to finish the tasks.
exp_boost:
Lua:<action itemid="8516;8518;8554;8555" event="script"><![CDATA[ domodlib('scrolls') function onUse(cid, item, fromPosition, itemEx, toPosition) local extra = configScroll[item.itemid] if not extra then return doPlayerSendCancel(cid, "This scroll is not working, please contact an administrator.") end if getPlayerStorageValue(cid, configScroll.storageTime) > os.time() then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot use a experience scroll again until ".. timeFormat(getPlayerStorageValue(cid, configScroll.storageTime) - os.time()) ..".") end if getItemAttribute(item.uid, "donate") then if tonumber(getPlayerStorageValue(cid, configScroll.vipScrollsStoragetime)) > os.time() then return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You cannot use donated experience scrolls again until ".. timeFormat(getPlayerStorageValue(cid, configScroll.vipScrollsStoragetime) - os.time()) ..".") end setPlayerStorageValue(cid, configScroll.vipScrollStorage, math.max(0, tonumber(getPlayerStorageValue(cid, configScroll.vipScrollStorage))) + 1) if tonumber(getPlayerStorageValue(cid, configScroll.vipScrollStorage)) >= configScroll.vipScrollUsesPerDay then setPlayerStorageValue(cid, configScroll.vipScrollsStoragetime, os.time() + configScroll.vipScrollsBlockTime) setPlayerStorageValue(cid, configScroll.vipScrollStorage, 0) end end setPlayerStorageValue(cid, configScroll.storageTime, os.time() + extra.time) setPlayerStorageValue(cid, configScroll.storagePercent, extra.percent) doPlayerSetRate(cid, SKILL__LEVEL, getPlayerRates(cid)[SKILL__LEVEL] + (extra.percent / 100)) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have activated a experience scroll for "..timeFormat(extra.time).." (+"..extra.percent.."% experience).") eventsScroll[cid] = addEvent(terminateBonus, extra.time * 1000, cid, configScroll.storageTime, configScroll.storagePercent) print(eventsScroll[cid]) doRemoveItem(item.uid, 1) return true end ]]></action>
task:
Lua:<?xml version="1.0" encoding="UTF-8"?> <mod name="Simple Task" version="3.0" author="Vodkart" contact="xtibia.com" enabled="yes"> <config name="task_func"><![CDATA[ max_task_per_time = 3 tasktabble = { ["trolls"] = {monster_race={"troll","frost troll","furious troll","island troll","swamp troll","troll champion","troll legionnaire"}, storage_site = 800201, storage_start = 200201, storage = 91001,count = 200,exp = 2000,money = 500}, ["goblins"] = {monster_race={"goblin","goblin assassin","goblin leader"}, storage_site = 800202,storage_start = 200201, storage_start = 200202, storage = 91002,count = 300,exp = 3000,money = 1000}, ["rotworms"] = {monster_race={"rotworm","carrion worm"}, storage_site = 800203, storage_start = 200203, storage = 91003,count = 300,exp = 4000,money = 1500}, ["cyclops"] = {monster_race={"cyclops","cyclops smith","cyclops drone"}, storage_site = 800204, storage_start = 200204, storage = 91004,count = 500,exp = 15000, money = 5000}, ["dwarf guards"] = {monster_race={"dwarf guard"}, storage_site = 800205, storage_start = 200205, storage = 91005,count = 1000,exp = 32000, money = 10000}, ["orc warlords"] = {monster_race={"orc warlord"}, storage_site = 800206, storage_start = 200248, storage = 91048,count = 200,exp = 26000}, ["dwarfs"] = {monster_race={"dwarf","dwarf soldier"}, storage_site = 800207, storage_start = 200249, storage = 91049, count = 1000, exp = 11000, money = 6000}, ["orcs"] = {monster_race={"orc","orc warrior","orc warlord","orc Shaman","orc rider","orc leader","orc berserker","orc spearman"}, storage_site = 800208, storage_start = 200206, storage = 91006, count = 1000,exp = 34000, money = 4000}, ["tarantulas"] = {monster_race={"tarantula"}, storage_site = 800209, storage_start = 200207, storage = 91007,count = 250,exp = 6000,money = 4000}, ["demon skeletons"] = {monster_race={"demon skeleton"}, storage_site = 800210, storage_start = 200208, storage = 91008,count = 500,exp = 24000}, ["minotaurs"] = {monster_race={"minotaur","minotaur archer","minotaur mage","minotaur guard"}, storage_site = 800211, storage_start = 200209, storage = 91009,count = 1000,exp = 25000,money = 6000}, ["necromancers"] = {monster_race={"necromancer","priestess"}, storage_site = 800212, storage_start = 200210, storage = 91010,count= 500, exp = 80000, reward = {{2195,1}}}, ["carniphilas"] = {monster_race={"carniphila"}, storage_site = 800213, storage_start = 200211, storage = 91011,count= 50, exp = 3750, money = 3000}, ["apes"] = {monster_race={"kongra","sibang","merlkin"}, storage_site = 800214, storage_start = 200212, storage = 91012,count= 1000, exp = 23000, money = 8000}, ["fire elementals"] = {monster_race={"fire elemental"}, storage_site = 800215, storage_start = 200213, storage = 91013,count= 100, exp = 11000, money = 6000}, ["dragons"] = {monster_race={"dragon"}, storage_site = 800216, storage_start = 200214, storage = 91014,count= 1000, exp = 140000, reward = {{2516,1}}}, ["elfs"] = {monster_race={"elf","elf scout","elf arcanist"}, storage_site = 800217, storage_start = 200215, storage = 91015,count = 500, exp = 1000, money = 4000}, ["giant spiders"] = {monster_race={"giant spider"}, storage_site = 800218, storage_start = 200216, storage = 91016,count = 500, exp = 90000, reward = {{2477,1}}}, ["hydras"] = {monster_race={"hydra"}, storage_site = 800219, storage_start = 200217, storage = 91017,count = 500, exp = 400000, reward = {{2498,1}}}, ["serpent spawns"] = {monster_race={"serpent spawn"}, storage_site = 800220, storage_start = 200218, storage = 91018,count = 500, exp = 200000, reward = {{2488,1}}}, ["behemoths"] = {monster_race={"behemoth"}, storage_site = 800221, storage_start = 200219, storage = 91019,count = 500, exp = 200000, reward = {{2645,1}}}, ["crocodiles"] = {monster_race={"crocodile"}, storage_site = 800222, storage_start = 200220, storage = 91020,count = 200, exp = 4000, money = 3500}, ["demons"] = {monster_race={"demon"}, storage_site = 800223, storage_start = 200221, storage = 91021,count = 1000, exp = 666666, reward = {{2495,1}}}, ["terror birds"] = {monster_race={"terror bird"}, storage_site = 800224, storage_start = 200222, storage = 91022,count = 100, exp = 4500, money = 2000}, ["larvas"] = {monster_race={"larva"}, storage_site = 800225, storage_start = 200223, storage = 91023,count = 600, exp = 10000, money = 2000}, ["humans"] = {monster_race={"smuggler","bandit","amazon","assassin","hero","black knight","stalker","hunter","valkyrie","dark monk","monk","necromancer","witch","wild warrior","priestess"}, storage_site = 800226, storage_start = 200224, storage = 91024,count = 100, exp = 5000, money = 2000}, ["scarabs"] = {monster_race={"scarab","ancient scarab"}, storage_site = 800227, storage_start = 200225, storage = 91025,count = 300, exp = 7200, money = 2000}, ["vampires"] = {monster_race={"vampire"}, storage_site = 800228, storage_start = 200226, storage = 91026,count = 600, exp = 22000, reward = {{2534,1}}}, ["ancient scarabs"] = {monster_race={"ancient scarab"}, storage_site = 800229, storage_start = 200227, storage = 91027,count = 1000, exp = 110000, money = 20000}, ["heros"] = {monster_race={"hero"}, storage_site = 800230, storage_start = 200228, storage = 91028,count = 300, exp = 140000, reward = {{2487,1}}}, ["black knights"] = {monster_race={"black knight"}, storage_site = 800231, storage_start = 200229, storage = 91029,count = 300, exp = 140000, reward = {{2414,1}}}, ["dragon lords"] = {monster_race={"dragon lord"}, storage_site = 800232, storage_start = 200230, storage = 91030,count = 500, exp = 210000, reward = {{2492,1}}}, ["warlocks"] = {monster_race={"warlock"}, storage_site = 800233, storage_start = 200231, storage = 91031,count = 1000, exp = 750000, reward = {{2123,1}}}, ["lost souls"] = {monster_race={"lost soul"}, storage_site = 800234, storage_start = 200232, storage = 91032,count = 300, exp = 240000}, ["nightmares"] = {monster_race={"nightmare"}, storage_site = 800235, storage_start = 200233, storage = 91033,count = 500, exp = 215000, reward = {{2195,1}}}, ["dark torturers"] = {monster_race={"dark torturer"}, storage_site = 800236, storage_start = 200234, storage = 91034,count = 250, exp = 232500, reward = {{2645,1}}}, ["plaguesmiths"] = {monster_race={"plaguesmith"}, storage_site = 800237, storage_start = 200235, storage = 91035,count = 250, exp = 232500, reward = {{2645,1}}}, ["defilers"] = {monster_race={"defiler"}, storage_site = 800238, storage_start = 200236, storage = 91036,count = 250, exp = 950000}, ["hellfire fighters"] = {monster_race={"hellfire fighter"}, storage_site = 800239, storage_start = 200237, storage = 91037,count = 250, exp = 1500000}, ["destroyers"] = {monster_race={"destroyer"}, storage_site = 800240, storage_start = 200238, storage = 91038,count = 200, exp = 900000}, ["diabolic imps"] = {monster_race={"diabolic imp"}, storage_site = 800241, storage_start = 200239, storage = 91039,count = 150, exp = 700000}, ["hellhounds"] = {monster_race={"hellhound"}, storage_site = 800242, storage_start = 200240, storage = 91040,count = 500, exp = 1700000}, ["blightwalkers"] = {monster_race={"blightwalker"}, storage_site = 800243, storage_start = 200241, storage = 91041,count = 200, exp = 950000}, ["hand of cursed fates"] = {monster_race={"hand of cursed fate"}, storage_site = 800244, storage_start = 200242, storage = 91042,count = 150, exp = 1200000}, ["son of verminors"] = {monster_race={"son of verminor"}, storage_site = 800245, storage_start = 200243, storage = 91043,count = 150, exp = 500000}, ["juggernauts"] = {monster_race={"juggernaut"}, storage_site = 800246, storage_start = 200244, storage = 91044,count = 1000, exp = 1900000, reward = {{2522,1}}}, ["undead dragons"] = {monster_race={"undead dragon"}, storage_site = 800247, storage_start = 200245, storage = 91045,count = 200, exp = 1300000}, ["betrayed wraiths"] = {monster_race={"betrayed wraiths"}, storage_site = 800248, storage_start = 200246, storage = 91046,count = 200, exp = 900000}, ["phantasms"] = {monster_race={"phantasms"}, storage_site = 800249, storage_start = 200247, storage = 91047,count = 180, exp = 850000}, ["ghouls"] = {monster_race={"ghoul"}, storage_site = 800250, storage_start = 200250, storage = 91050,count = 300, exp = 5100, money = 1100}, ["lizards"] = {monster_race={"lizard sentinel","lizard snakecharmer","lizard templar"}, storage_site = 800251, storage_start = 200251, storage = 91051,count = 450, exp = 105000,money = 10000}, ["orc berserkers"] = {monster_race={"orc berserker"}, storage_site = 800252, storage_start = 200252, storage = 91052,count = 350, exp = 95000,money = 5000}, ["orc leaders"] = {monster_race={"orc leader"}, storage_site = 800253, storage_start = 200253, storage = 91053,count = 350, exp = 105000,money = 5000}, ["orclops"] = {monster_race={"orclops"}, storage_site = 800254, storage_start = 200254, storage = 91054,count = 350, exp = 250000,money = 50000}, ["orclops rockthrower"] = {monster_race={"orclops rockthrower"}, storage_site = 800255, storage_start = 200255, storage = 91055,count = 350, exp = 350000,money = 100000}, ["orclops berserker"] = {monster_race={"orclops berserker"}, storage_site = 800256, storage_start = 200256, storage = 91056,count = 350, exp = 450000,money = 500000, reward = {{2645,1}}}, ["frost dragon"] = {monster_race={"frost dragon"}, storage_site = 800257, storage_start = 200257, storage = 91057,count = 500, exp = 210000, reward = {{2492,1}}}, } function checkTasks(cid) local tasks = {} for k, v in pairs(tasktabble) do if getPlayerStorageValue(cid, v.storage_start) >= 1 then tasks[#tasks + 1] = {k, v} end end return tasks end function finisheAllTask(cid) local config = { exp = {true,1000000}, money = {true,200000}, items ={false,{{5537,1},{5538,1}}}, premium ={true,10} } local x = true for k, v in pairs(tasktabble) do if tonumber(getPlayerStorageValue(cid, v.storage_site)) <= 0 then x = false break end end if x == true then setPlayerStorageValue(cid, 521456, 0) local b = getGlobalStorageValue(63005) if b == -1 then b = 1 end if b < 11 then setGlobalStorageValue(63005,b+1) doBroadcastMessage('[Task Mission Complete] '..getCreatureName(cid)..' was the '..b..' to finish the task!.') doPlayerAddPremiumDays(cid, config.premium[1] == true and config.premium[2] or 0) doPlayerAddExp(cid, config.exp[1] == true and config.exp[2] or 0) doPlayerAddMoney(cid, config.money[1] == true and config.money[2] or 0) if config.items[1] == true then doAddItemsFromList(cid,config.items[2]) end doItemSetAttribute(doPlayerAddItem(cid, 7369), "name", "trophy "..getCreatureName(cid).." completed all the task.") end end end function HavePlayerPosition(cid, from, to) return isInRange(getPlayerPosition(cid), from, to) and true or false end function getRankStorage(cid, value, max, RankName) local str ="" str = "--[".. (RankName == nil and "RANK STORAGE" or ""..RankName.."") .."]--\n\n" local query = db.getResult("SELECT `player_id`, `value` FROM `player_storage` WHERE `key` = "..value.." ORDER BY cast(value as INTEGER) DESC;") if (query:getID() ~= -1) then k = 1 repeat if k > max then break end str = str .. "\n " .. k .. ". "..getPlayerNameByGUID(query:getDataString("player_id")).." - [" .. query:getDataInt("value") .. "]" k = k + 1 until not query:next() end return doShowTextDialog(cid, 2529, str) end function getItemsInContainerById(container, itemid) local items = {} if isContainer(container) and getContainerSize(container) > 0 then for slot=0, (getContainerSize(container)-1) do local item = getContainerItem(container, slot) if isContainer(item.uid) then local itemsbag = getItemsInContainerById(item.uid, itemid) for i=0, #itemsbag do table.insert(items, itemsbag[i]) end else if itemid == item.itemid then table.insert(items, item.uid) end end end end return items end function doPlayerAddItemStacking(cid, itemid, quant) local item = getItemsInContainerById(getPlayerSlotItem(cid, 3).uid, itemid) local piles = 0 if #item > 0 then for i,x in pairs(item) do if getThing(x).type < 100 then local it = getThing(x) doTransformItem(it.uid, itemid, it.type+quant) if it.type+quant > 100 then doPlayerAddItem(cid, itemid, it.type+quant-100) end else piles = piles+1 end end else return doPlayerAddItem(cid, itemid, quant) end if piles == #item then doPlayerAddItem(cid, itemid, quant) end end function doAddItemsFromList(cid, items) if table.maxn(items) > 0 then for i = 1, table.maxn(items) do local count = items[i][2] while (count > 0) do if isItemStackable(items[i][1]) then doPlayerAddItemStacking(cid, items[i][1], 1) else doPlayerAddItem(cid, items[i][1],1) end count = count - 1 end end end end function isOnScreen(position, comparePosition) if math.abs(position.y - comparePosition.y) > 6 or math.abs(position.x - comparePosition.x) > 7 or position.z ~= comparePosition.z then return false end return true end ]]></config> <event type="login" name="TaskLogin" event="script"><![CDATA[ function onLogin(cid) registerCreatureEvent(cid, "KillTask") return true end]]></event> <event type="kill" name="KillTask" event="script"><![CDATA[ domodlib('task_func') function onKill(cid, target, damage, flags) if isMonster(target) then if (flags % 2) == 1 then local n = string.lower(getCreatureName(target)) for race, mob in pairs(tasktabble) do if getPlayerStorageValue(cid,mob .storage_start) >= 1 then for i = 1,#mob.monster_race do if n == mob.monster_race[i] then local contagem = getPlayerStorageValue(cid, mob.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then return true end if contagem > mob.count then return true end setPlayerStorageValue(cid, mob.storage, contagem + 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE,""..(contagem == mob.count and "Congratulations! You finished the task of "..race.."." or "Defeated. Total [" .. contagem .. "/" .. mob.count .. "] " .. race .. ".").."") local party = getPlayerParty(cid) if party then for _, pid in ipairs(getPartyMembers(party)) do if cid ~= pid then if getPlayerStorageValue(getPlayerParty(cid),mob .storage_start) >= 1 then if isOnScreen(getCreaturePosition(target), getCreaturePosition(pid)) then contagem = getPlayerStorageValue(pid, mob.storage) if (contagem == -1) then contagem = 1 end if not tonumber(contagem) then return true end if contagem > mob.count then return true end setPlayerStorageValue(pid, mob.storage, contagem + 1) doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_ORANGE,""..(contagem == mob.count and "Congratulations! You finished the task of "..race.."." or "Defeated. Total [" .. contagem .. "/" .. mob.count .. "] " .. race .. ".").."") end end end end end end end end end end end return true end ]]></event> </mod>