Postado Julho 13, 2012 12 anos Dae galera, de boa? Eu to fazendo a quest da obsidian knife bem parecida com a do Global, pra isso eu preciso do NPC A Sweaty Cyclops. Eis que eu comecei a desenvolver o código dele que é o seguinte: 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 stg1 = 17171 --status da bast skirt stg2 = 17172 --Status da missão completa local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if (msgcontains(msg, "uth'lokr") or msgcontains(msg, "Uth'lokr") or msgcontains(msg, "uth'Lokr") or msgcontains(msg, "Uth'Lokr")) then if getPlayerStorageValue(cid, stg2) >= 1 then --testa se já completou a missão selfSay("Sorry, you already completed this mission!!", cid) talkState[talkUser] = 0 else --se não completou a missão selfSay("Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?", cid) if msgcontains(msg, "yes") then if getPlayerStorageValue(cid, stg1) >= 1 then --testa se já entregou skirts if doPlayerRemoveItem(cid, 2516, 1) == TRUE then doPlayerAddItem(cid, 5889,1) setPlayerStorageValue(cid, stg2, 1) selfSay("Cling clang!, Good bye lil' one",cid) talkState[talkUser] = 0 else selfSay("You don't have a Dragon Shield, get one and come back!",cid) talkState[talkUser] = 0 end else --se ele não entregou selfSay("Wait. Me work no cheap is. Do favour for me first, yes?", cid) if msgcontains(msg, "yes") then selfSay("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.", cid) if msgcontains(msg, "bast skirt") then selfSay("So Lil' one bring 3 bast skirts?",cid) if msgcontains(msg, "yes") then if doPlayerRemoveItem(cid,3983,3) then -- remove bastskirts selfSay("Good good! Woman happy will be. Now me happy too and help you.",cid) setPlayerStorageValue(cid, stg1, 1) if doPlayerRemoveItem(cid, 2516, 1) == TRUE then -- remove dragon shield doPlayerAddItem(cid, 5889,1) -- dá o draconian steel setPlayerStorageValue(cid, stg2, 1) -- marca como terminada a missão selfSay("Cling clang!, Good bye lil' one",cid) talkState[talkUser] = 0 else selfSay("You don't have a Dragon Shield, get one and come back!",cid) talkState[talkUser] = 0 end else selfSay("Go get and bring to me, then me help you.",cid) talkState[talkUser] = 0 end else selfSay("Bring me 3 Bast Skirts",cid) talkState[talkUser] = 0 end else selfSay("Good bye lil' one.",cid) talkState[talkUser] = 0 end else selfSay("See you later.",cid) talkState[talkUser] = 0 end end else selfSay("ByeBye",cid) talkState[talkUser] = 0 end end else selfSay("I'm the Obsidian Knife NPC",cid) end end npcHandler:setMessage(MESSAGE_GREET, "Hum Humm! Welcume lil' player.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Quando eu abro o OT, nenhum problema acontece. Porém, quando eu falo com o npc, HI, Uth'Lokr ele responde o seguinte: "Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?" e depois ele termina a conversa com "Byebye". Parece que ele ignora tudo e vai pro final. alguém sabe qual o erro no meu script? Agradeço desde já.
Postado Julho 13, 2012 12 anos tenta isso, muda essa parte: if getPlayerStorageValue(cid, stg2) >= 1 then --testa se já completou a missão selfSay("Sorry, you already completed this mission!!", cid) talkState[talkUser] = 0 end if getPlayerStorageValue(cid, stg2) < 1 then --se não completou a missão selfSay("Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?", cid) elseif msgcontains(msg, "yes") then if getPlayerStorageValue(cid, stg1) >= 1 then --testa se já entregou skirts if doPlayerRemoveItem(cid, 2516, 1) == TRUE then doPlayerAddItem(cid, 5889,1) setPlayerStorageValue(cid, stg2, 1) selfSay("Cling clang!, Good bye lil' one",cid) talkState[talkUser] = 0 else selfSay("You don't have a Dragon Shield, get one and come back!",cid) talkState[talkUser] = 0 end end end so completa os ends ai certinho
Postado Julho 13, 2012 12 anos Autor bom, dei uma limpada no script e mesmo assim não tá funcionando 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 stg1 = 17171 --status da bast skirt stg2 = 17172 --Status da missão completa local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if (msgcontains(msg, "uth'lokr") or msgcontains(msg, "Uth'lokr") or msgcontains(msg, "uth'Lokr") or msgcontains(msg, "Uth'Lokr")) then if getPlayerStorageValue(cid, stg2) >= 1 then --testa se já completou a missão selfSay("Sorry, you already completed this mission!!", cid) talkState[talkUser] = 0 else --se não completou a missão selfSay("Firy steel it is. Need green ones' breath to melt. Or red even better. Me can make from shield. Lil' one want to trade?", cid) if msgcontains(msg, "yes") then if getPlayerStorageValue(cid, stg1) >= 1 then --testa se já entregou skirts if doPlayerRemoveItem(cid, 2516, 1) == TRUE then doPlayerAddItem(cid, 5889,1) setPlayerStorageValue(cid, stg2, 1) selfSay("Cling clang!, Good bye lil' one",cid) talkState[talkUser] = 0 else selfSay("You don't have a Dragon Shield, get one and come back!",cid) talkState[talkUser] = 0 end end if getPlayerStorageValue(cid, stg1) < 1 then --se ele não entregou selfSay("Me need gift for woman. We dance, so me want to give her bast skirt. But she big is. So I need many to make big one. Bring three okay? Me wait.", cid) if msgcontains(msg, "bast skirt") then if doPlayerRemoveItem(cid,3983,3) then -- remove bastskirts selfSay("Good good! Woman happy will be. Now me happy too and help you.",cid) setPlayerStorageValue(cid, stg1, 1) if doPlayerRemoveItem(cid, 2516, 1) == TRUE then doPlayerAddItem(cid, 5889,1) setPlayerStorageValue(cid, stg2, 1) selfSay("Cling clang!, Good bye lil' one",cid) talkState[talkUser] = 0 else selfSay("You don't have a Dragon Shield, get one and come back!",cid) talkState[talkUser] = 0 end else selfSay("Go get and bring to me, then me help you.",cid) talkState[talkUser] = 0 end end end else return TRUE end end else selfSay("I'm the Obsidian Knife NPC",cid) end end npcHandler:setMessage(MESSAGE_GREET, "Hum Humm! Welcume lil' player.") npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) agora ele tá indo direto pra mensagem "I'm the Obsidian Knife NPC" consegue resolver isso aí?
Postado Julho 13, 2012 12 anos cara olha essa parte aqui if doPlayerRemoveItem(cid,3983,3) then -- remove bastskirts selfSay("Good good! Woman happy will be. Now me happy too and help you.",cid) setPlayerStorageValue(cid, stg1, 1) if doPlayerRemoveItem(cid, 2516, 1) == TRUE then doPlayerAddItem(cid, 5889,1) setPlayerStorageValue(cid, stg2, 1) selfSay("Cling clang!, Good bye lil' one",cid) talkState[talkUser] = 0 else selfSay("You don't have a Dragon Shield, get one and come back!",cid) talkState[talkUser] = 0 end aqui vai dar a storage 'stg1' mesmo se ele n tiver o item '2516', e ele n vai ganhar a storage 'stg2' se n remover esse item, n ta errado n? @topic salsicha, é você mesmo meu filho? kkkkkkkkkkk [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
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.