Ir para conteúdo
  • Cadastre-se

[PEDIDO] npc de task diferente/simples/ para serve com rpg


Posts Recomendados

bom galera queria pedir um npc simples de task,porem o npc desse apenas 1 task por exemplo

 

player: hi

npc: ola [player] ando tendo problemas com esses malditos dwarf cavando tuneis poderia me ajuda?

player:sim

npc :va no subsolo e de uma lição a eles..voce aceitaria a tarefa de mata 300 dwarf para min ? eu te pagaria uma boa recompensa

player:sim

npc: boa sorte

 

ai o player vai e mata os 300 dwarf's (porem contase qualquer tipo de dwarf....solider, guard , comum )

 

voltase no npc 

 

player :hi

npc :você voltou vivo,conseguiu completa a tarefa?

player:sim

npc:  ok,tome sua recompensa (10000 de exp ,5 k ,dwarven legs)

player: bye

 

obs: gostatia que a configuração do npc fosse simples,para eu usar ele como base para criar varios npc's e espalha pelo mapas com diversas task's

Link para o post
Compartilhar em outros sites
  • 8 months later...

tenho o pressentimento de que é só vc configurar esse daqui: http://www.tibiaking.com/forum/topic/12151-simple-task-30/

Todos os meus trabalhos importantes estão na seção "Sobre mim" no meu perfil; Dá uma passada lá!

"Há três caminhos para o fracasso: não ensinar o que se sabe, não praticar o que se ensina, e não perguntar o que se ignora." - São Beda

I7Pm6ih.png

(obg ao @Beeny por fazer essa linda sign <3)

Link para o post
Compartilhar em outros sites

Fiz rapidinho, não testei.

 

NPC :.

 -- < Script by Frenesy > --
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}




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 doCreatureSayWithDelay(cid,text,type,delay,e)
   if delay<=0 then
      doCreatureSay(cid,text,type)
   else
      local func=function(pars)
                    doCreatureSay(pars.cid,pars.text,pars.type)
                    pars.e.done=TRUE
                 end
      e.done=FALSE
      e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e})
   end
end




function cancelNPCTalk(events)
  local ret=1
  for aux=1,table.getn(events) do
     if events[aux].done==FALSE then
        stopEvent(events[aux].event)
     else
        ret=ret+1
     end
  end
  events=nil
  return(ret)
end




function doNPCTalkALot(msgs,interval)
  local e={}
  local ret={}
  if interval==nil then interval=3000 end --3 seconds is default time between messages
  for aux=1,table.getn(msgs) do
      e[aux]={}
      doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux])
      table.insert(ret,e[aux])
  end
  return(ret)
end


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') or msgcontains(msg, 'task')) and getPlayerStorageValue(cid,1000) == -1 then -- Configura Storage Aqui
selfSay('Ola! Ando tendo problemas com esses malditos Dwarf cavando tuneis por ai. Poderia me ajuda?', cid)
talkState[talkUser] = 1


elseif((msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1) then
selfSay('Va no subsolo e mate 300 Dwarfs. Eu te pagarei uma boa recompensa.', cid)
talkState[talkUser] = 0


doSendMagicEffect(getPlayerPosition(cid), 13)
setPlayerStorageValue(cid, 1000, 1) -- Nao poder comecar esta task de novo
setPlayerStorageValue(cid, 1001, 0) -- Storage para ganhar Matando o Monstro
setPlayerStorageValue(cid, 1002, 1) -- Storage de acesso para matar o Monstro
setPlayerStorageValue(cid, 1003, 1) -- Storage de verificacao de quantos matou no NPC


elseif(msgcontains(msg, 'Task') or msgcontains(msg, 'task')) and getPlayerStorageValue(cid,1003) == 1 then
selfSay('Voce matou ate agora' .. getPlayerStorageValue(cid, 1001) .. ' Dwarfs', cid)


elseif(msgcontains(msg, 'Task') or msgcontains(msg, 'task')) and getPlayerStorageValue(cid,1001) == 300 then
selfSay('Você voltou vivo. Parabens! Aqui esta sua recompensa!', cid)


doSendMagicEffect(getPlayerPosition(cid), 13)
doPlayerAddItem(cid,2160, 1) -- Configure seu Item aqui (Basta clonar ele abaixo para adicionar mais itens)
doPlayerAddExperience(cid, 200) -- Configurar EXP ganha


setPlayerStorageValue(cid, 1001, -300) -- Remover Missão
setPlayerStorageValue(cid, 1002, -1) -- Remove Storage para ganhar Matando o Monstro
setPlayerStorageValue(cid, 1003, -1) -- Remove Storage de acesso para matar o Monstro


end 
return TRUE
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new()) 

