Ir para conteúdo

Furabio

Conde
  • Total de itens

    962
  • Registro em

  • Última visita

  • Dias Ganhos

    10

Tudo que Furabio postou

  1. Os items para receber o addon é configurável. talkactions.XML <talkaction words="!rank" separator=" " script="buyaddon.lua"/> buyaddon.lua local text = '--Addon List--\n!buyaddon "citizen\n!buyaddon "hunter\n!buyaddon "mage\n!buyaddon "knight\n!buyaddon "summoner\n!buyaddon "warrior\n!buyaddon "barbarian\n!buyaddon "druid\n!buyaddon "wizard\n!buyaddon "oriental\n!buyaddon "pirate\n!buyaddon "assassin\n!buyaddon "beggar\n!buyaddon "beggar\n!buyaddon "shaman\n!buyaddon "norseman\n!buyaddon "nightmare\n!buyaddon "jester\n!buyaddon "brotherhood\n!buyaddon "warmaster\n--Addon List End--' function onSay(cid, words, param) local player = Player(cid) local cfg = { ["citizen"] = { outfit = { male = 128, female = 136, addon = 3, storage = 10031 }, items = { {5878,100} } }, ["hunter"] = { outfit = { male = 129, female = 137, addon = 3, storage = 10032 }, items = { {5876, 100},{5948, 100} } }, ["mage"] = { outfit = { male = 130, female = 138, addon = 3, storage = 10033 }, items = { {2160,10} } }, ["knight"] = { outfit = { male = 131, female = 139, addon = 3, storage = 10034 }, items = { {5880,100},{5893, 100} } }, ["summoner"] = { outfit = { male = 133, female = 141, addon = 3, storage = 10035 }, items = { {2160,10} } }, ["warrior"] = { outfit = { male = 134, female = 142, addon = 3, storage = 10036 }, items = { {5925, 100},{5899, 100},{5919, 1},{5880, 100} } }, ["barbarian"] = { outfit = { male = 147, female = 143, addon = 3, storage = 10037 }, items = { {5911, 50},{5910, 50},{5879, 100} } }, ["druid"] = { outfit = { male = 148, female = 144, addon = 3, storage = 10038 }, items = { {5896, 50},{5897, 50} } }, ["wizard"] = { outfit = { male = 149, female = 145, addon = 3, storage = 10039 }, items = { {2536, 1},{2492, 1},{2488, 1},{2123, 1},{5922, 50} } }, ["oriental"] = { outfit = { male = 150, female = 146, addon = 3, storage = 10040 }, items = { {5883, 100},{5895, 100},{5912, 100} } }, ["pirate"] = { outfit = { male = 151, female = 155, addon = 3, storage = 10041 }, items = { {6098, 100},{6126, 100},{6097, 100} } }, ["assassin"] = { outfit = { male = 152, female = 156, addon = 3, storage = 10042 }, items = { {5898, 30},{5882, 10},{5881, 30},{5895, 20},{5905, 10} } }, ["beggar"] = { outfit = { male = 153, female = 157, addon = 3, storage = 10043 }, items = { {5878, 50},{2743, 30},{5913, 20},{5894, 10} } }, ["shaman"] = { outfit = { male = 154, female = 158, addon = 3, storage = 10044 }, items = { {3955,5},{5810, 5},{3966, 5},{3967, 5} } }, ["norseman"] = { outfit = { male = 251, female = 252, addon = 3, storage = 10045 }, items = { {7290,15} } }, ["nightmare"] = { outfit = { male = 268, female = 269, addon = 3, storage = 10046 }, items = { {6500,200} } }, ["jester"] = { outfit = { male = 273, female = 270, addon = 3, storage = 10047 }, items = { {2160, 25} } }, ["brotherhood"] = { outfit = { male = 278, female = 279, addon = 3, storage = 10048 }, items = { {6500,200} } } } local v, removeItems = cfg[param], 0, 0 if(param == "") then player:sendTextMessage(MESSAGE_INFO_DESCR, 'Please type !addon "outfit') player:showTextDialog( 5914, text) return false end if (v == nil) then player:sendTextMessage(MESSAGE_INFO_DESCR, "There is no such as outfit named "..param..", here is the list of available outfit.") player:showTextDialog(5914, text) return false end if(player:getStorageValue(v.outfit.storage) < 1) then for i = 1, #v.items do if(player:getItemCount(v.items[i][1]) >= v.items[i][2]) then removeItems = removeItems+1 end end if(removeItems == #v.items) then if(player:getSex(cid) == 1) then player:addOutfitAddon(v.outfit.male, v.outfit.addon) elseif(player:getSex(cid) == 0) then player:addOutfitAddon( v.outfit.female, v.outfit.addon) end for i = 1, #v.items do player:removeItem( v.items[i][1], v.items[i][2]) end player:sendTextMessage(MESSAGE_INFO_DESCR, "Enjoy your new addons to your "..param.." outfit!") player:getPosition():sendMagicEffect(CONST_ME_FIREWORK_YELLOW) player:setStorageValue( v.outfit.storage, 1) else for i = 1, #v.items do player:sendTextMessage(MESSAGE_INFO_DESCR, "Tu necesitas " .. v.items[i][2] .. "x " .. ItemType(v.items[i][1]):getName() .. " para obtener el "..param.." addon.") end end else player:sendTextMessage(MESSAGE_INFO_DESCR, "Usted ya obtuvo el "..param..".") end return false end Créditos : david.
  2. local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) local talkState = {} local rtnt = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end npcHandler:setMessage(MESSAGE_GREET, "Greetings |PLAYERNAME|. I need your help and I'll reward you with nice addons if you help me! Just say {addons} or {help} if you don't know what to do.") addoninfo = { ['first citizen addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 136, outfit_male = 128, addon = 1, storageID = 10042}, ['second citizen addon'] = {cost = 0, items = {{5890,50}, {5902,25}, {2480,1}}, outfit_female = 136, outfit_male = 128, addon = 2, storageID = 10043}, ['first hunter addon'] = {cost = 0, items = {{5876,50}, {5948,50}, {5891,5}, {5887,1}, {5889,1}, {5888,1}}, outfit_female = 137, outfit_male = 129, addon = 1, storageID = 10044}, ['second hunter addon'] = {cost = 0, items = {{5875,1}}, outfit_female = 137, outfit_male = 129, addon = 2, storageID = 10045}, ['first knight addon'] = {cost = 0, items = {{5880,50}, {5892,1}}, outfit_female = 139, outfit_male = 131, addon = 1, storageID = 10046}, ['second knight addon'] = {cost = 0, items = {{5893,50}, {11422,1}, {5885,1}, {5887,1}}, outfit_female = 139, outfit_male = 131, addon = 2, storageID = 10047}, ['first mage addon'] = {cost = 0, items = {{2182,1}, {2186,1}, {2185,1}, {8911,1}, {2181,1}, {2183,1}, {2190,1}, {2191,1}, {2188,1}, {8921,1}, {2189,1}, {2187,1}, {2392,30}, {5809,1}, {2193,20}}, outfit_female = 138, outfit_male = 130, addon = 1, storageID = 10048}, ['second mage addon'] = {cost = 0, items = {{5903,1}}, outfit_female = 138, outfit_male = 130, addon = 2, storageID = 10049}, ['first summoner addon'] = {cost = 0, items = {{5878,20}}, outfit_female = 141, outfit_male = 133, addon = 1, storageID = 10050}, ['second summoner addon'] = {cost = 0, items = {{5894,35}, {5911,20}, {5883,40}, {5922,35}, {5879,10}, {5881,30}, {5882,40}, {2392,3}, {5905,30}}, outfit_female = 141, outfit_male = 133, addon = 2, storageID = 10051}, ['first barbarian addon'] = {cost = 0, items = {{5884,1}, {5885,1}, {5910,25}, {5911,25}, {5886,10}}, outfit_female = 147, outfit_male = 143, addon = 1, storageID = 10011}, ['second barbarian addon'] = {cost = 0, items = {{5880,25}, {5892,1}, {5893,25}, {5876,25}}, outfit_female = 147, outfit_male = 143, addon = 2, storageID = 10012}, ['first druid addon'] = {cost = 0, items = {{5896,20}, {5897,20}}, outfit_female = 148, outfit_male = 144, addon = 1, storageID = 10013}, ['second druid addon'] = {cost = 0, items = {{5906,100}}, outfit_female = 148, outfit_male = 144, addon = 2, storageID = 10014}, ['first nobleman addon'] = {cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 1, storageID = 10015}, ['second nobleman addon'] = {cost = 300000, items = {}, outfit_female = 140, outfit_male = 132, addon = 2, storageID = 10016}, ['first oriental addon'] = {cost = 0, items = {{5945,1}}, outfit_female = 150, outfit_male = 146, addon = 1, storageID = 10017}, ['second oriental addon'] = {cost = 0, items = {{5883,30}, {5895,30}, {5891,2}, {5912,30}}, outfit_female = 150, outfit_male = 146, addon = 2, storageID = 10018}, ['first warrior addon'] = {cost = 0, items = {{5925,40}, {5899,40}, {5884,1}, {5919,1}}, outfit_female = 142, outfit_male = 134, addon = 1, storageID = 10019}, ['second warrior addon'] = {cost = 0, items = {{5880,40}, {5887,1}}, outfit_female = 142, outfit_male = 134, addon = 2, storageID = 10020}, ['first wizard addon'] = {cost = 0, items = {{2536,1}, {2492,1}, {2488,1}, {2123,1}}, outfit_female = 149, outfit_male = 145, addon = 1, storageID = 10021}, ['second wizard addon'] = {cost = 0, items = {{5922,40}}, outfit_female = 149, outfit_male = 145, addon = 2, storageID = 10022}, ['first assassin addon'] = {cost = 0, items = {{5912,20}, {5910,20}, {5911,20}, {5913,20}, {5914,20}, {5909,20}, {5886,10}}, outfit_female = 156, outfit_male = 152, addon = 1, storageID = 10023}, ['second assassin addon'] = {cost = 0, items = {{5804,1}, {5930,10}}, outfit_female = 156, outfit_male = 152, addon = 2, storageID = 10024}, ['first beggar addon'] = {cost = 0, items = {{5878,30}, {5921,20}, {5913,10}, {5894,10}}, outfit_female = 157, outfit_male = 153, addon = 1, storageID = 10025}, ['second beggar addon'] = {cost = 0, items = {{5883,30}, {2160,2}}, outfit_female = 157, outfit_male = 153, addon = 2, storageID = 10026}, ['first pirate addon'] = {cost = 0, items = {{6098,30}, {6126,30}, {6097,30}}, outfit_female = 155, outfit_male = 151, addon = 1, storageID = 10027}, ['second pirate addon'] = {cost = 0, items = {{6101,1}, {6102,1}, {6100,1}, {6099,1}}, outfit_female = 155, outfit_male = 151, addon = 2, storageID = 10028}, ['first shaman addon'] = {cost = 0, items = {{5810,5}, {3955,5}, {5015,1}}, outfit_female = 158, outfit_male = 154, addon = 1, storageID = 10029}, ['second shaman addon'] = {cost = 0, items = {{3966,5}, {3967,5}}, outfit_female = 158, outfit_male = 154, addon = 2, storageID = 10030}, ['first norseman addon'] = {cost = 0, items = {{7290,5}}, outfit_female = 252, outfit_male = 251, addon = 1, storageID = 10031}, ['second norseman addon'] = {cost = 0, items = {{7290,10}}, outfit_female = 252, outfit_male = 251, addon = 2, storageID = 10032}, ['first jester addon'] = {cost = 0, items = {{5912,20}, {5913,20}, {5914,20}, {5909,20}}, outfit_female = 270, outfit_male = 273, addon = 1, storageID = 10033}, ['second jester addon'] = {cost = 0, items = {{5912,20}, {5910,20}, {5911,20}, {5912,20}}, outfit_female = 270, outfit_male = 273, addon = 2, storageID = 10034}, ['first demonhunter addon'] = {cost = 0, items = {{5905,30}, {5906,40}, {5954,20}, {6500,50}}, outfit_female = 288, outfit_male = 289, addon = 1, storageID = 10035}, ['second demonhunter addon'] = {cost = 0, items = {{5906,50}, {6500,200}}, outfit_female = 288, outfit_male = 289, addon = 2, storageID = 10036}, ['first nightmare addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 269, outfit_male = 268, addon = 1, storageID = 10037}, ['second nightmare addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 269, outfit_male = 268, addon = 2, storageID = 10038}, ['first brotherhood addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 279, outfit_male = 278, addon = 1, storageID = 10039}, ['second brotherhood addon'] = {cost = 0, items = {{6500,750}}, outfit_female = 279, outfit_male = 278, addon = 2, storageID = 10040}, ['first yalaharian addon'] = {cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 1, storageID = 10041}, ['second yalaharian addon'] = {cost = 0, items = {{9955,1}}, outfit_female = 324, outfit_male = 325, addon = 2, storageID = 10041} -- next storage 10052 -- next storage 10052 -- next storage 10052 -- next storage 10052 -- next storage 10052 -- next storage 10052 -- next storage 10052 -- } local o = {'citizen', 'hunter', 'knight', 'mage', 'nobleman', 'summoner', 'warrior', 'barbarian', 'druid', 'wizard', 'oriental', 'pirate', 'assassin', 'beggar', 'shaman', 'norseman', 'nighmare', 'jester', 'yalaharian', 'brotherhood'} function creatureSayCallback(cid, type, msg) local talkUser = cid if(not npcHandler:isFocused(cid)) then return false end if addoninfo[msg] ~= nil then if (getPlayerStorageValue(cid, addoninfo[msg].storageID) ~= -1) then npcHandler:say('You already have this addon!', cid) npcHandler:resetNpc() else local itemsTable = addoninfo[msg].items local items_list = '' if table.maxn(itemsTable) > 0 then for i = 1, table.maxn(itemsTable) do local item = itemsTable items_list = items_list .. item[2] .. ' ' .. ItemType(item[1]):getName() if i ~= table.maxn(itemsTable) then items_list = items_list .. ', ' end end end local text = '' if (addoninfo[msg].cost > 0) then text = addoninfo[msg].cost .. ' gp' elseif table.maxn(addoninfo[msg].items) then text = items_list elseif (addoninfo[msg].cost > 0) and table.maxn(addoninfo[msg].items) then text = items_list .. ' and ' .. addoninfo[msg].cost .. ' gp' end npcHandler:say('For ' .. msg .. ' you will need ' .. text .. '. Do you have it all with you?', cid) rtnt[talkUser] = msg talkState[talkUser] = addoninfo[msg].storageID return true end elseif msgcontains(msg, "yes") then if (talkState[talkUser] > 10010 and talkState[talkUser] < 10100) then local items_number = 0 if table.maxn(addoninfo[rtnt[talkUser]].items) > 0 then for i = 1, table.maxn(addoninfo[rtnt[talkUser]].items) do local item = addoninfo[rtnt[talkUser]].items if (getPlayerItemCount(cid,item[1]) >= item[2]) then items_number = items_number + 1 end end end if(getPlayerMoney(cid) >= addoninfo[rtnt[talkUser]].cost) and (items_number == table.maxn(addoninfo[rtnt[talkUser]].items)) then doPlayerRemoveMoney(cid, addoninfo[rtnt[talkUser]].cost) if table.maxn(addoninfo[rtnt[talkUser]].items) > 0 then for i = 1, table.maxn(addoninfo[rtnt[talkUser]].items) do local item = addoninfo[rtnt[talkUser]].items doPlayerRemoveItem(cid,item[1],item[2]) end end doPlayerAddOutfit(cid, addoninfo[rtnt[talkUser]].outfit_male, addoninfo[rtnt[talkUser]].addon) doPlayerAddOutfit(cid, addoninfo[rtnt[talkUser]].outfit_female, addoninfo[rtnt[talkUser]].addon) setPlayerStorageValue(cid,addoninfo[rtnt[talkUser]].storageID,1) npcHandler:say('Here you are.', cid) else npcHandler:say('You do not have needed items!', cid) end rtnt[talkUser] = nil talkState[talkUser] = 0 npcHandler:resetNpc() return true end elseif msgcontains(msg, "addon") then npcHandler:say('I can give you addons for {' .. table.concat(o, "}, {") .. '} outfits.', cid) rtnt[talkUser] = nil talkState[talkUser] = 0 npcHandler:resetNpc() return true elseif msgcontains(msg, "help") then npcHandler:say('To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME addon\'.', cid) rtnt[talkUser] = nil talkState[talkUser] = 0 npcHandler:resetNpc() return true else if talkState[talkUser] ~= nil then if talkState[talkUser] > 0 then npcHandler:say('Come back when you get these items.', cid) rtnt[talkUser] = nil talkState[talkUser] = 0 npcHandler:resetNpc() return true end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
  3. Esse npc permite escolher qual task o player irá fazer : Adonai.xml <?xml version="1.0" encoding="UTF-8"?> <npc name="Adonai" script="tasks.lua" walkinterval="2000" speed ="0" floorchange="0"> <health now="100" max="100"/> <look type="433" head="58" body="113" legs="50" feet="78" addons="1" mount="688"/> </npc> tasks.lua local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local xmsg = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end local storage = 62003 local monsters = { ["Dragons"] = {storage = 5010, mstorage = 19000, amount = 10, exp = 5000, items = {{id = 2157, count = 1}, {id = 2160, count = 3}}}, ["Dragon Lords"] = {storage = 5011, mstorage = 19001, amount = 10, exp = 10000, items = {{id = 2492, count = 1}, {id = 2160, count = 5}}}, ["Hydras"] = {storage = 5012, mstorage = 19002, amount = 10, exp = 18000, items = {{id = 2195, count = 1}, {id = 2157, count = 8}}}, ["Demons"] = {storage = 5013, mstorage = 19003, amount = 10, exp = 20000, items = {{id = 2520, count = 1}, {id = 2160, count = 10}}} } local function getItemsFromTable(itemtable) local text = "" for v = 1, #itemtable do count, info = itemtable[v].count, ItemType(itemtable[v].id) local ret = ", " if v == 1 then ret = "" elseif v == #itemtable then ret = " and " end text = text .. ret text = text .. (count > 1 and count or info:getArticle()).." "..(count > 1 and info:getPluralName() or info:getName()) end return text end local function Cptl(f, r) return f:upper()..r:lower() end function creatureSayCallback(cid, type, msg) local player, cmsg = Player(cid), msg:gsub("(%a)([%w_']*)", Cptl) if not npcHandler:isFocused(cid) then if msg == "hi" or msg == "hello" then npcHandler:addFocus(cid) if player:getStorageValue(storage) == -1 then local text, n = "", 0 for k, x in pairs(monsters) do if player:getStorageValue(x.mstorage) < x.amount then n = n + 1 text = text .. ", " text = text .. ""..x.amount.." {"..k.."}" end end if n > 1 then npcHandler:say("I have several tasks for you to kill monsters"..text..", which one do you choose? I can also show you a {list} with rewards and you can {stop} a task if you want.", cid) npcHandler.topic[cid] = 1 xmsg[cid] = msg elseif n == 1 then npcHandler:say("I have one last task for you"..text..".", cid) npcHandler.topic[cid] = 1 else npcHandler:say("You already did all tasks, I have nothing for you to do anymore, good job though.", cid) end elseif player:getStorageValue(storage) == 1 then for k, x in pairs(monsters) do if player:getStorageValue(x.storage) == 1 then npcHandler:say("Did you kill "..x.amount.." "..k.."?", cid) npcHandler.topic[cid] = 2 xmsg[cid] = k end end end else return false end elseif monsters[cmsg] and npcHandler.topic[cid] == 1 then if player:getStorageValue(monsters[cmsg].storage) == -1 then npcHandler:say("Good luck, come back when you killed "..monsters[cmsg].amount.." "..cmsg..".", cid) player:setStorageValue(storage, 1) player:setStorageValue(monsters[cmsg].storage, 1) else npcHandler:say("You already did the "..cmsg.." mission.", cid) end npcHandler.topic[cid] = 0 elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 2 then local x = monsters[xmsg[cid]] if player:getStorageValue(x.mstorage) >= x.amount then npcHandler:say("Good job, here is your reward, "..getItemsFromTable(x.items)..".", cid) for g = 1, #x.items do player:addItem(x.items[g].id, x.items[g].count) end player:addExperience(x.exp) player:setStorageValue(x.storage, 2) player:setStorageValue(storage, -1) npcHandler.topic[cid] = 3 else npcHandler:say("You didn't kill them all, you still need to kill "..x.amount -(player:getStorageValue(x.mstorage) + 1).." "..xmsg[cid]..".", cid) end elseif msgcontains(msg, "task") and npcHandler.topic[cid] == 3 then local text, n = "", 0 for k, x in pairs(monsters) do if player:getStorageValue(x.mstorage) < x.amount then n = n + 1 text = text .. (n == 1 and "" or ", ") text = text .. "{"..k.."}" end end if text ~= "" then npcHandler:say("Want to do another task? You can choose "..text..".", cid) npcHandler.topic[cid] = 1 else npcHandler:say("You already did all tasks.", cid) end elseif msgcontains(msg, "no") and npcHandler.topic[cid] == 1 then npcHandler:say("Ok then.", cid) npcHandler.topic[cid] = 0 elseif msgcontains(msg, "stop") then local text, n = "", 0 for k, x in pairs(monsters) do if player:getStorageValue(x.mstorage) < x.amount then n = n + 1 text = text .. (n == 1 and "" or ", ") text = text .. "{"..k.."}" if player:getStorageValue(x.storage) == 1 then player:setStorageValue(x.storage, -1) end end end if player:getStorageValue(storage) == 1 then npcHandler:say("Alright, let me know if you want to continue an other task, you can still choose "..text..".", cid) else npcHandler:say("You didn't start any new task yet, if you want to start one, you can choose "..text..".", cid) end player:setStorageValue(storage, -1) npcHandler.topic[cid] = 1 elseif msgcontains(msg, "list") then local text = "Tasks\n\n" for k, x in pairs(monsters) do if player:getStorageValue(x.mstorage) < x.amount then text = text ..k .." ["..(player:getStorageValue(x.mstorage) + 1).."/"..x.amount.."]:\n Rewards:\n "..getItemsFromTable(x.items).."\n "..x.exp.." experience \n\n" else text = text .. k .." [DONE]\n" end end player:showTextDialog(1949, "" .. text) npcHandler:say("Here you are.", cid) elseif msgcontains(msg, "bye") then npcHandler:say("Bye.", cid) npcHandler:releaseFocus(cid) else npcHandler:say("What?", cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) creaturescripts.xml <event type="kill" name="Tasks" script="killtasks.lua"/> login.lua player:registerEvent("Tasks") killtasks.lua local config = { ['dragon'] = {amount = 10, storage = 19000, startstorage = 5010, startvalue = 1}, ['dragon lord'] = {amount = 10, storage = 19001, startstorage = 5011, startvalue = 1}, ['hydra'] = {amount = 10, storage = 19002, startstorage = 5012, startvalue = 1}, ['demon'] = {amount = 10, storage = 19003, startstorage = 5013, startvalue = 1} } function onKill(player, target) local monster = config[target:getName():lower()] if target:isPlayer() or not monster or target:getMaster() then return true end local stor = player:getStorageValue(monster.storage)+1 if stor < monster.amount and player:getStorageValue(monster.startstorage) >= monster.startvalue then player:setStorageValue(monster.storage, stor) player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Task message: '..(stor +1)..' of '..monster.amount..' '..target:getName()..'s killed.') end if (stor +1) == monster.amount then player:sendTextMessage(MESSAGE_INFO_DESCR, 'Congratulations, you have killed '..(stor +1)..' '..target:getName()..'s and completed the '..target:getName()..'s mission.') player:setStorageValue(monster.storage, stor +1) end return true end ___________________________________________________________________________________________ Como funciona ? O NPC oferece-lhe várias task, você pode escolher qual você deseja fazer. Se você não matar todos os monstros, o NPC irá dizer-lhe quantos você ainda tem que matar. Você pode para ver a lista de recompensa e as tasks que você já fez. Você pode parar com as tasks e ir fazer outra e depois continuar a antiga. Ao terminar as task elas não serão mais mencionados pelo NPC mas será mostrado como terminado na lista. Quando terminar as task o npc, dirá que todas foram completadas. Créditos : Limos
  4. O evento se resume a cada x horário configurável, é escolhido dentre os player online, 1 pessoa e ela recebe uma surprise bag (com items aleatórios para ganhar também configurável). Globalevents/scripts ---> lottery.lua local config = { lottery_hour = "1 Hours", -- after how many hours should lottery begin, explains itself really... reward_count = 4, -- How much items/rewards? so you want 4 random items then write 4... website = 1 -- Doesn't need explanation } function onThink(interval, lastExecution) local players = getPlayersOnline() local list = {} for i, tid in ipairs(players) do list[i] = tid end local winner = list[math.random(1, #list)] if(config.website == 1) then db.executeQuery("INSERT INTO `lottery` (`name`) VALUES ('".. getCreatureName(winner) .."');") end doBroadcastMessage('[LOTTERY SYSTEM] Winner: '.. getCreatureName(winner) ..', Reward: Suprise Bag' ..'! - Congratulations! (Next Lottery in '.. config.lottery_hour ..')') doPlayerAddItem(winner, 6571,config.reward_count) return TRUE end globalevents.xml <globalevent name="lottery" interval="4050000" event="script" value="lottery.lua"/> Actions/scripts --> surprisebag.lua -- CREATED BY GHETTOBIRD --! local PRESENT_BLUE = {2494, 2472} -- Add more items if you want just seperate them with an item id... local PRESENT_RED = {2160, 2514} -- same as above function onUse(cid, item, fromPosition, itemEx, toPosition) local count = 1 if(item.itemid == 6570) then local randomChance = math.random(1, #PRESENT_BLUE) if(randomChance == 1) then count = 2 elseif(randomChance == 2) then count = 2 end doPlayerAddItem(cid, PRESENT_BLUE[randomChance], count) elseif(item.itemid == 6571) then local randomChance = math.random(1, #PRESENT_RED) if randomChance > 0 and randomChance < 4 then count = 2 end doPlayerAddItem(cid, PRESENT_RED[randomChance], count) end doSendMagicEffect(fromPosition, CONST_ME_GIFT_WRAPS) doRemoveItem(item.uid, 1) return true end actions.xml <action fromid="6570" toid="6571" event="script" value="surprisebag.lua"/> Créditos : ghetobird
  5. AREA1 = { {0, 0, 0}, {0, 3, 0}, {0, 0, 0} } local function sendHealingEffect(cid, position, loopCount) local player = Player(cid) if not player then return end position:sendDistanceEffect(player:getPosition(), CONST_ANI_SMALLHOLY) player:addHealth(math.max(100, 150)) player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE) if loopCount == 0 then player:getPosition():sendMagicEffect(CONST_ME_HOLYAREA) end end function onCastSpell(creature, var) local playerPos = creature:getPosition() local loopCount = 12 creature:say('Heal me my brothers!', TALKTYPE_MONSTER_SAY) for i = 1, loopCount do local position = Position(playerPos.x + math.random(-4, 3), playerPos.y + math.random(-3, 2), playerPos.z) addEvent(doAreaCombatHealth, i * 75, creature:getId(), COMBAT_PHYSICALDAMAGE, position, createCombatArea(AREA1), 0, 0, CONST_ME_ASSASSIN) addEvent(sendHealingEffect, i * 75, creature:getId(), position, loopCount - i) end return false end local function targetEffect(cid) local player = Player(cid) if not player then return end local effect = CONST_ANI_REDSTAR local orig = player:getPosition() local d1, d2 = {z = orig.z}, {z = orig.z} d1.x = orig.x - 5 d2.x = orig.x + 5 for i = -2, 2 do d1.y = orig.y + i d2.y = d1.y orig:sendDistanceEffect(d1, effect) orig:sendDistanceEffect(d2, effect) end d1.y = orig.y - 3 d2.y = orig.y + 3 for i = -4, 4 do d1.x = orig.x + i d2.x = d1.x orig:sendDistanceEffect(d1, effect) orig:sendDistanceEffect(d2, effect) end end local function backOldPosition(cid, oldPosition) local player = Player(cid) if not player then return end player:teleportTo(oldPosition) player:setGhostMode(false) end local function jumpEffect(cid, target) local player = Player(cid) if not player then return end local target = Creature(target) if target then player:getPosition():sendDistanceEffect(target:getPosition(), CONST_ANI_EXPLOSION) end end local function jumpOnTarget(cid, target, targetCount, oldPosition) local player = Player(cid) if not player then return end local target = Creature(target) if target then addEvent(targetEffect, 100, cid) player:teleportTo(target:getPosition()) player:setGhostMode(true) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_ASSASSIN) if targetCount == 0 then addEvent(backOldPosition, 400, cid, oldPosition) end end end local function extractRandomValuesFromTable(tbl) --By Printer(This will make sure not to select a value twice from the table) if #tbl == 0 then return false end return table.remove(tbl, math.random(#tbl)) end function onCastSpell(creature, var) local targets = {} local playerPos = creature:getPosition() local spectators = Game.getSpectators(playerPos, false, false, 0, 10, 0, 10) for i = 1, #spectators do local specs = spectators[i] if specs ~= creature and not specs:isNpc() then targets[#targets+1] = specs end end if #targets == 0 then creature:sendCancelMessage('There is no targets in sight.') playerPos:sendMagicEffect(CONST_ME_POFF) return false end local targetCount = #targets for i = 1, #targets do local randTarget = extractRandomValuesFromTable(targets) addEvent(jumpOnTarget, i * 400, creature:getId(), randTarget:getId(), targetCount - i, playerPos) addEvent(jumpEffect, i * 300, creature:getId(), randTarget:getId()) end return false end local function sendDistanceEffectDelay(cid, fromPos, toPos, effect) local player = Player(cid) if not player then return end fromPos:sendDistanceEffect(toPos, effect) end local function ninjaJumpDash(cid, target, oldPos, lastJump, back) local player = Player(cid) if not player then return end local target = Creature(target) if not target then player:setGhostMode(false) return end if lastJump then player:setGhostMode(false) end if back then player:teleportTo(oldPos) else player:teleportTo(target:getPosition()) end doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -1, -100, CONST_ME_THUNDER) end function onCastSpell(creature, var) local cid = creature:getId() local playerPos = creature:getPosition() creature:setGhostMode(true) addEvent(ninjaJumpDash, 0, cid, target:getId(), playerPos, false, false) addEvent(sendDistanceEffectDelay, 100, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY) addEvent(sendDistanceEffectDelay, 300, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY) addEvent(ninjaJumpDash, 400, cid, target:getId(), playerPos, false, true) addEvent(ninjaJumpDash, 600, cid, target:getId(), playerPos, false, false) addEvent(sendDistanceEffectDelay, 700, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY) addEvent(sendDistanceEffectDelay, 1000, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY) addEvent(ninjaJumpDash, 1100, cid, target:getId(), playerPos, false, true) addEvent(ninjaJumpDash, 1300, cid, target:getId(), playerPos, false, false) addEvent(sendDistanceEffectDelay, 1400, cid, playerPos, target:getPosition(), CONST_ANI_ENERGY) addEvent(sendDistanceEffectDelay, 1700, cid, target:getPosition(), playerPos, CONST_ANI_ENERGY) addEvent(ninjaJumpDash, 1800, cid, target:getId(), playerPos, true, true) return false end function isWalkable(cid, pos) local tile = Tile(pos) if not tile then return false end if tile:queryAdd(cid) == 1 and not tile:hasFlag(TILESTATE_PROTECTIONZONE) then return true end return false end local function jumpBehindTarget(cid, target) local player = Player(cid) local target = Creature(target) local targetPos = target:getPosition() local targetPositions = { north = Position(targetPos.x, targetPos.y-1, targetPos.z), east = Position(targetPos.x+1, targetPos.y, targetPos.z), west = Position(targetPos.x-1, targetPos.y, targetPos.z), south = Position(targetPos.x, targetPos.y+1, targetPos.z) } local targetDir = target:getDirection() if targetDir == NORTH then dir = targetPositions.south elseif targetDir == EAST then dir = targetPositions.west elseif targetDir == WEST then dir = targetPositions.east elseif targetDir == SOUTH then dir = targetPositions.north end return dir end local function oldPos(cid, oldPos) local player = Player(cid) if not player then return end player:teleportTo(oldPos) end local function checkHasTarget(cid, count, oldPos) local player = Player(cid) if not player then return end if count < 1 then player:setGhostMode(false) return end local target = player:getTarget() if target then local behindTarget = jumpBehindTarget(cid, target:getId()) if isWalkable(cid, behindTarget) then player:teleportTo(behindTarget) else player:teleportTo(target:getPosition()) addEvent(backOldPos, 100, cid, oldPos) end player:setDirection(target:getDirection()) player:setGhostMode(false) doTargetCombatHealth(cid, target, COMBAT_PHYSICALDAMAGE, -20, -100, CONST_ME_FIREATTACK) return true end addEvent(checkHasTarget, 1 * 100, cid, count - 1) end function onCastSpell(creature, var) local playerPos = creature:getPosition() creature:setGhostMode(true) playerPos:sendMagicEffect(CONST_ME_POFF) addEvent(checkHasTarget, 1 * 250, creature:getId(), 50, playerPos) return false end Créditos : Printer
  6. normal item: 15:19 You see a morning star (Atk:25, Def:11). It weighs 54.00 oz. rare: 15:19 You see a [sharpened] morning star (Atk:29, Def:11). It weighs 54.00 oz. [atk: +18%] creaturescripts.xml: <event type="login" name="randomstats_register" script="randomstats.lua"/> <event type="kill" name="randomstats_loot" script="randomstats.lua"/> randomstats.lua: local rare_popup = true local rare_text = "*rare*" local rare_effect = true local rare_effect_id = CONST_ME_MAGIC_GREEN local tiers = { [1] = { prefix = 'rare', showattr = true, -- attr prefix will be shown instead extra = {0, 0}, chance = { [1] = 10000, -- chance for basic stat [2] = 5000 -- chance for second stat } }, [2] = { prefix = 'epic', extra = {7, 20}, -- additional percent bonus chance = { [1] = 3333, [2] = 25000 } }, [3] = { prefix = 'legendary', extra = {20, 35}, chance = { [1] = 1000, [2] = 100000 -- 2 bonuses always } }, } --! attributes local attr = { atk = { name = 'atk', prefix = 'sharpened', percent = {7, 25}, }, def = { name = 'def', prefix = 'fortified', percent = {7, 25}, }, extradef = { name = 'extra def', prefix = 'balanced', percent = {7, 25}, }, arm = { name = 'arm', prefix = 'flawless', percent = {7, 20}, }, hitchance = { name = 'accuracy', prefix = 'accurate', percent = {10, 25}, }, shootrange = { name = 'range', prefix = 'powerful', percent = {17, 34}, }, charges = { name = 'charges', prefix = 'charged', percent = {30, 45}, }, duration = { name = 'time', prefix = 'unique', percent = {35, 50}, }, --[[ not available in 1.1 attackSpeed = {}, extraAttack = {}, ]] } local stats = { [1] = {ITEM_ATTRIBUTE_ATTACK, attr.atk}, [2] = {ITEM_ATTRIBUTE_DEFENSE, attr.def}, [3] = {ITEM_ATTRIBUTE_EXTRADEFENSE, attr.extradef}, [4] = {ITEM_ATTRIBUTE_ARMOR, attr.arm}, [5] = {ITEM_ATTRIBUTE_HITCHANCE, attr.hitchance}, [6] = {ITEM_ATTRIBUTE_SHOOTRANGE, attr.shootrange}, [7] = {ITEM_ATTRIBUTE_CHARGES, attr.charges}, [8] = {ITEM_ATTRIBUTE_DURATION, attr.duration}, -- not available in 1.1 -- [9] = {ITEM_ATTRIBUTE_ATTACKSPEED, attr.attackSpeed}, -- [10] = {ITEM_ATTRIBUTE_EXTRAATTACK, attr.extraAttack}, } function stat_getItemDuration(item) local it_id = item:getId() local tid = ItemType(it_id):getTransformEquipId() if tid > 0 then item:transform(tid) local vx = item:getAttribute(ITEM_ATTRIBUTE_DURATION) item:transform(it_id) item:removeAttribute(ITEM_ATTRIBUTE_DURATION) return vx end return 0 end function loot_attrToVal(item, attr) local id = ItemType(item:getId()) local v = { [ITEM_ATTRIBUTE_ATTACK] = id:getAttack(), [ITEM_ATTRIBUTE_DEFENSE] = id:getDefense(), [ITEM_ATTRIBUTE_EXTRADEFENSE] = id:getExtraDefense(), [ITEM_ATTRIBUTE_ARMOR] = id:getArmor(), [ITEM_ATTRIBUTE_HITCHANCE] = id:getHitChance(), [ITEM_ATTRIBUTE_SHOOTRANGE] = id:getShootRange(), [ITEM_ATTRIBUTE_CHARGES] = id:getCharges(), [ITEM_ATTRIBUTE_DURATION] = stat_getItemDuration(item), -- not available in 1.1 -- [ITEM_ATTRIBUTE_ATTACKSPEED] = item:getAttackSpeed(), -- [ITEM_ATTRIBUTE_EXTRAATTACK] = item:getExtraAttack(), } return v[attr] end function assign_loot_Stat(c) local rares = 0 local h = c:getItemHoldingCount() if h > 0 then for i = 1, h do local available_stats = {} local it_u = c:getItem(i - 1) local it_id = ItemType(it_u:getId()) if it_u:isContainer() then local crares = assign_loot_Stat(it_u) rares = rares + crares else if not it_id:isStackable() then local wp = it_id:getWeaponType() if wp > 0 then if wp == WEAPON_SHIELD then -- type shield table.insert(available_stats, stats[2]) elseif wp == WEAPON_DISTANCE then -- type bow table.insert(available_stats, stats[1]) table.insert(available_stats, stats[5]) table.insert(available_stats, stats[6]) -- not available in 1.1 -- table.insert(available_stats, stats[9]) elseif wp == WEAPON_WAND then -- type wand table.insert(available_stats, stats[6]) -- not available in 1.1 -- table.insert(available_stats, stats[9]) elseif isInArray({WEAPON_SWORD, WEAPON_CLUB, WEAPON_AXE}, wp) then -- melee weapon if it_id:getAttack() > 0 then table.insert(available_stats, stats[1]) end if it_id:getDefense() > 0 then table.insert(available_stats, stats[2]) end if it_id:getExtraDefense() ~= 0 then table.insert(available_stats, stats[3]) end -- not available in 1.1 -- table.insert(available_stats, stats[10]) end else -- armors, amulets, runes and rings if it_id:getArmor() > 0 then table.insert(available_stats, stats[4]) end if it_id:getCharges() > 0 then table.insert(available_stats, stats[7]) end local eq_id = it_id:getTransformEquipId() if eq_id > 0 then table.insert(available_stats, stats[8]) end end end end if #available_stats > 0 then -- skips it all if it's empty local tier = math.random(1, #tiers) if #tiers[tier].chance > 0 then local statsStored = 0 local stats_used = {} for stat = 1, #tiers[tier].chance do if #available_stats > 0 then -- stops if no more stats available if stat - 1 == statsStored then -- checks when it's time to stop adding stats if math.random(1, 100000) <= tiers[tier].chance[stat] then statsStored = statsStored + 1 local selected_stat = math.random(1, #available_stats) table.insert(stats_used, available_stats[selected_stat]) table.remove(available_stats, selected_stat) end end end end if #stats_used > 0 then rares = rares + 1 local stat_desc = {} for stat = 1, #stats_used do local v = math.random( stats_used[stat][2].percent[1], stats_used[stat][2].percent[2] ) + math.random( tiers[tier].extra[1], tiers[tier].extra[2] ) local basestat = loot_attrToVal(it_u, stats_used[stat][1]) it_u:setAttribute(stats_used[stat][1], basestat + math.abs(basestat * v / 100)) table.insert(stat_desc, '[' .. stats_used[stat][2].name .. ': +' .. v .. '%]') end if tiers[tier].showattr then for stat = 1, #stats_used do it_u:setAttribute(ITEM_ATTRIBUTE_NAME, "[" .. stats_used[stat][2].prefix .. "]" .. it_u:getAttribute(ITEM_ATTRIBUTE_NAME)) end it_u:setAttribute(ITEM_ATTRIBUTE_NAME, it_u:getAttribute(ITEM_ATTRIBUTE_NAME) .. " " .. it_id:getName()) else it_u:setAttribute(ITEM_ATTRIBUTE_NAME, tiers[tier].prefix .. " " .. it_id:getName()) end it_u:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, table.concat(stat_desc, "\n")) end end end end end return rares end function find_loot_Container(pos) local rares = 0 local c = Tile(pos):getTopDownItem() if c ~= nil then if c:isContainer() then rares = rares + assign_loot_Stat(c) if rares > 0 then if rare_popup then local spectators = Game.getSpectators(pos, false, true, 7, 7, 5, 5) for i = 1, #spectators do spectators[i]:say(rare_text, TALKTYPE_MONSTER_SAY, false, spectators[i], pos) end end if rare_effect then pos:sendMagicEffect(rare_effect_id) end end return true end end end function onKill(player, target, lastHit) if (not isSummon(target)) then addEvent(find_loot_Container, 2, target:getPosition()) end return true end function onLogin(player) player:registerEvent("randomstats_loot") return true end Créditos : zbisu
  7. Tem duas versões, em forma de globalevent e talkaction GLOBAL EVENT -- globalevents.xml <globalevent type="startup" name="RainItems" script="rainitems.lua"/> rainitems.lua local config = { items = {{8306,1}, {2157,2}, {7735,1}, {8306,1}, {2184,1}, {9932,1}, {8306,1}, {9693,1}, {2148, 100}}, interval = 1000, -- time between checks areas = { [1] = { startHour = 19, startMin = 15, waves = 10, interval = 10000, chancePerTile = 10, -- % maxItemsPerWave = 15, from = {x = 1021, y = 994, z = 7}, to = {x = 1024, y = 998, z = 7} }, [2] = { startHour = 18, startMin = 43, waves = 10, interval = 10000, chancePerTile = 10, maxItemsPerWave = 15, from = {x = 1026, y = 995, z = 7}, to = {x = 1028, y = 1001, z = 7} } } } local executed = {} function Position.isPathable(pos) local tile = Tile(pos) if tile == nil then return false end return not tile:hasFlag(TILESTATE_BLOCKSOLID) end function rainWave(arena) local from = config.areas[arena].from local to = config.areas[arena].to local items_spawned = 0 for x = from.x, to.x do for y = from.y, to.y do for z = from.z, to.z do if math.random(1, 100) < config.areas[arena].chancePerTile and items_spawned < config.areas[arena].maxItemsPerWave then local pos = {x = x, y = y, z = z} if Position(pos):isPathable() then local item = math.random(1, #config.items) doCreateItem(config.items[item][1], math.random(1, config.items[item][2]), pos) Position(pos):sendMagicEffect(CONST_ME_MAGIC_RED) items_spawned = items_spawned + 1 end end end end end end function startRain(arena) broadcastMessage("Rain item event begins!") for i = 1, config.areas[arena].waves do if i == 1 then rainWave(arena) else addEvent(rainWave, config.areas[arena].interval * (i - 1), arena) end end addEvent(broadcastMessage, config.areas[arena].interval * (config.areas[arena].waves - 1), "Rain items event ended.") end function checkRain() local hour = tonumber(os.date("%H")) local min = tonumber(os.date("%M")) if not executed[hour] then executed[hour] = {} end for i = 1, #config.areas do if hour == config.areas[i].startHour and min == config.areas[i].startMin then if not executed[hour][min] then startRain(i) addEvent(checkRain, config.interval) executed[hour][min] = true end end if tonumber(os.date("%H", os.time() + (30 * 60))) == config.areas[i].startHour and tonumber(os.date("%M", os.time() + (30 * 60))) == config.areas[i].startMin then if not executed[hour][min] then broadcastMessage("Rain items event will start in 30 minutes.") addEvent(checkRain, config.interval) executed[hour][min] = true end end if tonumber(os.date("%H", os.time() + (1 * 60))) == config.areas[i].startHour and tonumber(os.date("%M", os.time() + (1 * 60))) == config.areas[i].startMin then if not executed[hour][min] then broadcastMessage("Rain items event will start in 1 minute.") addEvent(checkRain, config.interval) executed[hour][min] = true end end end addEvent(checkRain, config.interval) end function onStartup() addEvent(checkRain, 100) end TALK ACTION -- talkactions.xml <talkaction words="/rainitems" separator=" " script="rainitems_command.lua"/> rainitems_command.lua local config = { items = {{8306,1}, {2157,2}, {7735,1}, {8306,1}, {2184,1}, {9932,1}, {8306,1}, {9693,1}, {2148, 100}}, interval = 1000, -- time between checks areas = { [1] = { waves = 10, interval = 10000, chancePerTile = 10, -- % maxItemsPerWave = 15, from = {x = 1021, y = 994, z = 7}, to = {x = 1024, y = 998, z = 7} }, [2] = { waves = 10, interval = 10000, chancePerTile = 10, maxItemsPerWave = 15, from = {x = 1026, y = 995, z = 7}, to = {x = 1028, y = 1001, z = 7} } } } function Position.isPathable(pos) local tile = Tile(pos) if tile == nil then return false end return not tile:hasFlag(TILESTATE_BLOCKSOLID) end function rainWave(arena) local from = config.areas[arena].from local to = config.areas[arena].to local items_spawned = 0 for x = from.x, to.x do for y = from.y, to.y do for z = from.z, to.z do if math.random(1, 100) < config.areas[arena].chancePerTile and items_spawned < config.areas[arena].maxItemsPerWave then local pos = {x = x, y = y, z = z} if Position(pos):isPathable() then local item = math.random(1, #config.items) doCreateItem(config.items[item][1], math.random(1, config.items[item][2]), pos) Position(pos):sendMagicEffect(CONST_ME_MAGIC_RED) items_spawned = items_spawned + 1 end end end end end end function startRain(arena) broadcastMessage("Rain item event begins!") for i = 1, config.areas[arena].waves do if i == 1 then rainWave(arena) else addEvent(rainWave, config.areas[arena].interval * (i - 1), arena) end end addEvent(broadcastMessage, config.areas[arena].interval * (config.areas[arena].waves - 1), "Rain items event ended.") end function onSay(player, words, param) if not player:getGroup():getAccess() then return false end if tonumber(param) then startRain(tonumber(param)) else player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, words .. " eventid") end return false end Créditos : zbisu
  8. creaturescripts.xml <event type="advance" name="onadvance_reward" script="onadvance_reward.lua"/> <event type="login" name="onadv_register" script="onadvance_reward.lua"/> onadvance_reward.lua local rewards = { [SKILL_SWORD] = { {lvl = 150, items = {{2160, 2}, {2148, 1}}, storage = 54776}, {lvl = 160, items = {{2365, 2}}, storage = 54777} }, [SKILL_MAGLEVEL] = { {lvl = 100, items = {{2365, 2}}, storage = 54778}, }, [SKILL_LEVEL] = { {lvl = 480, items = {{2152, 2}}, storage = 54779}, }, } function onAdvance(player, skill, oldlevel, newlevel) local rewardstr = "Items received: " local reward_t = {} if rewards[skill] then for j = 1, #rewards[skill] do local r = rewards[skill][j] if not r then return true end if newlevel >= r.lvl then if player:getStorageValue(r.storage) < 1 then player:setStorageValue(r.storage, 1) for i = 1, #r.items do local itt = ItemType(r.items[i][1]) if itt then player:addItem(r.items[i][1], r.items[i][2]) table.insert(reward_t, itt:getName() .. (r.items[i][2] > 1 and " x" .. r.items[i][2] or "")) end end end end end if #reward_t > 0 then player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, rewardstr .. table.concat(reward_t, ", ")) end end return true end function onLogin(player) player:registerEvent("onadvance_reward") return true end
  9. Esse script vai mudar a sua mw para a sprite velha e vai funcionar da mesma forma: movements.xml <movevent event="StepIn" itemid="8753" script="mwstep.lua"/> mwstep.lua function onStepIn(creature, item, position, fromPosition) removeMw(creature:getPosition(), 8753, 1027) return true end \data\spells\scripts\support\magic wall rune.lua substituir o que tem dentro por : local id = 8753 local combat = Combat() combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_ENERGY) combat:setParameter(COMBAT_PARAM_CREATEITEM, id) function tile_timer(id, pos, delay, color) if getTileItemById(pos, id).uid == 0 then return true end if delay ~= 1 then addEvent(tile_timer, 1000, id, pos, delay - 1, color) end local people = Game.getSpectators(pos, 7, 7, 5, 5, false, true) if not people then return true end for i = 1, #people do people[i]:sendTextMessage(MESSAGE_EXPERIENCE, "Magic wall will disappear in " .. delay .. " second" .. (delay > 1 and "s" or "") .. ".", pos, delay, color) end end function removeMw(pos, mw, wall) local tile = Tile(pos) mw = tile:getItemById(mw) wall = tile:getItemById(wall) if mw then mw:remove() end if wall then wall:remove() end end function onCastSpell(creature, var, isHotkey) local c = combat:execute(creature, var) if c then local pos = variantToPosition(var) local wall = Game.createItem(1027, 1, pos) addEvent(removeMw, 20000, pos, id, wall:getId()) tile_timer(id, pos, 20, TEXTCOLOR_LIGHTBLUE) end return c end opcional : \data\spells\scripts\support\wild growth rune.lua substituir por : local id = ITEM_WILDGROWTH local combat = Combat() combat:setParameter(COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_EARTH) combat:setParameter(COMBAT_PARAM_CREATEITEM, id) function onCastSpell(creature, var, isHotkey) local c = combat:execute(creature, var) if c then local pos = variantToPosition(var) addEvent(removeMw, 40000, pos, id) tile_timer(id, pos, 40, TEXTCOLOR_LIGHTGREEN) end return c end Créditos: zbizu.
  10. Descrição : Você precisa de 2 pessoas para este mini-game. Você se posiciona sobre os azulejos e puxa a alavanca. Dentro da arena cada jogador irá receber um montro invocado, que irá, em seguida, atacar o inimigo e o monstro. O jogador mata o outro monstro ganha e será recompensada. Map: Mediafire: http://www.mediafire.com/download/qnnqj1rmilmrd5a/monsterarena.otbm actions.xml <action actionid="1500" script="monsterarena.lua"/> actions/scripts/monsterarena.lua MonsterArena = { fromPosition = { Position(1022, 1030, 7), Position(1024, 1030, 7) }, toPosition = { Position(1020, 1021, 7), Position(1022, 1021, 7) }, spawnPosition = { Position(1020, 1022, 7), Position(1022, 1020, 7) }, area = { from = Position(1015, 1016, 7), to = Position(1027, 1026, 7) }, exitPosition = Position(1022, 1028, 7), reward = {itemId = 2160, count = 10}, blockItemId = 3402, -- Only convincable / summonable monsters -- You can create custom monsters which are stronger and convincable monsters = {'Troll', 'Rat', 'Tortoise', 'Orc Berserker', 'Minotaur'}, event = 'MonsterArenaDeath', players = {} } function MonsterArena.hasPlayer(player) local position = player:getPosition() return position.x >= MonsterArena.area.from.x and position.y >= MonsterArena.area.from.y and position.x <= MonsterArena.area.to.x and position.y <= MonsterArena.area.to.y and position.z == MonsterArena.area.from.z end function MonsterArena.isOccupied() for _, pid in ipairs(MonsterArena.players) do local player = Player(pid) if player and MonsterArena.hasPlayer(player) then return true end end return false end function MonsterArena.clean() for i = 1, #MonsterArena.players do MonsterArena.players[i] = nil end end function onUse(player, item, fromPosition, target, toPosition, isHotkey) if item.itemid ~= 1945 then item:transform(1946) return true end if MonsterArena.isOccupied() then player:sendCancelMessage('The monster arena is currently occupied.') return true end local players = {} for _, fromPosition in ipairs(MonsterArena.fromPosition) do local creature = Tile(fromPosition):getTopCreature() if not creature or not creature:isPlayer() then player:sendCancelMessage('You need another player for the monster arena.') return true end table.insert(players, creature) end MonsterArena.clean() local summons = {} for i, player in ipairs(players) do player:teleportTo(MonsterArena.toPosition[i]) MonsterArena.fromPosition[i]:sendMagicEffect(CONST_ME_POFF) MonsterArena.toPosition[i]:sendMagicEffect(CONST_ME_TELEPORT) local monsterName = MonsterArena.monsters[math.random(#MonsterArena.monsters)] local monster = Game.createMonster(monsterName, MonsterArena.spawnPosition[i], true) monster:setMaster(player) monster:registerEvent(MonsterArena.event) table.insert(summons, monster) Game.createItem(MonsterArena.blockItemId, 1, MonsterArena.spawnPosition[i]) player:sendTextMessage(MESSAGE_INFO_DESCR, string.format('A %s is fighting for you this round!', monsterName)) table.insert(MonsterArena.players, player.uid) end players[1]:setTarget(summons[2]) players[2]:setTarget(summons[1]) item:transform(1945) return true end creaturescripts.xml <event type="death" name="MonsterArenaDeath" script="monsterarenadeath.lua"/> creaturescripts/scripts/monsterarenadeath.lua function onDeath(monster, corpse, killer, mostDamageKiller, unjustified, mostDamageUnjustified) local winnerPlayer = killer:getMaster() local loserPlayer = monster:getMaster() local reward = MonsterArena.reward if reward then winnerPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster won the fight and earned a reward for you!') winnerPlayer:addItem(reward.itemId, reward.count) else winnerPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster won the fight!') end loserPlayer:sendTextMessage(MESSAGE_INFO_DESCR, 'Your monster lost the fight!') winnerPlayer:teleportTo(MonsterArena.exitPosition) loserPlayer:teleportTo(MonsterArena.exitPosition) MonsterArena.exitPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE) for _, position in ipairs(MonsterArena.spawnPosition) do local item = Tile(position):getItemById(MonsterArena.blockItemId) if item then item:remove() end end killer:remove() return true end Créditos : Summ
  11. globalevents.xml: <globalevent name="text" interval="3500" script="text.lua"/> text.lua: [TFS 1.1] local effects = { {position = Position(995, 100, 7), text = 'Teleports', effect = CONST_ME_GROUNDSHAKER}, {position = Position(281, 254, 8), text = 'TP Room'}, -- text only {position = Position(307, 254, 1), text = 'Event', effect = CONST_ME_GROUNDSHAKER}, } function onThink(interval) for i = 1, #effects do local settings = effects[i] local spectators = Game.getSpectators(settings.position, false, true, 7, 7, 5, 5) if #spectators > 0 then if settings.text then for i = 1, #spectators do spectators[i]:say(settings.text, TALKTYPE_MONSTER_SAY, false, spectators[i], settings.position) end end if settings.effect then settings.position:sendMagicEffect(settings.effect) end end end return true end Para versões que não utilizam metatable : local fields = { {x = 995, y = 1000, z = 7, text = "Teleports", eff = CONST_ME_GROUNDSHAKER}, {x = 281, y = 254, z = 8, text = "TP Room"}, -- text only {x = 307, y = 254, z = 15, text = "Event", eff = CONST_ME_GROUNDSHAKER}, } function onThink(interval) for i = 1, #fields do local pos = fields[i] local people = getSpectators(pos, 7, 5, false, true) if people then if pos.text then doCreatureSay(people[1], pos.text, TALKTYPE_ORANGE_1, false, 0, pos) end if pos.eff then doSendMagicEffect(pos, pos.eff) end end end return true end Créditos : zbisu
  12. events.xml <event class="Creature" method="onTargetCombat" enabled="1" /> creature.lua event em baixo de : function Creature:onTargetCombat(target) adicionar : if not self then return true end if self:isPlayer() and target:isMonster() then target:registerEvent("extra_loot_d") end creaturescripts.xml <event type="death" name="extra_loot_d" script="extra_loot.lua"/> extra_loot.lua creaturescript local extra_loot = { {hasName = "dragon", items = { {id = 2152, count = 2, chance = 40000}, -- 40% {id = 2160, countMax = 4, chance = 10000} }}, {items = { {id = 2365, chance = 10000}, {id = 2392, chance = 1000} }}, } function Container:addExtraLoot(c, t) if t.hasName then local cn = c:getName():lower() local cm = t.hasName:lower() if not cn:match(cm) then return true end end for i = 1, #t.items do local count = 1 if t.items[i].count then if t.items[i].countMax then count = math.random(t.items[i].count, t.items[i].countMax) else count = t.items[i].count end else if t.items[i].countMax then count = math.random(1, t.items[i].countMax) end end if math.random(0, 100000) <= t.items[i].chance then self:addItem(t.items[i].id, count) end end end function onDeath(creature, corpse, killer, mostDamage, unjustified, mostDamage_unjustified) if not creature:isMonster() then return true end if corpse and corpse:isContainer() then for i = 1, #extra_loot do corpse:addExtraLoot(creature, extra_loot[i]) end end return true end Créditos : zbizu
  13. O sistema é simples ao upar cada level você ganha x pontos de habilidade, onde é possível com esse pontos, comprar mana, hp, skill, etc ... /creaturescripts/scripts/skillpoints.lua /creaturescripts/scripts/login.lua player:registerEvent("SkillPointSystem") /talkactions/scripts/skillpoints.lua <event type="modalwindow" name="PointWindow" script="skillpoints.lua"/> <event type="advance" name="SkillPointSystem" script="skillpoints.lua"/> /talkactions/scripts/skillpoints.lua function onSay(player, words, param) local SKILL_POINTS = 45200 local Point = ModalWindow(1, "Skill Points", "You have skill " ..player:getStorageValue(SKILL_POINTS).. " points make your choice:\n\n Skill Required Points Increase Amount") Point:addChoice(1, "1. Health 1 2") Point:addChoice(2, "2. Mana") Point:addChoice(3, "3. Magic Level") Point:addChoice(4, "4. Sword") Point:addChoice(5, "5. Axe") Point:addChoice(6, "6. Club") Point:addChoice(7, "7. Shielding") Point:addChoice(8, "8. Distance") Point:addButton(1, 'Gain 1') Point:addButton(2, 'Gain 2') Point:addButton(3, 'Gain 5') Point:addButton(4, 'Cancel') player:registerEvent("PointWindow") Point:sendToPlayer(player) return false end /talkactions/talkactions.xml <talkaction words="!points" separator=" " script="skillpoints.lua"/> Créditos : zbisu, codinabacl, ninja, MadMook
  14. Em data/globalevents/globalevents.XML adicione : <globalevent name="Znote Shop" interval="30000" script="znoteShop.lua"/> Em data/globalevents/scripts/ crie znoteShop.lua : function onThink(interval, lastExecution) local players = Game.getPlayers() if #players == 0 then -- 0 players online, no need to execute the script return true end local player for i = 1, #players do player = players[i] local orderQuery = db.storeQuery('SELECT `id`, `type`, `itemid`, `count` FROM `znote_shop_orders` WHERE `account_id` = '.. player:getAccountId() ..' LIMIT 1;') if orderQuery then --Lets check if the players online have orderd something from the shop local orderId = result.getDataInt(orderQuery, 'id') local orderType = result.getDataInt(orderQuery, 'type') local orderItemId = result.getDataInt(orderQuery, 'itemid') local orderCount = result.getDataInt(orderQuery, 'count') result.free(orderQuery) if orderType == 1 then if player:addItemEx(Game.createItem(orderItemId, orderCount or 1)) ~= RETURNVALUE_NOERROR or player:getFreeCapacity() < ItemType(orderItemId):getWeight(orderCount or 1) then --Lets check if player have slot or cape left. Else send to player inbox local parcel = player:getInbox():addItem(2596, 1, false, 1) if not parcel then --If not being able to create parcel we stop the script and retry again. print('[ERROR Znote Shop Globalevents] = Error on creating a parcel.') return true end local letter = parcel:addItem(2598, 1, false, 1) letter:setAttribute(ITEM_ATTRIBUTE_TEXT, 'You have received your shop item. Thanks for donating.') parcel:addItem(orderItemId, orderCount or 1, false, 1) end db.query('DELETE FROM `znote_shop_orders` WHERE `id` = '.. orderId ..';') player:sendTextMessage(MESSAGE_INFO_DESCR, 'Congratulations! You have received '.. orderCount ..'x '.. ItemType(orderItemId):getName() ..'!') end end end return true end Créditos Printer.
  15. É um sistema já conhecido da versão 7.4. Para instalar em seu servidor basta configurar, os script de acordo com o nome da pos da img abaixo : creaturescripts.xml <event type="preparedeath" name="pvparena" script="pvparena.lua"/> <event type="login" name="pvparena_r" script="pvparena.lua"/> pvparena.lua local arena = { frompos = {x = 1041, y = 985, z = 9}, topos = {x = 1052, y = 991, z = 9}, exitpos = {x = 1038, y = 988, z = 8} } function onPrepareDeath(player, lastHitKiller, mostDamageKiller) if player:isPlayer() then local ppos = player:getPosition() if isInRange(ppos, arena.frompos, arena.topos) then local maxhp = player:getMaxHealth() player:addHealth(maxhp) addEvent(doCreatureAddHealth, 100, player:getId(), maxhp) player:sendTextMessage(MESSAGE_STATUS_WARNING,"[Arena]: You lost the duel.") end if isInRange(ppos, arena.frompos, arena.topos) then player:teleportTo(arena.exitpos) return true end end return true end function onLogin(player) player:registerEvent("pvparena") return true end actions.xml <action uniqueid="6040" script="arenapvp.lua"/> pvparena.lua -- CONFIG BEGINS HERE -- local arena = { frompos = {x = 1041, y = 985, z = 9}, topos = {x = 1052, y = 991, z = 9}, exitpos = {x = 1038, y = 988, z = 8} } local checkpvparena = true -- checks if someone is blocking the arena local duel_limit = 15 * 60 -- in seconds local player1pos = {x = 1040, y = 987, z = 8} local leverpos = {x = 1040, y = 988, z = 8} local player2pos = {x = 1040, y = 989, z = 8} local nplayer1pos = {x = 1042, y = 988, z = 9} local nplayer2pos = {x = 1051, y = 988, z = 9} -- CONFIG ENDS HERE -- function lever_back(uid) doTransformItem(uid,1945) return true end function kick_r() if getCreaturesInQuestArea(TYPE_PLAYER, arena.frompos, arena.topos, GET_COUNT) > 1 then for a = arena.frompos.x, arena.topos.x do for b = arena.frompos.y, arena.topos.y do pos = {x=a,y=b,z=11,stackpos = 255} if(isPlayer(getTopCreature(pos).uid)) then doPlayerSendTextMessage(getTopCreature(pos).uid,MESSAGE_INFO_DESCR,"Time up. Round drawn.") doTeleportThing(getTopCreature(pos).uid,arena.exitpos) end end end end return true end local TYPE_PLAYER = 1 local TYPE_MONSTER = 2 local TYPE_NPC = 3 local TYPE_ALL = 4 local GET_COUNT = 1 local GET_UID = 2 function getCreaturesInQuestArea(type, fromPos, toPos, get, countSummon) local types = { [TYPE_PLAYER] = isPlayer, [TYPE_MONSTER] = isMonster, [TYPE_NPC] = isNpc, [TYPE_ALL] = isCreature } local tmp = {} local t = types[type] if not t then return print("[!] --> [Warning - Function::getCreaturesInQuestArea] Unknown type " .. (type or "(nil value)")) end local thing local pos for x = fromPos.x, toPos.x do for y = fromPos.y, toPos.y do for z = fromPos.z, toPos.z do pos = {x = x, y = y, z = z} thing = getTopCreature(pos) if t(thing.uid) then table.insert(tmp, thing.uid) if not countSummon and isSummon(thing.uid) then for i = 1, #tmp do if tmp[i] == thing.uid then table.remove(tmp, i) break end end end end end end end return (get == GET_COUNT and #tmp or get == GET_UID and tmp or print("[Warning - Function::getCreaturesInQuestArea] Unknown type to get " .. (get or "(nil value)"))) end function onUse(player, item, frompos, item2, topos) local cid = player:getId() if item.itemid == 1945 then if isPlayer(getTopCreature(player1pos).uid) == true and isPlayer(getTopCreature(player2pos).uid) == true then if checkpvparena then if getCreaturesInQuestArea(TYPE_PLAYER, arena.frompos, arena.topos, GET_COUNT) > 0 then if getCreaturesInQuestArea(TYPE_PLAYER, arena.frompos, arena.topos, GET_COUNT) == 1 then for c = arena.frompos.x, arena.topos.x do for d = arena.frompos.y, arena.topos.y do pos = {x=c,y=d,z=11, stackpos = 255} if(isPlayer(getTopCreature(pos).uid)) then doPlayerSendTextMessage(getTopCreature(pos).uid,MESSAGE_INFO_DESCR,"You have been kicked from the arena.") doTeleportThing(getTopCreature(pos).uid,arena.exitpos) end end end else arena_counter = getGlobalStorageValue(24510) - os.time() if arena_counter < 0 then for c = arena.frompos.x, arena.topos.x do for d = arena.frompos.y, arena.topos.y do pos = {x=c,y=d,z=11, stackpos = 255} if(isPlayer(getTopCreature(pos).uid)) then doPlayerSendTextMessage(getTopCreature(pos).uid,MESSAGE_INFO_DESCR,"You have been kicked from the arena.") doTeleportThing(getTopCreature(pos).uid,arena.exitpos) end end end else doCreatureSay(cid, "There is still active duel.\n" .. showTimeLeft(arena_counter, true) .. " left.\nPlease wait for your turn.", TALKTYPE_ORANGE_1) pvpaback = addEvent(lever_back, 5000, item.uid) return false end end end end -- let the match begin doSendMagicEffect(player1pos,CONST_ME_POFF) doSendMagicEffect(player2pos,CONST_ME_POFF) doPlayerSendTextMessage(getTopCreature(player1pos).uid,MESSAGE_STATUS_WARNING,"Fight!") doPlayerSendTextMessage(getTopCreature(player2pos).uid,MESSAGE_STATUS_WARNING,"Fight!") doTeleportThing(getTopCreature(player1pos).uid,nplayer1pos) doTeleportThing(getTopCreature(player2pos).uid,nplayer2pos) doSendMagicEffect(nplayer1pos,CONST_ME_TELEPORT) doSendMagicEffect(nplayer2pos,CONST_ME_TELEPORT) doTransformItem(getTileItemById(leverpos, 1945).uid,item.itemid+1) setGlobalStorageValue(24510,os.time() + duel_limit) pvpaback = addEvent(lever_back, 5000, item.uid) if arena_kick_r then stopEvent(arena_kick_r) end arena_kick_r = addEvent(kick_r, duel_limit * 1000) else doCreatureSay(cid, "You need two players to enter the arena.", TALKTYPE_ORANGE_1) pvpaback = addEvent(lever_back, 5000, item.uid) return false end else -- if timer or checking is offline player can push the lever manually if pvpaback then doPlayerSendDefaultCancel(cid, RETURNVALUE_CANNOTUSETHISOBJECT) else doTransformItem(getTileItemById(leverpos, 1946).uid,1945) end end return true end Créditos zbizu.
  16. Tópico movido para Lixeira Pública por conter link offline.
  17. Furabio

    Janela Popup

    Conteúdo já existente. Tópico movido para Lixeira Pública por conter link offline.
  18. Furabio

    Fortran 90/95

    Movido para a área correta.
  19. Furabio

    [Lua] Sockets

    Tópico movido para a área correta.
  20. Furabio

    [ Ripping ]

    Movido para a lixeira.
  21. Movido para a área correta.
  22. Movido para a área correta.
  23. Movido para a área correta.
  24. Movido para a área correta.
  25. Movido para a área correta.
  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...