Postado Fevereiro 17, 2016 9 anos Fala galerinha! Estou precisando muito de um NPC que venda um item por uma moeda diferente (Barras de Ouro) Meu servidor é TFS 1.2 Achei alguns NPCs como eu queria mas na hora que eu digo o nome do item que vou comprar pelas barras, o NPC não entrega o item e nem pega as barras de ouro. Ficarei muito grato a quem puder me ajudar. *** 10 Barras -> Soft Boots 5 Barras -> Demon Armor (Quero poder colocar mais de um item a venda nesse NPC) Abração!
Postado Fevereiro 18, 2016 9 anos 1º Em npc crie um arquvo com nome Contrabandista.xml e cole Spoiler <?xml version="1.0" encoding="UTF-8"?> <npc name="Xablau" script="Contrabandista.lua" walkinterval="350000" floorchange="0" speed="0"> <health now="100" max="100"/> <look type="2200" head="20" body="100" legs="50" feet="0"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME| Eu vendo {demon armor}, {soft boots} esta interessado em algo?"/> </parameters> </npc> 2º Em npc/scripts crie um arquivo Contrabandista.lua e cole Spoiler 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 msg = string.lower(msg) --------- local need = { {id = 15515, qt = 5}, --Barras de Ouro } local rewards = { {id = 3888, qt = 1}, --Demon Armor } local stoFinish = 92119 --------- if msgcontains(msg, 'Demon armor') or msgcontains(msg, 'demon armor') then if getPlayerStorageValue(cid, stoFinish) >= 99 then selfSay("Sorry, you already had done this quest.", cid) talkState[talkUser] = 0 return true end selfSay("Gostaria de trocar 5 Barras de Ouro por uma Demon Armor? Diga {buy demon}",cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, 'buy demon') or msgcontains(msg, 'comprar Demon') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("Você não me trouxe as Barras de Ouro...", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need.id, need.qt) end for i = 1, #rewards do doPlayerAddItem(cid, rewards.id, rewards.qt) doPlayerAddExperience(cid, 0) end selfSay("Ate Logo!", cid) setPlayerStorageValue(cid, stoFinish, 1) talkState[talkUser] = 0 return truez end -------------------------------------------------------------------- local need1 = { {id = 15515, qt = 10}, --Barras de Ouro } local rewards1 = { {id = 6529, qt = 1}, --Soft Boots } local stoFinish = 92119 --------- if msgcontains(msg, 'Soft boots') or msgcontains(msg, 'soft boots') then if getPlayerStorageValue(cid, stoFinish) >= 99 then selfSay("Sorry, you already had done this quest.", cid) talkState[talkUser] = 0 return true end selfSay("Gostaria de trocar 10 Barras de Ouro por uma Soft Boots? Diga {buy soft}",cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, 'buy soft') or msgcontains(msg, 'comprar soft') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need1[1].id) < need1[1].qt then selfSay("Você não me trouxe as Barras de Ouro...", cid) talkState[talkUser] = 0 return true end for i = 1, #need1 do doPlayerRemoveItem(cid, need1.id, need1.qt) end for i = 1, #rewards1 do doPlayerAddItem(cid, rewards1.id, rewards1.qt) doPlayerAddExperience(cid, 0) end selfSay("Ate Logo!", cid) setPlayerStorageValue(cid, stoFinish, 1) talkState[talkUser] = 0 return truez end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Da para diminuir esse script mais estava sem tempo, esse ai da pra quebrar o galho por enquanto. Qualquer erro só falar! obs testei em um server de poketibia não sei se funcionara no tibia
Postado Fevereiro 18, 2016 9 anos 14 minutos atrás, Ckfox disse: 1º Em npc crie um arquvo com nome Contrabandista.xml e cole Ocultar conteúdo <?xml version="1.0" encoding="UTF-8"?> <npc name="Xablau" script="Contrabandista.lua" walkinterval="350000" floorchange="0" speed="0"> <health now="100" max="100"/> <look type="2200" head="20" body="100" legs="50" feet="0"/> <parameters> <parameter key="message_greet" value="Ola |PLAYERNAME| Eu vendo {demon armor}, {soft boots} esta interessado em algo?"/> </parameters> </npc> 2º Em npc/scripts crie um arquivo Contrabandista.lua e cole Ocultar conteúdo 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 msg = string.lower(msg) --------- local need = { {id = 15515, qt = 5}, --Barras de Ouro } local rewards = { {id = 3888, qt = 1}, --Demon Armor } local stoFinish = 92119 --------- if msgcontains(msg, 'Demon armor') or msgcontains(msg, 'demon armor') then if getPlayerStorageValue(cid, stoFinish) >= 99 then selfSay("Sorry, you already had done this quest.", cid) talkState[talkUser] = 0 return true end selfSay("Gostaria de trocar 5 Barras de Ouro por uma Demon Armor? Diga {buy demon}",cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, 'buy demon') or msgcontains(msg, 'comprar Demon') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need[1].id) < need[1].qt then selfSay("Você não me trouxe as Barras de Ouro...", cid) talkState[talkUser] = 0 return true end for i = 1, #need do doPlayerRemoveItem(cid, need.id, need.qt) end for i = 1, #rewards do doPlayerAddItem(cid, rewards.id, rewards.qt) doPlayerAddExperience(cid, 0) end selfSay("Ate Logo!", cid) setPlayerStorageValue(cid, stoFinish, 1) talkState[talkUser] = 0 return truez end -------------------------------------------------------------------- local need1 = { {id = 15515, qt = 10}, --Barras de Ouro } local rewards1 = { {id = 6529, qt = 1}, --Soft Boots } local stoFinish = 92119 --------- if msgcontains(msg, 'Soft boots') or msgcontains(msg, 'soft boots') then if getPlayerStorageValue(cid, stoFinish) >= 99 then selfSay("Sorry, you already had done this quest.", cid) talkState[talkUser] = 0 return true end selfSay("Gostaria de trocar 10 Barras de Ouro por uma Soft Boots? Diga {buy soft}",cid) talkState[talkUser] = 1 return true elseif msgcontains(msg, 'buy soft') or msgcontains(msg, 'comprar soft') and talkState[talkUser] == 1 then if getPlayerItemCount(cid, need1[1].id) < need1[1].qt then selfSay("Você não me trouxe as Barras de Ouro...", cid) talkState[talkUser] = 0 return true end for i = 1, #need1 do doPlayerRemoveItem(cid, need1.id, need1.qt) end for i = 1, #rewards1 do doPlayerAddItem(cid, rewards1.id, rewards1.qt) doPlayerAddExperience(cid, 0) end selfSay("Ate Logo!", cid) setPlayerStorageValue(cid, stoFinish, 1) talkState[talkUser] = 0 return truez end return trueend npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)npcHandler:addModule(FocusModule:new()) Da para diminuir esse script mais estava sem tempo, esse ai da pra quebrar o galho por enquanto. Qualquer erro só falar! obs testei em um server de poketibia não sei se funcionara no tibia Amigo estou com o mesmo problema e acho que você pode ajudar ambos... Poderia explicar no escript como fazer pra alterar o item que seria as barras de ouro? por outro? Tipo tarantulla egg? E como colocar mais itens... Pois quero o mesmo sistema no meu servidor, porém, quero colocar muitos itens... Se puder ajudar, grato. Se não puder, grato também
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.