NO
npc

Npc Que Edita Skills Um De Cada Vez

Por notle2012, 05 de ago. de 2012 em NPCs, monsters e raids

npcs
scripts
script
c++
lua
tibia
edited
editado
editadoot
5
3.3k
notle2012N
05 de agosto de 2012 às 08:17

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 ++

Editado Agosto 5 por notle2012

TheSlayerT
05 de agosto de 2012 às 18:02

Vlw amigo.

notle2012N
05 de agosto de 2012 às 23:36

Vlw amigo.

precisa tamos ai rules.gif

OneshotO
12 de agosto de 2012 às 09:13

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.

7 anos depois...
hiquezerahH
26 de agosto de 2019 às 15:15
Em 05/08/2012 em 08:17, notle2012 disse:

data\npc\NomedoNpc.xml

 

  Mostrar conteúdo oculto

 

 


<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

 

  Mostrar conteúdo oculto

 

 


------------------- 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!