Vlw amigo.
- Forums
- OTServ
- Recursos
- Scripting
- NPCs, monsters e raids
- Npc Que Edita Skills Um De Cada Vez
Npc Que Edita Skills Um De Cada Vez
By notle2012, 05 de ago. de 2012 in NPCs, monsters e raids
info
Group: Cavaleiro
Joined: 04/06/12
Posts: 188
Reputation: +22
Tibia Character: Muleke do Sangue

info
Group: Conde
Joined: 03/01/12
Posts: 884
Reputation: +233
Tibia Character: Segredo

Vlw amigo.
precisa tamos ai ![]()
Além de ser um NPC restrito aos servidores high-rate, acho que o script pode ser melhorado, trocando os vários if depois do primeiro por elseif, ou, melhor ainda, chamar uma tabela no script com a AI do NPC conforme a palavra-chave dita pelo jogador.
Enfim, obrigado pela colaboração.
info
Group: Campones
Joined: 26/08/19
Posts: 1
Reputation: 0

Em 05/08/2012 em 08:17, notle2012 disse:data\npc\NomedoNpc.xml
<npc name="NOMEDONPC" script="data/npc/scripts/nomedoarquivo.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Posso Te Editar Pensa Bem Oq Vc Quer Posso Oferecer Skills {fist}? {sword}? {axe}? {distance}? {shield}? {fishing}?." /> <parameter key="message_farewell" value="Tchau." /> <parameter key="message_walkaway" value="Tchau." /> </parameters> </npc>
data\npc\scripts\nomedoarquivo.lua
------------------- By Notle ------------------- local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) money = 100000 -------------- aqui vc coloca quantos de granas ps = 1 -- quantos skills de vez 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) if msgcontains(msg, 'fist') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,0,ps*10000000) selfSay("ok vou editar seu fist fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Fist Só Lamento.") end end if msgcontains(msg, 'club') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,1,ps*10000000) selfSay("ok vou editar seu club fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Club Só Lamento.") end end if msgcontains(msg, 'sword') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,2,ps*10000000) selfSay("ok vou editar seu sword fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Sword Só Lamento.") end end if msgcontains(msg, 'axe') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,3,ps*10000000) selfSay("ok vou editar seu axe fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Axe Só Lamento.") end end if msgcontains(msg, 'distance') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,4,ps*10000000) selfSay("ok vou editar seu distance fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Distance Só Lamento.") end end if msgcontains(msg, 'shield') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,5,ps*10000000) selfSay("ok vou editar seu shielding", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Sheld Só Lamento.") end end if msgcontains(msg, 'fishing') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,6,ps*10000000) selfSay("ok vou editar seu fishing", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill fishing Só Lamento.") end end return end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ------------------- By Notle -------------------
Espero Que Gostem Ate ++
desculpe-me reviver o tópico mas eu estou precisando de um npc parecido com o seu, mas estou precisando que ele dê skills temporarios "configuraveis" por exemplo comprar skill axe por uma hora, e após uma hora o skill comprado voltar ao que era antes... e de preferencia eu possa escolher a "moeda de troca" por exemplo, em vez de ser golds eu possa escolher um ou mais items aleatorios para pegar um skill.
seria bom se você pudesse tirar esse skill "fishing" e colocar o magic level. por favor se me ajudar será de grande ajuda!





info
Group: Conde
Joined: 03/01/12
Posts: 884
Reputation: +233
Tibia Character: Segredo
data\npc\NomedoNpc.xml
<npc name="NOMEDONPC" script="data/npc/scripts/nomedoarquivo.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="134" head="78" body="88" legs="0" feet="88" addons="3"/> <parameters> <parameter key="message_greet" value="Posso Te Editar Pensa Bem Oq Vc Quer Posso Oferecer Skills {fist}? {sword}? {axe}? {distance}? {shield}? {fishing}?." /> <parameter key="message_farewell" value="Tchau." /> <parameter key="message_walkaway" value="Tchau." /> </parameters> </npc>data\npc\scripts\nomedoarquivo.lua
------------------- By Notle ------------------- local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) money = 100000 -------------- aqui vc coloca quantos de granas ps = 1 -- quantos skills de vez 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) if msgcontains(msg, 'fist') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,0,ps*10000000) selfSay("ok vou editar seu fist fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Fist Só Lamento.") end end if msgcontains(msg, 'club') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,1,ps*10000000) selfSay("ok vou editar seu club fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Club Só Lamento.") end end if msgcontains(msg, 'sword') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,2,ps*10000000) selfSay("ok vou editar seu sword fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Sword Só Lamento.") end end if msgcontains(msg, 'axe') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,3,ps*10000000) selfSay("ok vou editar seu axe fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Axe Só Lamento.") end end if msgcontains(msg, 'distance') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,4,ps*10000000) selfSay("ok vou editar seu distance fightinhg", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Distance Só Lamento.") end end if msgcontains(msg, 'shield') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,5,ps*10000000) selfSay("ok vou editar seu shielding", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill Sheld Só Lamento.") end end if msgcontains(msg, 'fishing') then if doPlayerRemoveMoney(cid,money) then doPlayerAddSkillTry(cid,6,ps*10000000) selfSay("ok vou editar seu fishing", cid) else doPlayerSendCancel(cid,"Você Não Tem Grana, Não Posso Editar Seu Skill fishing Só Lamento.") end end return end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) ------------------- By Notle -------------------Espero Que Gostem Ate ++
Edited Agosto 5 by notle2012