Postado Setembro 20, 2017 7 anos Olá Tk, gostaria de ajuda em um npc que te desse uma missão x(exemplo, pegar um bau para ele, e entregar o item) e assim que voce fizesse essa missão, este npc te liberaria para poder viajar com um outro npc. Exemplo geral: Npc1 - Ha um segredo perdido em um bau nesta floresta, seria capaz de acha-lo e me trazer? se o fizer posso lhe indicar a uma viagem com um antigo amigo (ao tentar falar sem a missão) Npc2 - Desculpe, só posso levar viajantes com boas indicaçoes. (com a missão) Npc2 - o npc1 é um antigo amigo meu, e falou bem de voce, gostaria de viajar comigo para onde? (nome das cidades). Seria algo do tipo,me ajudaria muito, se conseguirem me ajudar até com uma simples base seria muito grato. Uso tf 3.7
Postado Setembro 20, 2017 7 anos 1 hora atrás, FaaSouzax disse: Olá Tk, gostaria de ajuda em um npc que te desse uma missão x(exemplo, pegar um bau para ele, e entregar o item) e assim que voce fizesse essa missão, este npc te liberaria para poder viajar com um outro npc. Exemplo geral: Npc1 - Ha um segredo perdido em um bau nesta floresta, seria capaz de acha-lo e me trazer? se o fizer posso lhe indicar a uma viagem com um antigo amigo (ao tentar falar sem a missão) Npc2 - Desculpe, só posso levar viajantes com boas indicaçoes. (com a missão) Npc2 - o npc1 é um antigo amigo meu, e falou bem de voce, gostaria de viajar comigo para onde? (nome das cidades). Seria algo do tipo,me ajudaria muito, se conseguirem me ajudar até com uma simples base seria muito grato. Uso tf 3.7 é 8.60? você já tem os npcs? pronto com as falas? se tiver coloca aqui que eu do um jei. Scriptszinhos: Spoiler [CREATURESCRIPT] Auto TP depois de matar boss [ACTION] Clean Area [TALKACTION] !FelizAnoNovo [ACTION + MOVEMENT] Cartas ao GOD [CREATURESCRIPT] Always Emblem System [ACTION] Anihi simples [TALKACTIONS] Urinar / fazer xixi Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.
Postado Setembro 21, 2017 7 anos Solução NPC 1 npcquest.lua Spoiler 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 = {2160, 1} --id do item, quantidade function creatureSayCallback(cid, type, msg) local msg, player = string.lower(msg), Player(cid) if not npcHandler:isFocused(cid) then if isInArray({"hi", "hello"}, msg) then npcHandler:addFocus(cid) if player:getStorageValue(56787) == -1 then if player:getStorageValue(56788) == -1 then npcHandler:say("Hi, ".. player:getName().."! There is a lost secret inside a chest at this jungle. If you bring to me I can indicate you a trip with an old friend. Do you accept?", cid) npcHandler.topic[cid] = 1 else npcHandler:say("Hi, ".. player:getName().."! Did you finished the quest?", cid) npcHandler.topic[cid] = 2 end else npcHandler:say("I have already talked to my friend about you.", cid) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) end else return false end elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 1 then player:setStorageValue(56788, 1) npcHandler:say("Ok, now I will wait for you. Be careful!", cid) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) elseif msgcontains(msg, "yes") and npcHandler.topic[cid] == 2 then if player:removeItem(item[1], item[2]) then player:setStorageValue(56787, 1) npcHandler:say("Thanks! Now I will indicate you to a friend.", cid) npcHandler.topic[cid] = 0 else npcHandler:say("Sorry but you don't have the items I need.", cid) npcHandler.topic[cid] = 0 end elseif msgcontains(msg, "no") and npcHandler.topic[cid] == 2 then npcHandler:say("Ok, I will wait a bit more.", cid) npcHandler.topic[cid] = 0 elseif msgcontains(msg, "bye") then npcHandler:say("Bye.", cid) npcHandler:releaseFocus(cid) else npcHandler:say("What?", cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) NPC 2 npctravel.lua Spoiler 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 cities = { ["kazordoon"] = Position(1,1,1), ["mines"] = Position(1,1,1), ["dwarf cave"] = Position(1,1,1), ["beregar"] = Position(1,1,1), ["farmine"] = Position(1,1,1) } function creatureSayCallback(cid, type, msg) local msg, player = string.lower(msg), Player(cid) if not npcHandler:isFocused(cid) then if isInArray({"hi", "hello"}, msg) then npcHandler:addFocus(cid) if player:getStorageValue(56787) == 1 then local text = "" for city, pos in pairs(cities) do text = text .. "{" .. city .."}, " end npcHandler:say("Hi, ".. player:getName().."! Dwarfer is an old and dear friend and talked about you. I can travel you to "..text.."where do you wanna go?", cid) npcHandler.topic[cid] = 1 else npcHandler:say("I have never heard your name before. Sorry, but I travel with people only with good indications.", cid) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) end else return false end elseif cities[msg] and npcHandler.topic[cid] == 1 then player:teleportTo(cities[msg]) cities[msg]:sendMagicEffect(CONST_ME_TELEPORT) npcHandler:say("Sure, brave adventurer!", cid) npcHandler.topic[cid] = 0 npcHandler:releaseFocus(cid) elseif not cities[msg] and npcHandler.topic[cid] == 1 then npcHandler:say("I am not travelling to this place. You can try another.", cid) npcHandler.topic[cid] = 0 elseif msgcontains(msg, "bye") then npcHandler:say("Bye.", cid) npcHandler:releaseFocus(cid) else npcHandler:say("What?", cid) npcHandler.topic[cid] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) Spoiler <?xml version="1.0" encoding="UTF-8"?> <npc name="Dwarfer" script="npcquest.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="66"/> </npc> Spoiler <?xml version="1.0" encoding="UTF-8"?> <npc name="Dwarfer Traveller" script="npctravel.lua" walkinterval="2000" floorchange="0"> <health now="100" max="100"/> <look type="66"/> </npc> Edite as falas, posições, nomes, etc, como quiser, apenas coloquei esses para te servir como base. Contato: Email: [email protected] Discord: Dwarfer#2715
Postado Setembro 21, 2017 7 anos @Dwarfer Boa eu não tinha nenhuma base de npc assim pra mandar pra ele, valeu!! Scriptszinhos: Spoiler [CREATURESCRIPT] Auto TP depois de matar boss [ACTION] Clean Area [TALKACTION] !FelizAnoNovo [ACTION + MOVEMENT] Cartas ao GOD [CREATURESCRIPT] Always Emblem System [ACTION] Anihi simples [TALKACTIONS] Urinar / fazer xixi Não abandone seu tópico, quando você tiver a dúvida resolvida sozinho tente ensinar aos outros como resolve-la (você pode não ser o único com o problema) e quando ela for resolvida por outra pessoa não se esqueça de marcar como melhor resposta e deixar o gostei.
Postado Setembro 21, 2017 7 anos Autor @Dwarfer Funcionando perfeitamente, muito obrigado mais uma vez.
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.