Postado Abril 11, 2015 10 anos Boa Tarde, Minha npc marina não esta fazendo a troca dos 10 spider silks por 1 spool of yarn, segue script. 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local player = Player(cid) if(msgcontains(msg, "silk yarn")) then if player:getStorageValue(Storage.FriendsandTraders.TheMermaidMarina) < 1 then npcHandler:say("Um. You mean, you really want me to touch that gooey spider silk just because you need yarn? Well... do you think that I'm pretty?", cid) npcHandler.topic[cid] = 1 elseif player:getStorageValue(Storage.FriendsandTraders.TheMermaidMarina) == 2 then npcHandler:say("Okay... a deal is a deal, would you like me to create a {spool of yarn} from {10 pieces of spider silk}?", cid) npcHandler.topic[cid] = 5 end elseif msgcontains(msg, "honey") then if player:getStorageValue(Storage.FriendsandTraders.TheMermaidMarina) == 1 then npcHandler:say("Did you bring me the 50 honeycombs I requested and do you absolutely admire my beauty?", cid) npcHandler.topic[cid] = 4 end elseif(msgcontains(msg, "yes")) then if(npcHandler.topic[cid] == 1) then npcHandler:say("Well, everyone would say that in your position. Do you think that I'm really, absolutely the most stunning being that you have ever seen?", cid) npcHandler.topic[cid] = 2 elseif(npcHandler.topic[cid] == 2) then selfSay("<giggles> It's funny how easy it is to get humans to say what you want. Now, proving it will be even more fun! ...", cid) selfSay("You want me to touch something gooey, so you have to touch something gooey for me too. <giggles> ...", cid) npcHandler:say("I love honey and I haven't eaten it in a while, so bring me 50 honeycombs and worship my beauty a little more, then we will see.", cid) player:setStorageValue(Storage.FriendsandTraders.TheMermaidMarina, 1) player:setStorageValue(Storage.FriendsandTraders.DefaultStart, 1) elseif(npcHandler.topic[cid] == 4) then if player:getItemCount(5902) >= 50 then player:removeItem(5902, 50) npcHandler:say("Oh goodie! Thank you! Okay... I guess since my fingers are sticky now anyway, I will help you. From now on, if you bring me {10 pieces of spider silk}, I will create one {spool of yarn}.", cid) npcHandler.topic[cid] = 0 player:setStorageValue(Storage.FriendsandTraders.TheMermaidMarina, 2) player:addAchievement(16) -- Achievement Beach Tamer else npcHandler:say("You don't have enough honey.", cid) npcHandler.topic[cid] = 0 end elseif(npcHandler.topic[cid] == 5) then if player:getItemCount(5879) >= 10 then doPlayerRemoveItem(cid,5879,1) doPlayerAddItem(cid,5886,1) npcHandler:say("Ew... gooey... there you go.", cid) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have the required items.", cid) npcHandler.topic[cid] = 0 end end end return true end keywordHandler:addKeyword({'comb'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Sorry, I don\'t have a spare comb. I lost my favourite one when diving around in Calassa.'}) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Nesse campo eu já tentei assim e tambem não foi. doPlayerAddItem(uid,5886,1) doPlayerAddItem(cid,5886) doPlayerAddItem(uid,5886) abs
Postado Abril 11, 2015 10 anos 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 function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end local player = Player(cid) if(msgcontains(msg, "silk yarn")) then if player:getStorageValue(Storage.FriendsandTraders.TheMermaidMarina) < 1 then npcHandler:say("Um. You mean, you really want me to touch that gooey spider silk just because you need yarn? Well... do you think that I'm pretty?", cid) npcHandler.topic[cid] = 1 elseif player:getStorageValue(Storage.FriendsandTraders.TheMermaidMarina) == 2 then npcHandler:say("Okay... a deal is a deal, would you like me to create a {spool of yarn} from {10 pieces of spider silk}?", cid) npcHandler.topic[cid] = 5 end elseif msgcontains(msg, "honey") then if player:getStorageValue(Storage.FriendsandTraders.TheMermaidMarina) == 1 then npcHandler:say("Did you bring me the 50 honeycombs I requested and do you absolutely admire my beauty?", cid) npcHandler.topic[cid] = 4 end elseif(msgcontains(msg, "yes")) then if(npcHandler.topic[cid] == 1) then npcHandler:say("Well, everyone would say that in your position. Do you think that I'm really, absolutely the most stunning being that you have ever seen?", cid) npcHandler.topic[cid] = 2 elseif(npcHandler.topic[cid] == 2) then selfSay("<giggles> It's funny how easy it is to get humans to say what you want. Now, proving it will be even more fun! ...", cid) selfSay("You want me to touch something gooey, so you have to touch something gooey for me too. <giggles> ...", cid) npcHandler:say("I love honey and I haven't eaten it in a while, so bring me 50 honeycombs and worship my beauty a little more, then we will see.", cid) player:setStorageValue(Storage.FriendsandTraders.TheMermaidMarina, 1) player:setStorageValue(Storage.FriendsandTraders.DefaultStart, 1) elseif(npcHandler.topic[cid] == 4) then if player:getItemCount(5902) >= 50 then player:removeItem(5902, 50) npcHandler:say("Oh goodie! Thank you! Okay... I guess since my fingers are sticky now anyway, I will help you. From now on, if you bring me {10 pieces of spider silk}, I will create one {spool of yarn}.", cid) npcHandler.topic[cid] = 0 player:setStorageValue(Storage.FriendsandTraders.TheMermaidMarina, 2) player:addAchievement(16) -- Achievement Beach Tamer else npcHandler:say("You don't have enough honey.", cid) npcHandler.topic[cid] = 0 end elseif(npcHandler.topic[cid] == 5) then if player:getItemCount(5879) >= 10 then player:removeItem(5879, 10) player:addItem(5886, 1) npcHandler:say("Ew... gooey... there you go.", cid) npcHandler.topic[cid] = 0 else npcHandler:say("You don't have the required items.", cid) npcHandler.topic[cid] = 0 end end end return true end keywordHandler:addKeyword({'comb'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Sorry, I don\'t have a spare comb. I lost my favourite one when diving around in Calassa.'}) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) O diálogo após entregar os honeycomb e tentar trocar os silk é: Player: Hi Marina: You wouldn't keep a pretty lady like me waiting, would you? Player: Silk yarn Marina: Okay... a deal is a deal, would you like me to create a spool of yarn from 10 pieces of spider silk? Player: Yes Marina: Marina: Ew... gooey... there you go. ➥ Regras | Seções OTServ | Seções BOT
Postado Abril 11, 2015 10 anos Solução Hm... Bom eu não notei erro no script, porém tente usar um que eu uso no meu próprio servidor, eu irei destacar as partes onde você deverá mudar! Marina.lua! 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 local items = { item1 = {2160, 2159} } local counts = { count1 = {100, 5} } 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, 'yes') then if getPlayerItemCount(cid, items.item1[1]) >= counts.count1[1] then doPlayerRemoveItem(cid, items.item1[1], counts.count1[1]) doPlayerAddItem(cid, items.item1[2], counts.count1[2]) selfSay('Você comprou 5 small coins.', cid) else selfSay('Você não tem TD suficiente.', cid) end elseif msgcontains(msg, 'no') then selfSay('Ok, deixa para a próxima!', cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Azul = É o ID item que o player ira pagar Azul com Negrito = É a quantidade do item que o player vai pagar. Dourado = É o ID item que o player ira receber depois de pagar. Dourado com Negrito = É a quantidade do item que o player irá receber apos pagar. Verde com Negrito = Mensagem que irá aparecer ápos ter feito a troca com sucesso. Cyano com Negrito = É a mensagem que irá receber caso ele tentar trocar e não tiver o certo item que ele deve pagar suficiente (Por exemplo, ele precisa ter 6 reais para comprar um passaporte, porém ele tem apenas 5, se ele tentar trocar, a mensagem que irá aparecer é a que esta em cyano negrito) Rosa com Negrito = Mensagem que irá aparecer caso player falar no _________________________________________________________ Marina.xml <?xml version="1.0"?> -<npc floorchange="0" walkinterval="2000" script="Marina.lua" name="Marina"> <health max="150" now="150"/> <look corpse="2212" feet="76" legs="40" body="59" head="57" type="134"/> -<parameters> <parameter value="Eu vendo Small Coins quer comprar? Vai te custar 100 TD." key="message_greet"/> <parameter value="Obrigado! Boa sorte!" key="message_farewell"/> </parameters> </npc> Vermelho escuro com Negrito = Nome do arquivo.lua que você criara/mudara com o 1 codigo Preto com Negrito = Nome do NPC (editei ele ja para você) Vermelho claro com Negrito = É a mensagem que aparece depois de falar HI _______________________________________________________ -----Conversa-------- Player: HI Npc: "Fala que você podera editar" Player: Yes NPC: "Fala que vai estar no código acima em Verde com Negrito" ___________________________________ Player: Hi NPC "Fala que você podera editar" Player: no NPC: "Fala que vai estar no código acima em Rosa com Negrito" Editado Abril 11, 2015 10 anos por Factur (veja o histórico de edições) ~Veja meus tópicos =D → Pokémon Zot Editado por Factur Final 80% → Quando poke morrer abrir TP por 30 segundos → Aumentando velocidade do player → Como criar cliente próprio (Com imagens) → Como criar uma quest (por SCRIPT) → Editando pokémons → [TinyTask] Explicação e tudo que você deve saber. → Adicionando o comando !bug → Adicionando o comando /buykit ~Projeto Antes e Depois ~~ → Umbreon - Antes e depois #1 → Esquilo - Antes e depois (Especial Snowsz)#2 → Lobo - Antes e Depois #3 → Entei - Antes e Depois #4 → Yveltal - Antes e Depois #5 → Morte - Antes e Depois #6
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.