Ir para conteúdo

Featured Replies

Postado

Qual o motivo deste tópico? 

Npc que venda addons por KKs

 

Fla galera, tranquilo.

 

Queria editar um NPC que voce chegasse nele, pedia pelo outfit, addon 1 e depois addon 2, e ele te vendesse por KK's.

 

Esse é o arquivo do NPC Benjamin, que vende Parcel em Thais, como eu poderia editar ele pra ele vender Addons 1 e 2 por KKs, voce chega la e pede Assassin, Addon 1 e talz e ele te vende por dinheiro.

 

 

Como eu poderia editar ele pra vender os addons 1 e 2, no meu ot todos outfits ja estao liberados.

Citar

Dados no NPC Benjamin:

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Benjamin" script="Benjamin.lua" walkinterval="2000" floorchange="0">
    <health now="100" max="100" />
    <look type="128" head="116" body="79" legs="117" feet="76" addons="0" />
    <parameters>
        <parameter key="module_keywords" value="1" />
        <parameter key="keywords" value="mail;letters;explain;depot;parcel;explain;" />
        <parameter key="keyword_reply1" value="With our mail system you can send {letters} and {parcels} to other Tibians. I can either explain how {letters} and {parcels} work or sell them to you if you ask me for a {trade}." />
        <parameter key="keyword_reply2" value="If you want to buy a letter, ask me for a {trade}. Or do you want me to {explain} how letters work?" />
        <parameter key="keyword_reply3" value="With a letter you can send a message to another Tibian's {depot}. If you want to send it to 'Ben', use the letter - so that a form opens - and write 'Ben' in the first line. Write your message below that. ..." />
        <parameter key="keyword_reply4" value="Each major city has at least one depot. Just step in front of one of the lockers and you can store items inside. Your mail will also arrive there. Each city has its own storage, don't forget where you store items!" />
        <parameter key="keyword_reply5" value="If you want to buy a parcel, ask me for a {trade}. Or do you want me to {explain} how parcels work?" />
        <parameter key="keyword_reply6" value="In a parcel you can send items to another Tibian's {depot}. Put your items into the parcel and also place a completed {label} with the name of the {receiver} inside. Then drag your parcel on one of the blue {mailboxes} here to send it." />
        <parameter key="module_shop" value="1" />
        <parameter key="shop_buyable" value="label,2599,1;parcel,2595,15;letter,2597,8;" />
        <parameter key="message_sendtrade" value="Here. Don't forget that you need to buy a label too if you want to send a parcel. Always write the name of the {receiver} in the first line." />
    
    
    </parameters>
</npc>

 

Você tem o código disponível? Se tiver publique-o aqui: 

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui. 

https://ibb.co/pKWFYpP

  • Respostas 7
  • Visualizações 1.2k
  • Created
  • Última resposta

Top Posters In This Topic

Postado
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local config = {
  itemNeeded = 2160,
  count = 5,
  addonName = "Assassin",
  outfitId = 310,
  giveAddons = 2,
  storage = 3847,
}
			if (msgcontains(msg, config.addonName)) then
			if doPlayerRemoveItem(cid, config.itemNeeded, config.count) then else selfSay('Sorry, you need a '..config.count..' of '..getItemNameById(config.itemNeeded)..' for complet a my trade.', cid) end
			if getPlayerStorageValue(cid, config.storage) < 1 then else return selfSay('Sorry, you this have a addon of '..config.addonName..' Outfit.', cid) end
					  selfSay("Well I give you "..config.addonName..", the more you need to give me certain items do you accept this trade? ", cid)
					  talkState[talkUser] = 1
			elseif(msgcontains(msg, "yes")) and talkState[talkUser] == 1 then
					   selfSay("Thank you, you can look at your inventory of outfits.",cid)
					   talkState[talkUser] = 0
					   doPlayerAddOutfit(cid,config.outfitId, config.giveAddons)
					   setPlayerStorageValue(cid, config.storage, 1)
			end


return true
end

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

 

Postado
  • Autor