Em CreatureScript/script adicione:

 

 -- < Script by Frenesy > --
function onKill(cid, target)
-------------------------
local storage = 1001
local Name = "Dwarfs" -- Configurar nome do monstro aqui.
-------------------------


    if getPlayerStorageValue(cid, 1002) == 1 and (getCreatureName(target) == Name) then
if getPlayerStorageValue(cid, storage) < 300 then  
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dwarfs Morto: " .. getPlayerStorageValue(cid, storage) .. "/300")
if getPlayerStorageValue(cid, storage) == 300 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Todos os Monstros da Quest foram Derrotados!") end


return TRUE
end
end
return TRUE
end

CreatureScript.xml

<event type="kill" name="AlterarAqui" script="script/NomeDoScriptAqui.lua"/>

Login

registerCreatureEvent(cid, "AlterarAqui")

Nos Monstros, adicione esta tag:

<script>
<event name="OMesmoQueNoLogin.lua"/>
</script>

Qualquer duvida na hora de configurar ...

Abraços !!

Editado por Frenesy (veja o histórico de edições)

cms1-pr%C3%AAmio.png

Link para o post
Compartilhar em outros sites
  • 3 months later...

Fiz rapidinho, não testei.

 

NPC :.

 -- < Script by Frenesy > --
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}




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 doCreatureSayWithDelay(cid,text,type,delay,e)
   if delay<=0 then
      doCreatureSay(cid,text,type)
   else
      local func=function(pars)
                    doCreatureSay(pars.cid,pars.text,pars.type)
                    pars.e.done=TRUE
                 end
      e.done=FALSE
      e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e})
   end
end




function cancelNPCTalk(events)
  local ret=1
  for aux=1,table.getn(events) do
     if events[aux].done==FALSE then
        stopEvent(events[aux].event)
     else
        ret=ret+1
     end
  end
  events=nil
  return(ret)
end




function doNPCTalkALot(msgs,interval)
  local e={}
  local ret={}
  if interval==nil then interval=3000 end --3 seconds is default time between messages
  for aux=1,table.getn(msgs) do
      e[aux]={}
      doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux])
      table.insert(ret,e[aux])
  end
  return(ret)
end


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') or msgcontains(msg, 'task')) and getPlayerStorageValue(cid,1000) == -1 then -- Configura Storage Aqui
selfSay('Ola! Ando tendo problemas com esses malditos Dwarf cavando tuneis por ai. Poderia me ajuda?', cid)
talkState[talkUser] = 1


