Postado Outubro 29, 2017 7 anos Autor @xMateuss Primeira coisa crie um npc com qualquer nome. (.XML e .LUA). no arquivo npc.lua adicione o seguinte código. Mostrar conteúdo oculto local STORAGE = 20015 local STORAGE2 = 20016 local STORAGE3 = 20017 local ITEMR = ID DO ITEM DA RECONPENSA local EXP = quantidade de experiencia que vai ganhar local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg:lower()) end function onThink() npcHandler:onThink() end local talkState = {} function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, "task") then if getPlayerStorageValue(cid, STORAGE) == -1 then npcHandler:say("Voce está pronto para matar 100 {Rotworms} ?", cid) setPlayerStorageValue(cid, STORAGE, 1) elseif getPlayerStorageValue(cid, STORAGE2) == 1 and getPlayerStorageValue(cid, STORAGE3) == -1 then npcHandler:say("Parabéns! Voce concluiu a task dos {rotworms}.", cid) doPlayerAddExp(cid, EXP) doPlayerAddItem(cid,ITEMR, 1) setPlayerStorageValue(cid, STORAGE3, 1) else npcHandler:say("desculpe nao e possivel", cid) end elseif msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then if storage == 1 then npcHandler:say("Está certo volte quando matar 100 {Rotworms}.", cid) setPlayerStorageValue(cid, STORAGE2, 101) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) agora faça da seguinte forma : Em data/creaturescripts/creaturescripts.xml deixe estas tags: Mostrar conteúdo oculto <event type="kill" name="minitask" event="script" value="minitask.lua"/> <event type="login" name="minitasklogin" event="script" value="minitasklogin.lua"/> Agora os scripts lua... minitask.lua Mostrar conteúdo oculto local config = { ['Rotworm] = 20016, --["nome do monstro"] = storage ['Dragon'] = 20017 } function onKill(cid, target) local v = getPlayerStorageValue(cid,config[getCreatureName(target)]) if v > 1 then setPlayerStorageValue(cid, config[getCreatureName(target)], v - 1) end return true end minitasklogin.lua Mostrar conteúdo oculto function onLogin(cid) registerCreatureEvent(cid, "minitask") return true end Credito dos arquivos luas tirando o NPC vai para @antharaz Editado Outubro 29, 2017 7 anos por Everson Miranda (veja o histórico de edições)
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.