aqui o npc 1
data\npc\scripts\nomedoarquivo.lua
tem que editar ja deixei pra vc configurar
------------------- By Notle -------------------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local troca = {
2163,100,
2160,50 -- aqui vc edita os ID do item que tem que ter e quantos
}
local id = 2160 --- id do item que vai ganhar dps da troca
local quant = 1 -- item que ganhar Contém quantos?
local sto = 1585 -- Storage
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, 'trocaitem') then
status = getPlayerStorageValue(cid,sto)
if status == -1 then
if doPlayerRemoveItem(cid,troca[1],troca[2]) and doPlayerRemoveItem(cid,troca[3],troca[4])then
doPlayerAddItem(cid,id,quant)
setPlayerStorageValue(cid,sto,1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "coloca um texto aqui") -- edita aqui
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você Não Contém Uns Dos Itens Não Posso Troca.") -- edita aqui
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não Pode Troca De novo")
end
return TRUE
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
data\npc\nomedoarquivo.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="Ola. Para mais informacoes de meus servicos diga {trocaitem}." />
<parameter key="message_farewell" value="Tchau." />
<parameter key="message_walkaway" value="Tchau." />
</parameters>
</npc>
edita os em red
local troca = {
2163,100,
2160,50 -- aqui vc edita os ID do item que tem que ter e quantos
}
local id = 2160 --- id do item que vai ganhar dps da troca
local quant = 1 -- item que ganhar Contém quantos?
NPC 2
------------------- By Notle -------------------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local troca = {
2160,20,
2161,30,
2162,10,
2163,5,
2164,1 -- aqui vc edita os ID do item que tem que ter e quantos
}
local id = {2160,2161} --- id do item que vai ganhar dps da troca
local qnt = {1,5} -- item que ganhar Contém quantos?
local sto = 7552 -- Storage
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, 'trocaitem') then
status = getPlayerStorageValue(cid,sto)
if status == -1 then
if doPlayerRemoveItem(cid,troca[1],troca[2]) and doPlayerRemoveItem(cid,troca[3],troca[4]) and doPlayerRemoveItem(cid,troca[5],troca[6]) and doPlayerRemoveItem(cid,troca[7],troca[8]) and doPlayerRemoveItem(cid,troca[9],troca[10]) then
doPlayerAddItem(cid,id[1],qnt[1])
doPlayerAddItem(cid,id[2],qnt[2])
setPlayerStorageValue(cid,sto,1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "coloca um texto aqui") -- edita aqui
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você Não Contém Uns Dos Itens Não Posso Troca.") -- edita aqui
end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não Pode Troca De novo")
end
return TRUE
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())






info
Grupo: Campones
Registrado: 01/12/08
Posts: 63
Reputação: +3
Char no Tibia: DELETADO
Pessoal estou mechendo com um globalfull 9.6 e quero saber como posso fazer um npc de troca!
Exemplo:
o Npc pega 100
Fish Fin e 50
Ape Fur e troca por 1
Huge Chunk of Crude Iron.
e tambem preciso de outro npc que troque. 20 Demon Dust
, 30 Vampire Dust
, 10 Iron Ore
, 5 Ankh
e 1 Spool of Yarn
ai ele troca tudo isso por 1 Soul Stone
e 5 Enchanted Chicken Wing
.
só quero saber como faço esses npc de troca para algumas quest q eu mesmo estou fazendo no meu servidor.
+REP pra quem me ajudar