Postado Junho 27, 2012 13 anos Autor opa, belezura, vou testar agora mesmo ! ja te falo se deu certo. .. Blz Vod, mas ele só ta promovendo uma promotion só, testei com um knight, e ele vira Blade Knight, e perde os 10 golden nuggets, perfeito! mas quando eu tento comprar novamente a promotion, para ele subir para blade elite knight, o npc diz que Já fui promovido! não tem problema se precisar criar outro npc, se o problema for este eu faço outro, só preciso que o player seje promovido mais 2 vezes. como faço isso ? Editado Junho 28, 2012 13 anos por Vinix E. Michele (veja o histórico de edições)
Postado Junho 29, 2012 12 anos 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 local msg = string.lower(msg) local t = { ["first promote"] = {items = {2160,2}, level = 20, promotion = 1}, ["second promote"] = {items = {2157,10}, level = 40, promotion = 2}, ["third promote"] = {items = {2157,20}, level = 60, promotion = 3} } if isInArray({"promot","promotion", "promover", "promo", "promote"}, msg) then npcHandler:say("I can promote you for {first promote}, {second promote} and {third promote}.", cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if t[msg] then if getPlayerLevel(cid) >= t[msg].level then if (getPlayerPromotionLevel(cid) < t[msg].promotion) then if doPlayerRemoveItem(cid, t[msg].items[1], t[msg].items[2]) then setPlayerPromotionLevel(cid, t[msg].promotion) npcHandler:say("Congratulations! You are now promoted.", cid) else npcHandler:say("You need "..t[msg].items[2].." "..getItemNameById(t[msg].items[1]).."!", cid) end else npcHandler:say("You are already promoted!", cid) end else npcHandler:say("Sorry, You need level "..t[msg].level.." or more to buy promotion!", cid) talkState[talkUser] = 0 end end elseif isInArray({"no","nao"}, msg) then selfSay("Then not.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Postado Julho 30, 2012 12 anos 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 local msg = string.lower(msg) local t = { ["first promote"] = {items = {2160,2}, level = 20, promotion = 1}, ["second promote"] = {items = {2157,10}, level = 40, promotion = 2}, ["third promote"] = {items = {2157,20}, level = 60, promotion = 3} } if isInArray({"promot","promotion", "promover", "promo", "promote"}, msg) then npcHandler:say("I can promote you for {first promote}, {second promote} and {third promote}.", cid) talkState[talkUser] = 1 elseif talkState[talkUser] == 1 then if t[msg] then if getPlayerLevel(cid) >= t[msg].level then if (getPlayerPromotionLevel(cid) < t[msg].promotion) then if doPlayerRemoveItem(cid, t[msg].items[1], t[msg].items[2]) then setPlayerPromotionLevel(cid, t[msg].promotion) npcHandler:say("Congratulations! You are now promoted.", cid) else npcHandler:say("You need "..t[msg].items[2].." "..getItemNameById(t[msg].items[1]).."!", cid) end else npcHandler:say("You are already promoted!", cid) end else npcHandler:say("Sorry, You need level "..t[msg].level.." or more to buy promotion!", cid) talkState[talkUser] = 0 end end elseif isInArray({"no","nao"}, msg) then selfSay("Then not.", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Valeu Vodkart, funcionou certinho
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.