elseif((msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1) then
selfSay('Va no subsolo e mate 300 Dwarfs. Eu te pagarei uma boa recompensa.', cid)
talkState[talkUser] = 0


doSendMagicEffect(getPlayerPosition(cid), 13)
setPlayerStorageValue(cid, 1000, 1) -- Nao poder comecar esta task de novo
setPlayerStorageValue(cid, 1001, 0) -- Storage para ganhar Matando o Monstro
setPlayerStorageValue(cid, 1002, 1) -- Storage de acesso para matar o Monstro
setPlayerStorageValue(cid, 1003, 1) -- Storage de verificacao de quantos matou no NPC


elseif(msgcontains(msg, 'Task') or msgcontains(msg, 'task')) and getPlayerStorageValue(cid,1003) == 1 then
selfSay('Voce matou ate agora' .. getPlayerStorageValue(cid, 1001) .. ' Dwarfs', cid)


elseif(msgcontains(msg, 'Task') or msgcontains(msg, 'task')) and getPlayerStorageValue(cid,1001) == 300 then
selfSay('Você voltou vivo. Parabens! Aqui esta sua recompensa!', cid)


doSendMagicEffect(getPlayerPosition(cid), 13)
doPlayerAddItem(cid,2160, 1) -- Configure seu Item aqui (Basta clonar ele abaixo para adicionar mais itens)
doPlayerAddExperience(cid, 200) -- Configurar EXP ganha


setPlayerStorageValue(cid, 1001, -300) -- Remover Missão
setPlayerStorageValue(cid, 1002, -1) -- Remove Storage para ganhar Matando o Monstro
setPlayerStorageValue(cid, 1003, -1) -- Remove Storage de acesso para matar o Monstro


end 
return TRUE
end


npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new()) 

Em CreatureScript/script adicione:

 

 -- < Script by Frenesy > --
function onKill(cid, target)
-------------------------
local storage = 1001
local Name = "Dwarfs" -- Configurar nome do monstro aqui.
-------------------------


    if getPlayerStorageValue(cid, 1002) == 1 and (getCreatureName(target) == Name) then
if getPlayerStorageValue(cid, storage) < 300 then  
setPlayerStorageValue(cid, storage, getPlayerStorageValue(cid, storage)+1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Dwarfs Morto: " .. getPlayerStorageValue(cid, storage) .. "/300")
if getPlayerStorageValue(cid, storage) == 300 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Todos os Monstros da Quest foram Derrotados!") end


return TRUE
end
end
return TRUE
end

CreatureScript.xml

<event type="kill" name="AlterarAqui" script="script/NomeDoScriptAqui.lua"/>

Login

registerCreatureEvent(cid, "AlterarAqui")

Nos Monstros, adicione esta tag:

<script>
<event name="OMesmoQueNoLogin.lua"/>
</script>

Qualquer duvida na hora de configurar ...

Abraços !!

 

 

Frenesy estou tentando configurar esse script mas essa ultima tag eu coloco no xml do monstro que tem que matar?

pq se for ta dando um erro aqui : UNKNOWN EVENT NAME

 

o que pode ser?

Link para o post
Compartilhar em outros sites

Frenesy estou tentando configurar esse script mas essa ultima tag eu coloco no xml do monstro que tem que matar? pq se for ta dando um erro aqui : UNKNOWN EVENT NAME

 

Exatamente!

Coloque essa tag no monstro. 

cms1-pr%C3%AAmio.png

Link para o post
Compartilhar em outros sites

Exatamente!

Coloque essa tag no monstro. 

Então como eu disse coloquei a tag no monstro e dá esse erro no xml do monstro : UNKNOWN EVENT NAME

 

pelo erro acredito que tenho que registrar ele em algum lugar para que ele não ocorra... só que eu não sei onde...  :(

 

--------------------------------------------------

 

 

<event name="OMesmoQueNoLogin.lua"/> acho que esse era o erro

 

Editado por Prizzee (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

Então como eu disse coloquei a tag no monstro e dá esse erro no xml do monstro : UNKNOWN EVENT NAME

 

pelo erro acredito que tenho que registrar ele em algum lugar para que ele não ocorra... só que eu não sei onde...  :(

 

--------------------------------------------------

 

 

<event name="OMesmoQueNoLogin.lua"/> acho que esse era o erro

 

bem consegui corrigir o erro o evento desconhecido tirando esse .lua da tag no monstro

falo com o npc adiciono a task tudo certinho só que quando eu mato o monstro dá esse erro aqui:

 

359w8yh.png

 

sendo assim não começa a contar quantos monstros matei... ):

Editado por Prizzee (veja o histórico de edições)
Link para o post
Compartilhar em outros sites

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.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo