Ir para conteúdo

Npc Nao Qer Vender Items


Carlinhow789

Posts Recomendados

alguem me ajuda ake

 

tem items no npc q nao vende pq ?

 

la o script ta assim

 

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 SellItemVip(cid, message, keywords, parameters, node)

if(not npcHandler:isFocused(cid)) then

return false

end

if doPlayerRemoveItem(cid,parameters.item,parameters.count) then

doPlayerAddItem(cid,parameters.reward,1)

npcHandler:say('Thanks for buy ' .. getItemNameById(parameters.reward) .. '!', cid)

else

npcHandler:say('Sorry, you don\'t have ' .. parameters.count .. ' ' .. getItemNameById(parameters.item) .. '!', cid)

end

 

npcHandler:resetNpc()

return true

end

 

local coin = 8300 -- id da sua coin

 

keywordHandler:addKeyword({'items'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can sell {medal of asgard}, {golden medal}, {bone medal}, {Medal of Slime}, {Star amulet [LVL4]}, {Star amulet [LVL3]}, {Star amulet [LVL2]} and {Star amulet} for ' .. getItemNameById(coin) .. 's.'})

local node1 = keywordHandler:addKeyword({'medal of asgard'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy medal of asgard for 8 ' .. getItemNameById(coin) .. 's ?'})

node1:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 8,reward = 10137})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

local node2 = keywordHandler:addKeyword({'golden medal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy golden medal for 7 ' .. getItemNameById(coin) .. 's ?'})

node2:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 7,reward = 10136})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

local node3 = keywordHandler:addKeyword({'bone medal'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy bone medal for 6 ' .. getItemNameById(coin) .. 's ?'})

node3:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 6,reward = 10140})

node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

local node4 = keywordHandler:addKeyword({'Medal of Slime'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Medal of Slime for 5 ' .. getItemNameById(coin) .. 's ?'})

node4:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 5,reward = 10138})

node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

local node5 = keywordHandler:addKeyword({'Star amulet [LVL4]'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Star amulet [LVL4] for 9 ' .. getItemNameById(coin) .. 's ?'})

node5:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 9,reward = 2131})

node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

local node6 = keywordHandler:addKeyword({'Star amulet'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Star amulet for 6 ' .. getItemNameById(coin) .. 's ?'})

node6:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 6,reward = 10135})

node6:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

local node7 = keywordHandler:addKeyword({'Star amulet [LVL2]'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Star amulet [LVL2] for 7 ' .. getItemNameById(coin) .. 's ?'})

node7:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 7,reward = 10134})

node7:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

local node8 = keywordHandler:addKeyword({'Star amulet [LVL3]'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want buy Star amulet [LVL3] for 8 ' .. getItemNameById(coin) .. 's ?'})

node8:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 8,reward = 10133})

node8:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ok, then.', reset = true})

 

 

npcHandler:addModule(FocusModule:new())

 

 

todos os amuletos e a medal of slime nao ta vendendo pq ?

8.6

 

assim q libera do rep +

Editado por Carlinhow789
Link para o comentário
Compartilhar em outros sites

Cheke se os id's dos itens estão corretos no script de acordo com o servidor:

 

node8:addChildKeyword({'yes'}, SellItemVip, {item = coin,count = 8,reward = 10133})

 

o numero que está em verde é o id do item.

vá em data/items/

abra o arquivo items.xml pelo bloco de notas, aperte control + F, insira o id de cada item e verifique se estão corretos.

 

se não for isso então nao faço ideia.

Link para o comentário
Compartilhar em outros sites

Primeiro:

 

Letras não podem estar em maiúsculas certo é

 

addKeyword({'medal of slime'}

 

e no caso dos star amulet,o nome não pode ser igual,por exemplo teria que ser

 

 

addKeyword({'star amulet'} -- certo

addKeyword({'outro nome amulet [LVL4]'} -- aqui teria que ser o nome de outro colar,pois iria retorna só "star amulet"

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...