Postado Maio 6, 2015 10 anos Como fazer uma continuação disso: if msgcontains(msg, 'items') then npcHandler:say('I sell items for gold nuggets, i have: {boots of waterwalking}, {furious frock}, {umbral master spellbook}, {umbral master crossbow}, {umbral master slayer}, {umbral master chopper}, {umbral master hammer}, {umbral master bow}, {umbral master mace}, {umbral master axe}, {umbral masterblade}, {change sex}, {remover skull}, {sweet mangonaise elixir}.', cid) Ex: coloco pra quando o player falar items ai aparece isso, tudo certo, mas quando tento colocar outros pra o player falar outras coisas e o npc falar outras coisas da um erro na distro ou não funciona. Alguém sabe como proceder? TFS 1.0 Editado Maio 6, 2015 10 anos por arthur122222 (veja o histórico de edições)
Postado Maio 6, 2015 10 anos Administrador Coloque todo o script do npc TibiaKing Team- KingTópicos www.tibiaking.com
Postado Maio 6, 2015 10 anos Autor 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 local item = 'I\'m sorry, but you do not have the required items for this trade.' local done = 'Here you are, thank you for your business.' function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end if msgcontains(msg, 'items') then npcHandler:say('I sell items for gold nuggets, i have: {boots of waterwalking}, {furious frock}, {umbral master spellbook}, {umbral master crossbow}, {umbral master slayer}, {umbral master chopper}, {umbral master hammer}, {umbral master bow}, {umbral master mace}, {umbral master axe}, {umbral masterblade}, {change sex}, {remover skull}, {sweet mangonaise elixir}.', cid) elseif msgcontains(msg, 'boots of waterwalking') then if getPlayerItemCount(cid,2157) >= 25 then npcHandler:say('Did you bring me the 25 bar of golds?', cid) npcHandler.topic[cid] = 1 else npcHandler:say('I need a {25 bar of golds}, to give you one boots of waterwalking. Please come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 25 then if doPlayerRemoveItem(cid,2157, 25) == TRUE then npcHandler:say(done, cid) doPlayerAddItem(cid, 2358, 1) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'furious frock') then if getPlayerItemCount(cid,2157) >= 10 then npcHandler:say('Did you bring me the 10 bar of golds?', cid) npcHandler.topic[cid] = 2 else npcHandler:say('I need a {10 bar of golds}, to give you the furious frock. Come back when you have it.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 2 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 10 then if doPlayerRemoveItem(cid,2157,10) == TRUE then npcHandler:say(done, cid) doPlayerAddItem(cid,21725,1) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral master spellbook') then if getPlayerItemCount(cid,2157) >= 15 then npcHandler:say('Did you bring me 15 bar of golds?', cid) npcHandler.topic[cid] = 3 else npcHandler:say('I need {10 bar of golds}, to give you the umbral master spellbook. Come back when you have it.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 3 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 15 then if doPlayerRemoveItem(cid,2157,15) == TRUE then doPlayerAddItem(cid,22424,1) npcHandler:say(done, cid) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral master crossbow') then if getPlayerItemCount(cid,2157) >= 15 then npcHandler:say('Did you bring me 15 bar of golds?', cid) npcHandler.topic[cid] = 4 else npcHandler:say('I need {15 bar of golds}, to give you the umbral master crossbow. Come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 4 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 15 then if doPlayerRemoveItem(cid,2157,15) == TRUE then doPlayerAddItem(cid,22421,1) npcHandler:say(done, cid) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral master slayer') then if getPlayerItemCount(cid,2157) >= 15 then npcHandler:say('Did you bring me 15 bar of golds?', cid) npcHandler.topic[cid] = 5 else npcHandler:say('I need {10 bar of golds}, to give you the umbral master slayer. Come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 5 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 15 then if doPlayerRemoveItem(cid,2157,15) == TRUE then doPlayerAddItem(cid,22403,1) npcHandler:say(done, cid) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral master chopper') then if getPlayerItemCount(cid,2157) >= 15 then npcHandler:say('Did you bring me 15 bar of golds?', cid) npcHandler.topic[cid] = 6 else npcHandler:say('I need {15 bar of golds}, to give you the umbral master chopper. Come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 6 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 15 then doPlayerRemoveItem(cid,2157,15) doPlayerAddItem(cid,22409,1) npcHandler:say(done, cid) else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral master hammer') then if getPlayerItemCount(cid,2157) >= 15 then npcHandler:say('Did you bring me 15 bar of golds?', cid) npcHandler.topic[cid] = 7 else npcHandler:say('I need a {15 bar of golds}, to give you the umbral master hammer. Come back when you have it.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 7 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 15 then if doPlayerRemoveItem(cid,2157,15) == TRUE then doPlayerAddItem(cid,22415,1) npcHandler:say(done, cid) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral master bow') then if getPlayerItemCount(cid,2157) >= 15 then npcHandler:say('Did you bring me 15 bar of golds?', cid) npcHandler.topic[cid] = 8 else npcHandler:say('I need a {15 bar of golds}, to give you the umbral master bow. Come back when you have it.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 8 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 15 then if doPlayerRemoveItem(cid,2157,15) == TRUE then doPlayerAddItem(cid,22418,1) npcHandler:say(done, cid) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral master mace') then if getPlayerItemCount(cid,2157) >= 12 then npcHandler:say('Did you bring me the 12 bar of golds?', cid) npcHandler.topic[cid] = 9 else npcHandler:say('I need a {12 bar of golds}, to give you the umbral master mace. Come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 9 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 12 then if doPlayerRemoveItem(cid,2157,12) == TRUE then doPlayerAddItem(cid,22412,1) npcHandler:say(done, cid) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral master axe') then if getPlayerItemCount(cid,2157) >= 12 then npcHandler:say('Did you bring me the 12 bar of golds?', cid) npcHandler.topic[cid] = 10 else npcHandler:say('I need a {12 bar of golds}, to give you one umbral master axe. Please come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 10 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 12 then if doPlayerRemoveItem(cid,2157, 12) == TRUE then npcHandler:say(done, cid) doPlayerAddItem(cid, 22406, 1) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'umbral masterblade') then if getPlayerItemCount(cid,2157) >= 12 then npcHandler:say('Did you bring me the 12 bar of golds?', cid) npcHandler.topic[cid] = 11 else npcHandler:say('I need a {12 bar of golds}, to give you one umbral masterblade. Please come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 11 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 12 then if doPlayerRemoveItem(cid,2157, 12) == TRUE then npcHandler:say(done, cid) doPlayerAddItem(cid, 22400, 1) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'change sex') then if getPlayerItemCount(cid,2157) >= 5 then npcHandler:say('Did you bring me the 5 bar of golds?', cid) npcHandler.topic[cid] = 12 else npcHandler:say('I need a {5 bar of golds}, to give you one change sex. Please come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 12 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 5 then if doPlayerRemoveItem(cid,2157, 5) == TRUE then npcHandler:say(done, cid) doPlayerAddItem(cid, 21400, 1) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'remover skull') then if getPlayerItemCount(cid,2157) >= 5 then npcHandler:say('Did you bring me the 5 bar of golds?', cid) npcHandler.topic[cid] = 13 else npcHandler:say('I need a {5 bar of golds}, to give you one remover skull. Please come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 13 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 5 then if doPlayerRemoveItem(cid,2157, 5) == TRUE then npcHandler:say(done, cid) doPlayerAddItem(cid, 21399, 1) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'sweet mangonaise elixir') then if getPlayerItemCount(cid,2157) >= 10 then npcHandler:say('Did you bring me the 10 bar of golds?', cid) npcHandler.topic[cid] = 14 else npcHandler:say('I need a {10 bar of golds}, to give you one sweet mangonaise elixir. Please come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 14 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= 10 then if doPlayerRemoveItem(cid,2157, 10) == TRUE then npcHandler:say(done, cid) doPlayerAddItem(cid, 12544, 1) end else npcHandler:say(item, cid) end elseif msgcontains(msg, 'no') and npcHandler.topic[cid] >= 1 and npcHandler.topic[cid] <= 15 then npcHandler:say('Well, then leave.') npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Maio 6, 2015 10 anos Administrador Primeiro adicione na linha com o nome do item que voce quer {item que voce quer adicionar}, Pelo que entendi voce precisa criar uma linha dessa elseif msgcontains(msg, 'Nome do item que voce colocou acima') then if getPlayerItemCount(cid,2157) >= preço do item por barras de ouro then npcHandler:say('Did you bring me the preço do item por barras de ouro bar of golds?', cid) npcHandler.topic[cid] = 1 else npcHandler:say('I need a {preço do item por barras de ouro bar of golds}, to give you one nome do item que voce colocou acima. Please come back when you have them.', cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then npcHandler.topic[cid] = 0 if getPlayerItemCount(cid,2157) >= quantidade de barras de ouro para trocar then if doPlayerRemoveItem(cid,2157, quantidade de barras de ouro para remover) == TRUE then npcHandler:say(done, cid) doPlayerAddItem(cid, id do item que o jogador ira ganhar, quantidade do item que o jogador ira ganhar) Editado Maio 6, 2015 10 anos por Erimyth (veja o histórico de edições) TibiaKing Team- KingTópicos www.tibiaking.com
Postado Maio 6, 2015 10 anos Autor Não, olha: falo hi pro npc, ai aquele "items" lá em cima está programa do pra quando eu falar items ele mostra uma lista de items que estão a venda, ai eu queria adicionar outra palavra como "addon" e outra como "mount" para aparecer os addons e mounts que estão a venda. if msgcontains(msg, 'items') then npcHandler:say('I sell items for gold nuggets, i have: {boots of waterwalking}, {furious frock}, {umbral master spellbook}, {umbral master crossbow}, {umbral master slayer}, {umbral master chopper}, {umbral master hammer}, {umbral master bow}, {umbral master mace}, {umbral master axe}, {umbral masterblade}, {change sex}, {remover skull}, {sweet mangonaise elixir}.', cid) essa é quando eu falo items, tentei colocar outras pra que com outras falas ele fale outras coisas como a do item ai.
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.