tricolorgaucho 2 Postado Junho 13, 2010 Share Postado Junho 13, 2010 Tipo do script: Npc Protocolo (versão do Tibia):8.54 Servidor utilizado: TFS Nível de experiência:acho que basico Adicionais/Informações: Primeiro NPC: quero o npc A Sweaty Cyclops que troca: 1 Boots of Haste por 1 Enchanted Chicken Wing 1 Giant Sword por 1 Huge Chunk of Crude Iron 1 Dragon Shield por 1 Piece of Draconian Steel 1 Crown Armor por 1 Piece of Royal Steel 1 Devil Helmet por 1 Piece of Hell Steel 2 Soul Orbs por 1 Infernal Bolt Segundo NPC: quero um npc de viagem Para que cidade o NPC vai levar o Player: Manniz Para onde o Player vai: x=1526, y=585, z=6} Nome do NPC: Unoz Custo da passagem: 130 Gold Coins Roupa do NPC: qualquer. bom é isso, se alguem puder me ajudar, agradeço!!! Link para o comentário https://xtibia.com/forum/topic/134906-pedido-dois-npcs/ Compartilhar em outros sites More sharing options...
matheus1000 11 Postado Junho 13, 2010 Share Postado Junho 13, 2010 2º vá em data/npc e crie um arquivo Catapult Manager.xml e bote: ?xml version="1.0"?> <npc name="Catapult Manager" script="data/npc/scripts/catapult.lua" access="3" walkinterval="0" floorchange="0"> <look type="247" head="20" body="30" legs="40" feet="50"/> <parameters> <parameter key="module_travel" value="1"/> <parameter key="message_greet" value="Blz |PLAYERNAME|. Quer ir para onde Demon3, Demon2, Demon, Dragon Lord, Warlock2, Warlock, Dragon, Hydra2, Hydra, Giant Spider, Orc, Undead Dragon, Behemoth, Pharao, Sea Serpent, Hand of Cursed Fate, Human Fortress?"/> <parameter key="travel_destinations" value="Maniz,1526,585,6,130"/> </parameters> </npc> Depois vá em data/npc/script e crie um arquivo chamado catapult.lua e bote isto: 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 npcHandler:addModule(FocusModule:new()) Link para o comentário https://xtibia.com/forum/topic/134906-pedido-dois-npcs/#findComment-890190 Compartilhar em outros sites More sharing options...
Dobol 26 Postado Junho 14, 2010 Share Postado Junho 14, 2010 (editado) NPC #1 *Olha, ele troca apenas 1 item por 1 item, caso você for usar esse, voce tem que fazer um NPC para cada troca de item, mais é o que eu sei fazer. /data/NPC - Copie qualquer arquivo, coloque o nome que desejar e coloque isso dentro: <npc name="Nome do NPC" script="data/npc/scripts/xxx.lua" access="5" lookdir="1"><health now="1000" max="1000"/> <look type="128" head="40" body="37" legs="116" feet="95" addons="0"/> <parameters> <parameter key="message_greet" value="Olá |PLAYERNAME|, eu posso trocar o item "xxx" pelo item "xxx" por "xxx"gps." /> </parameters> </npc> xxx - Nome do script que você vai usar, recomendo o nome do item um, exemplo "boots of haste". xxx - Nome do item um, exemplo "boots of haste". xxx - Nome do item dois, exemplo "Enchanted Chicken Wing". xxx - Preço que será cobrado, opcional por voce. Depois, vamos ao script, /data/npc/script e copie qualquer arquivo, quanto ao nome, coloque o nome do xxx. Apague tudo que estiver dentro e coloque isto: 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 if(msgcontains(msg, 'trocar') or msgcontains(msg, 'item')) then selfSay('Você desaja trocar um "item um" por "item dois"?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then if(getPlayerItemCount(cid, xxx) >= 1) then if(doPlayerRemoveMoney(cid, xxx) == TRUE) then doPlayerRemoveItem(cid, xxx, 1) doPlayerAddItem(cid, xxx) selfSay('Here you are.', cid) else selfSay('Desculpe, mas você não tem dinheiro...', cid) end else selfSay('Desculpe, mas você não tem "item um"..', cid) end talkState[talkUser] = 0 elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then talkState[talkUser] = 0 selfSay('Ok then.', cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) xxx - ID do item um. xxx - ID do item dois. xxx - Valor em Gold Coins, pode deichar 0. NPC #2 Vá em /data/npc, copie qualquer arquivo e coloque o nome que desejar. Apague tudo e coloque isso. <?xml version="1.0" encoding="UTF-8"?> <npc name="Unoz" script="data/npc/scripts/boat.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="151" head="79" body="114" legs="0" feet="115" addons="0"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. Posso te levar para a {Manniz}, você esta interessado?"/> </parameters> </npc> Depois em /data/npc/script, copie qualquer arquivo, coloque o nome de "boat", apague tudo e cole isso> local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'manniz'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Você deseja ir para a Manniz por 130 Moedas de Ouro ?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 130, destination = {x=1526, y=585, z=6} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Too expensive, eh?'}) keywordHandler:addKeyword({'lugares'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso te levar para 'Manniz' para onde deseja ir?.'}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) Bom, está ai, espero que tenha ajudado, caso eu consigo fazer o NPC #1 corretamente eu volto e explico, qualquer duvida, eu tentarei resolver. Sem mais, The Sleeper. Editado Junho 14, 2010 por TheSleeper Link para o comentário https://xtibia.com/forum/topic/134906-pedido-dois-npcs/#findComment-890471 Compartilhar em outros sites More sharing options...
tricolorgaucho 2 Postado Junho 14, 2010 Autor Share Postado Junho 14, 2010 @TheSleeper o NPC de viagem não funcionou, eu falo Hi, Manniz, e ele nao responde absolutamente nada Uzon: Daraman's blessings, traveller Player.Player: manniz depois que eu falo Manniz ele não responde mais nada, eu tento falar, Travel, Destination, e nada. se você conseguir me ajudar eu fico grato e quanto ao outro NPC eu ainda não teste, quando testar eu edito aqui mais valeu!!! Link para o comentário https://xtibia.com/forum/topic/134906-pedido-dois-npcs/#findComment-890561 Compartilhar em outros sites More sharing options...
matheus1000 11 Postado Junho 14, 2010 Share Postado Junho 14, 2010 (editado) @UP Tente o meu: 2º vá em data/npc e crie um arquivo Catapult Manager.xml e bote: ?xml version="1.0"?> <npc name="Catapult Manager" script="data/npc/scripts/catapult.lua" access="3" walkinterval="0" floorchange="0"> <look type="247" head="20" body="30" legs="40" feet="50"/> <parameters> <parameter key="module_travel" value="1"/> <parameter key="message_greet" value="Blz |PLAYERNAME|. Quer ir para onde Demon3, Demon2, Demon, Dragon Lord, Warlock2, Warlock, Dragon, Hydra2, Hydra, Giant Spider, Orc, Undead Dragon, Behemoth, Pharao, Sea Serpent, Hand of Cursed Fate, Human Fortress?"/> <parameter key="travel_destinations" value="Maniz,1526,585,6,130"/> </parameters> </npc> Depois vá em data/npc/script e crie um arquivo chamado catapult.lua e bote isto: 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 npcHandler:addModule(FocusModule:new()) Editado Junho 14, 2010 por MasterMathw Link para o comentário https://xtibia.com/forum/topic/134906-pedido-dois-npcs/#findComment-890768 Compartilhar em outros sites More sharing options...
Dobol 26 Postado Junho 15, 2010 Share Postado Junho 15, 2010 Tricolor gaucho, eu tenho outro npc de teleporte, irei mandar para você configurado. /Data/NPC copie qualquer arquivo, coloque o nome Unoz e substitua tudo por: <?xml version="1.0" encoding="UTF-8"?> <npc name="Unoz" script="data/npc/scripts/viagem.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="153" head="57" body="59" legs="40" feet="76" addons="0"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. Posso te vender uma {passage} para Manniz."/> </parameters> </npc> /data/npc/script copie qualquer arquivo, coloque o nome de viagem e substitua tudo por: local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'manniz'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para a Manniz por 150 gold coins?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 1500, destination = {x=1526, y=585, z=6} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'}) keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso te levar para {manniz} por um pequeno custo.'}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) Espero que esse funcione, totalmente configurado, só não sie porque não funcionou, eu uso os dois tipos de NPC em meu server, o de FREE e o de VIP. Link para o comentário https://xtibia.com/forum/topic/134906-pedido-dois-npcs/#findComment-891037 Compartilhar em outros sites More sharing options...
tricolorgaucho 2 Postado Junho 15, 2010 Autor Share Postado Junho 15, 2010 Tricolor gaucho, eu tenho outro npc de teleporte, irei mandar para você configurado. /Data/NPC copie qualquer arquivo, coloque o nome Unoz e substitua tudo por: <?xml version="1.0" encoding="UTF-8"?> <npc name="Unoz" script="data/npc/scripts/viagem.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="153" head="57" body="59" legs="40" feet="76" addons="0"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME|. Posso te vender uma {passage} para Manniz."/> </parameters> </npc> /data/npc/script copie qualquer arquivo, coloque o nome de viagem e substitua tudo por: local keywordHandler = KeywordHandler:new()local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) -- OTServ event handling functions start 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 -- OTServ event handling functions end -- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions! local travelNode = keywordHandler:addKeyword({'manniz'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Voce quer viajar para a Manniz por 150 gold coins?'}) travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 1, cost = 1500, destination = {x=1526, y=585, z=6} }) travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'I wouldn\'t go there either.'}) keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Eu posso te levar para {manniz} por um pequeno custo.'}) -- Makes sure the npc reacts when you say hi, bye etc. npcHandler:addModule(FocusModule:new()) Espero que esse funcione, totalmente configurado, só não sie porque não funcionou, eu uso os dois tipos de NPC em meu server, o de FREE e o de VIP. FUNCIONOU CARA VALEU!!!! Link para o comentário https://xtibia.com/forum/topic/134906-pedido-dois-npcs/#findComment-891057 Compartilhar em outros sites More sharing options...
Dobol 26 Postado Junho 15, 2010 Share Postado Junho 15, 2010 Cara, fico feliz em ajudar. Teste o NPC #1, pois se nõ funcionar eu procuro uma solução para você. Gratz. Link para o comentário https://xtibia.com/forum/topic/134906-pedido-dois-npcs/#findComment-891150 Compartilhar em outros sites More sharing options...
Posts Recomendados