Agora, DdJs disse:

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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local config = {
  itemNeeded = 2160,
  count = 5,
  addonName = "Assassin",
  outfitId = 310,
  giveAddons = 2,
  storage = 3847,
}
			if (msgcontains(msg, config.addonName)) then
			if doPlayerRemoveItem(cid, config.itemNeeded, config.count) then else selfSay('Sorry, you need a '..config.count..' of '..getItemNameById(config.itemNeeded)..' for complet a my trade.', cid) end
			if getPlayerStorageValue(cid, config.storage) < 1 then else return selfSay('Sorry, you this have a addon of '..config.addonName..' Outfit.', cid) end
					  selfSay("Well I give you "..config.addonName..", the more you need to give me certain items do you accept this trade? ", cid)
					  talkState[talkUser] = 1
			elseif(msgcontains(msg, "yes")) and talkState[talkUser] == 1 then
					   selfSay("Thank you, you can look at your inventory of outfits.",cid)
					   talkState[talkUser] = 0
					   doPlayerAddOutfit(cid,config.outfitId, config.giveAddons)
					   setPlayerStorageValue(cid, config.storage, 1)
			end


return true
end

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

 

 

 

1 minuto atrás, DdJs disse:

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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local config = {
  itemNeeded = 2160,
  count = 5,
  addonName = "Assassin",
  outfitId = 310,
  giveAddons = 2,
  storage = 3847,
}
			if (msgcontains(msg, config.addonName)) then
			if doPlayerRemoveItem(cid, config.itemNeeded, config.count) then else selfSay('Sorry, you need a '..config.count..' of '..getItemNameById(config.itemNeeded)..' for complet a my trade.', cid) end
			if getPlayerStorageValue(cid, config.storage) < 1 then else return selfSay('Sorry, you this have a addon of '..config.addonName..' Outfit.', cid) end
					  selfSay("Well I give you "..config.addonName..", the more you need to give me certain items do you accept this trade? ", cid)
					  talkState[talkUser] = 1
			elseif(msgcontains(msg, "yes")) and talkState[talkUser] == 1 then
					   selfSay("Thank you, you can look at your inventory of outfits.",cid)
					   talkState[talkUser] = 0
					   doPlayerAddOutfit(cid,config.outfitId, config.giveAddons)
					   setPlayerStorageValue(cid, config.storage, 1)
			end


return true
end

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

 

 

Eu somente coloco abaixo de tudo o que ja ta, ou apago tudo o que ja esta no npc e colo o que voce me enviou?

Postado

@felipevaini Esse que mandei é um arquivo .lua, você tem que colocar no .lua do NPC. Esse outro seu ai é o XML do vendedor de parcel, que não recomendo usar para o mesmo npc. Melhor pegar um xml de um npc neutro que nao tenha nada coisas para vender e comprar no arquivo. 
 

Postado
  • Autor

@DdJs, eu coloquei sobre um npc, por ex, o npc Guide Luke e ja reiniciei o server, porem quando falo com ele, nao da a opcao de trade, de falar nada.

 

O lua do Npc ficou assim, ve se ficou correto.

 

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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local config = {
  itemNeeded = 2160,
  count = 5,
  addonName = "Assassin",
  outfitId = 310,
  giveAddons = 2,
  storage = 3847,
}
            if (msgcontains(msg, config.addonName)) then
            if doPlayerRemoveItem(cid, config.itemNeeded, config.count) then else selfSay('Sorry, you need a '..config.count..' of '..getItemNameById(config.itemNeeded)..' for complet a my trade.', cid) end
            if getPlayerStorageValue(cid, config.storage) < 1 then else return selfSay('Sorry, you this have a addon of '..config.addonName..' Outfit.', cid) end
                      selfSay("Well I give you "..config.addonName..", the more you need to give me certain items do you accept this trade? ", cid)
                      talkState[talkUser] = 1
            elseif(msgcontains(msg, "yes")) and talkState[talkUser] == 1 then
                       selfSay("Thank you, you can look at your inventory of outfits.",cid)
                       talkState[talkUser] = 0
                       doPlayerAddOutfit(cid,config.outfitId, config.giveAddons)
                       setPlayerStorageValue(cid, config.storage, 1)
            end


return true
end

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

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

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo