Demorei um cadin, mais ta ae..
Completa!!!!
(Obs: se você trocou os nomes dos items originais você terá que trocar na script também)
Script:
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) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
if msgcontains(msg, 'items') then
selfSay('Eu vendo {knight set}, {paladin set}, {mage set}, também vendo {crimson sword}, {spiked squelcher}, {glorious axe}, {blessed sceptre} e {queen sceptre}', cid)
elseif msgcontains(msg, 'knight set') then
if getPlayerItemCount(cid,2157) >= 20 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 20 gold nugget para comprar esse set.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 20 then
if doPlayerRemoveItem(cid,2157, 20) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 2501, 1)
doPlayerAddItem(cid, 2503, 1)
doPlayerAddItem(cid, 2404, 1)
doPlayerAddItem(cid, 9933, 1)
doPlayerAddItem(cid, 2524, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'paladin set') then
if getPlayerItemCount(cid,2157) >= 20 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 20 gold nugget para comprar esse set.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 20 then
if doPlayerRemoveItem(cid,2157, 20) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7885, 1)
doPlayerAddItem(cid, 7884, 1)
doPlayerAddItem(cid, 7886, 1)
doPlayerAddItem(cid, 7903, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'mage set') then
if getPlayerItemCount(cid,2157) >= 20 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 20 gold nugget para comprar esse set.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 20 then
if doPlayerRemoveItem(cid,2157, 20) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7902, 1)
doPlayerAddItem(cid, 7897, 1)
doPlayerAddItem(cid, 7896, 1)
doPlayerAddItem(cid, 7892, 1)
doPlayerAddItem(cid, 8900, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'crimson sword') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar essa sword.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7385, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'spiked squelcher') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar esse club.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7452, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'glorious axe') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar esse axe.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7454, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'blessed sceptre') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar essa wand/rod.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7429, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'queen sceptre') then
if getPlayerItemCount(cid,2157) >= 10 then
selfSay('você tem 20 gold nugget?', cid)
talk_state = 1
else
selfSay('você precisa de 10 gold nugget para comprar essa wand/rod.', cid)
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2157) >= 10 then
if doPlayerRemoveItem(cid,2157, 10) == TRUE then
selfSay(done, cid)
doPlayerAddItem(cid, 7410, 1)
end
else
selfSay(item, cid)
end
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 5) then
selfSay('Ok than.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Xml:
<npc name="Vilden" script="data/npc/scripts/vildencoin.lua" walkinterval="2000" floorchange="0" access="5" level="1" maglevel="1"><health now="150" max="150"/>
<look type="151" head="0" body="56" legs="132" feet="0" addons="3" corpse="2212"/>
<parameters>
<parameter key="module_shop" value="1" />
<parameter key="message_greet" value="Hello |PLAYERNAME|, eu vendo items vips por golden nugget diga {items} para mais informações." />
</parameters>
</npc>




info
Grupo: Campones
Registrado: 26/09/09
Posts: 1
Reputação: 0
Char no Tibia: Thunders Yackal
Olá pessoal sou novo nessas coisas de forúm e etc.. NÃO SEI SE ESTOU POSTANDO NO LUGAR CERTO SE NÃO ESTIVER POR FAVOR PEÇO QUE ME AUXILIEM
Bom vamos lá...
A alguns dias estou tendo problemas com um NPC do meu OT [Versão 8.50],é o seguinte ele é um npc que troca itens vip por "Gold Nugget" [iD=2157] mais a questão é que eu não consigo desenvolver essa script.
estive olhando alguns tutoriais que ensinavam isso (Aqui no xtibia mesmo) estou lembrado de ter visto o do XvX que ele explicava para um menino que pedia um script bem parecido com o meu e vi alguns outros também que não me recordo no momento.
mas todos esses tópicos funcionaram mais quando eu altero as falas do npc e os itens de troca ja não funciona mais.
Bom então gostaria muito de pedir para alguem fazer o script para mim ou me ensinar (dando pelo menos 2 exemplos)
Ele teria que ser +/- assim
[Falas]
Player=Hi
Npc=Olá... eu vendo os itens Vip se interessa em algum?
Player=yes
Npc=Bom,temos o [set knight],[set paladin] e o [mage] e temos também as weapons [axe],[sword],[club],[crossbow],[bolt],[wand] e a [rod]
Player=Set Knight {ai o npc da o set completo ID:2501,2503,2504,9933,2524} 20 Gold Nugget
Npc= aqui está seu set Vip Knight muito obrigado por donatar para o nosso serve
Player BYe
Npc=até logo volte sempre
Queria uma coisa +/- assim de preferencia faça com uns 2 exemplos plz mais se alguma boa alma quiser monta toda a script eu agradeço mesmo,agradeço de maisss mesmo
aqui tem os ids dos itens pra quem quiser monta toda a script ou uma parte dela
Set knight=2501,2503,2504,9933,2524 ->Shield
Set Paladin=7885,7884,7886,7903
Set Mage(Druid e Sorcerer)=7902,7897,7896,7892,8900 -> Shield
Sword=7385
Club=7452
axe=7454
wand=7429
rod=7410
Crossbow,bolt= Ainda não os fiz mais no lugar do id deles pode colocar XXXX que eu vou entender
BOM NÃO SEI SE TO ESQUECENDO NADA SE ESTIVER DEPOIS EU COLOCO OU MONTO OTRO TÓPICO.
AGRADEÇO DESDE JÁ A ATENÇÃO PESSO QUE POR FAVOR ME AJUDEM ESTOU PRECISANDO MUITO MESMO GALERA POR FAVOR ME AJUDEM
PEÇO A COOPERAÇÃO DE TODOSS PARA ME AJUDAR POSTANDO NESTE TÓPICO
AGRADECIDO DESDE JÁ!!!!
Editado Setembro 27 por ThunderBasilik