Postado Março 4, 2012 13 anos TIpo assim queria por pra quando o player matace 100 demon ele ganhace a voc de id 21 so isso Ae ajudei? Rep+
Postado Março 4, 2012 13 anos Tente assim: (Não testado) Peguei como base o Script do usuário "ADMPianista" do tópico. Vamos lá... Crie um arquivo em data/creaturescripts/scripts, chamado "DemonVocation.lua" e cole isto dentro dele: local questCreatures = { ["demon"] = {questStarted = 1539, questStorage = 65029, creatureStorage = 15075, killsRequired = 200, raceName = "Demons"} } local msgType = MESSAGE_STATUS_CONSOLE_ORANGE function onKill(cid, target, lastHit) local creature = questCreatures[getCreatureName(target):lower()] if creature then if isPlayer(target) then return true end if getCreatureStorage(cid, creature.questStarted) > 0 then if getCreatureStorage(cid, creature.questStorage) < creature.killsRequired then if getCreatureStorage(cid, creature.questStorage) < 0 then doCreatureSetStorage(cid, creature.questStorage, 0) end if getCreatureStorage(cid, creature.creatureStorage) < 0 then doCreatureSetStorage(cid, creature.creatureStorage, 0) end doCreatureSetStorage(cid, creature.questStorage, getCreatureStorage(cid, creature.questStorage) + 1) doCreatureSetStorage(cid, creature.creatureStorage, getCreatureStorage(cid, creature.creatureStorage) + 1) doPlayerSendTextMessage(cid, msgType, getCreatureStorage(cid, creature.creatureStorage) .. " " .. getCreatureName(target) .. " defeated. Total [" .. getCreatureStorage(cid, creature.questStorage) .. "/" .. creature.killsRequired .. "] " .. creature.raceName .. ".") end end end return true end Salve e feche. Agora, na mesma pasta, abra o arquivo login.lua e cole isto nele : registerCreatureEvent(cid, "DemonVocation") Salve. Volte para data / creaturescripts e abra o arquivo creaturescripts.xml e agora cole o código abaixo: <event type="kill" name="DemonVocation" event="script" value="demonvocation.lua"/> @@Criando NPC' Agora vá em data/npc e crie um arquivo chamado Dean Berry.xml e dentro dele coloque: (Coloque o nome que desejar) <?xml version="1.0" encoding="UTF-8"?> <npc name="Dean Berry" script="data/npc/scripts/demonvocation.lua" access="3" walkinterval="2000" lookdir="2"> <mana now="800" max="800"/> <health now="200" max="200"/> <look type="144" head="97" body="97" legs="94" feet="97" addons="3"/> </npc> Abra data/npc/scripts e crie um arquivo chamado demonvocation.lua e dentro dele coloque: <script> <event name="KillingInTheNameOf"/> </script> Peguei do sistema de Task, mas se der algum erro aí me avise...preciso me ausentar agora. Obs: Caso alguém saiba fazer um NPC mais simples, ajude-nos aqui pois a maior parte do Script já foi feita' Abraços & boa sorte. local tasks = { [1] = {questStarted = 1539, questStorage = 65029, killsRequired = 200, raceName = "Demons", rewards = {{enable = true, type = "storage", values = {65535, 1}}}} } local rankStorage = 32150 local storage = 64521 local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} local voc = {} 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 function creatureSayCallback(cid, type, msg) local s = getCreatureStorage(cid, storage) if(not npcHandler:isFocused(cid)) then return false end local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_PRIVATE and 0 or cid if msgcontains(msg, "task") then if(s < 1) then doCreatureSetStorage(cid, storage, 1) s = getCreatureStorage(cid, storage) end if(getCreatureStorage(cid, rankStorage) < 1) then doCreatureSetStorage(cid, rankStorage, 0) end if tasks then if(getCreatureStorage(cid, tasks.questStarted) < 1) then if(getCreatureStorage(cid, tasks.creatureStorage) < 0) then doCreatureSetStorage(cid, tasks.creatureStorage, 0) end if(getCreatureStorage(cid, tasks.questStorage) < 0) then doCreatureSetStorage(cid, tasks.questStorage, 0) end doCreatureSetStorage(cid, tasks.questStarted, 1) selfSay("You have started the task number " .. getPlayerStorageValue(cid, storage) .. ", in this task you need to kill " .. tasks.killsRequired .. " " .. tasks.raceName .. ".", cid) else selfSay("You are currently making the task about " .. tasks.raceName .. ", task number " .. getPlayerStorageValue(cid, storage) .. ".", cid) end else print("[Warning - Error::Killing in the name of::Tasks config] Something is wrong.") end elseif msgcontains(msg, "report") then if tasks and tasks.questStarted > 0 then if(getCreatureStorage(cid, tasks.creatureStorage) < 0) then doCreatureSetStorage(cid, tasks.creatureStorage, 0) end if(getCreatureStorage(cid, tasks.questStorage) < 0) then doCreatureSetStorage(cid, tasks.questStorage, 0) end if(getCreatureStorage(cid, tasks.questStorage) >= tasks.killsRequired) then for i = 1, table.maxn(tasks.rewards) do if(tasks.rewards.enable) then if isInArray({"vocation", "demon", 1}, tasks[1].rewards.type) then doPlayerSetVocation(cid, 21) elseif isInArray({"storage", "stor", 5}, tasks.rewards.type) then doCreatureSetStorage(cid, tasks.rewards.values[1], tasks.rewards.values[2]) elseif isInArray({"points", "rank", 2}, tasks.rewards.type) then doCreatureSetStorage(cid, rankStorage, getCreatureStorage(cid, rankStorage) + tasks.rewards.values) else print("[Warning - Error::Killing in the name of::Tasks config] Bad reward type: " .. tasks.rewards.type .. ", reward could not be loaded.") end end end local rank = getCreatureStorage(cid, rankStorage) selfSay("Great!... you have finished the task number " .. s .. "" .. (rank > 4 and ", you are a " or "") .. "" .. (((rank > 4 and rank < 10) and ("Huntsman") or (rank > 9 and rank < 20) and ("Ranger") or (rank > 19 and rank < 30) and ("Big Game Hunter") or (rank > 29 and rank < 50) and ("Trophy Hunter") or (rank > 49) and ("Elite Hunter")) or "") .. ". Good job.", cid) doCreatureSetStorage(cid, storage, s + 1) else selfSay("Current " .. getCreatureStorage(cid, tasks.questStorage) .. " " .. tasks.raceName .. " killed, you need to kill " .. tasks.killsRequired .. ".", cid) end else selfSay("You do not have started any task.", cid) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Nossa, eu me embolei no NPC' Se der algum problema, tente adicionar esta tag no arquivo "Demon.lua" em Monsters. Editado Março 4, 2012 13 anos por Adriano SwaTT (veja o histórico de edições) Gosta do meu trabalho? Curta e siga a página do meu projeto de 2016 e 2017 (Lab Z Games) que trará vários servidores OTServs. Atenciosamente,Adriano Swatt' Para ver meus tutoriais acesse meu perfil.
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.