Postado Fevereiro 14, 2015 10 anos Seguinte galera, eu fiz uma quest por NPC que é o seguinte, o NPC pede alguns itens para o jogador, a cada item entregue o jogador recebe pontos de experiencia e depois de entregar todos os itens ele recebe dinheiro, ta funcionando tudo, o NPC já até esta no jogo, o problema é que ele atende qualquer level, dessa maneira um player level alto que tem vários desses itens poderia criar vários personagem e fazer essa quest várias vezes para pegar o dinheiro e upar outras contas, pra evitar isso gostaria de fazer com que o NPC só entregue a quest para jogadores que forem level 50 ou maior que isso, alguém sabe como fazer isso? Vou deixar aqui embaixo o script da quest: 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 knightarmor = 2476 local crownlegs = 2488 local bootsofhaste = 2195 local wingedhelmet = 2474 local storage = 9981 local getstorage = getPlayerStorageValue(cid, storage) local sorrymessage = "Desculpe, voce nao tem todos o itens necessarios para completar as missoes..." local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if msgcontains(msg, 'dar esse item') then if getstorage == 4 then npcHandler:say("Voce jah completou a quest", cid) elseif getstorage < 4 then npcHandler:say("Voce tem o item necessario?", cid) talkState[talkUser] = 1 end elseif msgcontains(msg, 'quest') then if getstorage < 1 then npcHandler:say("Voce precisa de uma knight armor para comecar. Voce pode me {dar esse item}?", cid) elseif getstorage == 1 then npcHandler:say("Voce esta na segunda missao e precisa de uma crown legs para continuar. Voce pode me {dar esse item}?", cid) elseif getstorage == 2 then npcHandler:say("Voce esta na terceira missao e precisa de uma boots of haste para continuar. Voce pode me {dar esse item}?", cid) elseif getstorage == 3 then npcHandler:say("Voce esta na quarta missao e precisa de um winged helmet para continuar. Voce pode me {dar esse item}?", cid) elseif getstorage == 4 then npcHandler:say("Voce completou todas as missoes.", cid) end elseif msgcontains(msg, 'yes') then if talkState[talkUser] == 1 then if getstorage < 0 then if doPlayerRemoveItem(cid, knightarmor, 1) == TRUE then npcHandler:say("Obrigado, pegue um pouco de experiencia. Voce jah me deu uma knight armor. Agora irei precisar de uma crown legs. Voce pode me {dar esse item}?", cid) setPlayerStorageValue(cid, storage, 1) doPlayerAddExp(cid, 50000) talkState[talkUser] = 0 elseif doPlayerRemoveItem(cid, knightarmor, 1) == FALSE then npcHandler:say(sorrymessage, cid) talkState[talkUser] = 0 end elseif getstorage == 1 then if doPlayerRemoveItem(cid, crownlegs, 1) == TRUE then npcHandler:say("Ja estou me sentindo mais seguro, pegue mais um pouco de experiencia. Voce jah me deu uma crown legs. Agora irei precisar de uma boots of haste. Voce pode me {dar esse item}?", cid) setPlayerStorageValue(cid, storage, 2) doPlayerAddExp(cid, 50000) talkState[talkUser] = 0 elseif doPlayerRemoveItem(cid, crownlegs, 1) == FALSE then npcHandler:say(sorrymessage, cid) talkState[talkUser] = 0 end elseif getstorage == 2 then if doPlayerRemoveItem(cid, bootsofhaste, 1) == TRUE then npcHandler:say("Agora posso correr se surgir algum perigo, pegue mais um pouco de experiencia, Agora que voce jah me deu uma boots of haste irei precisar de um ultimo item: um winged helmet. Voce pode me {dar esse item}?", cid) setPlayerStorageValue(cid, storage, 3) doPlayerAddExp(cid, 50000) talkState[talkUser] = 0 elseif doPlayerRemoveItem(cid, bootsofhaste, 1) == FALSE then npcHandler:say(sorrymessage, cid) talkState[talkUser] = 0 end elseif getstorage == 3 then if doPlayerRemoveItem(cid, wingedhelmet, 1) == TRUE then npcHandler:say("Muito obrigado, agora eu posso viajar mais seguro. Irei te dar 80.000 e alguma experiencia como recompensa, tome cuidado viajante, ouvi dizer que existe uma criatura bastante perigosa por essas redondezas.", cid) setPlayerStorageValue(cid, storage, 4) doPlayerAddExp(cid, 50000) doPlayerAddItem(cid, 2160, 8) talkState[talkUser] = 0 elseif doPlayerRemoveItem(cid, wingedhelmet, 1) == FALSE then npcHandler:say(sorrymessage, cid) talkState[talkUser] = 0 end end end elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then npcHandler:say("Eu estava contando com voce, mas tudo bem. Volte quando estiver pronto.", cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Fevereiro 16, 2015 10 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 level = 50 -- level minimo local knightarmor = 2476 local crownlegs = 2488 local bootsofhaste = 2195 local wingedhelmet = 2474 local storage = 9981 local getstorage = getPlayerStorageValue(cid, storage) local sorrymessage = "Desculpe, voce nao tem todos o itens necessarios para completar as missoes..." local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid if getPlayerLevel(cid) < level then npcHandler:say("Você precisa de level " .. level .. " para iniciar a quest.", cid) return true end if msgcontains(msg, 'dar esse item') then if getstorage == 4 then npcHandler:say("Voce jah completou a quest", cid) elseif getstorage < 4 then npcHandler:say("Voce tem o item necessario?", cid) talkState[talkUser] = 1 end elseif msgcontains(msg, 'quest') then if getstorage < 1 then npcHandler:say("Voce precisa de uma knight armor para comecar. Voce pode me {dar esse item}?", cid) elseif getstorage == 1 then npcHandler:say("Voce esta na segunda missao e precisa de uma crown legs para continuar. Voce pode me {dar esse item}?", cid) elseif getstorage == 2 then npcHandler:say("Voce esta na terceira missao e precisa de uma boots of haste para continuar. Voce pode me {dar esse item}?", cid) elseif getstorage == 3 then npcHandler:say("Voce esta na quarta missao e precisa de um winged helmet para continuar. Voce pode me {dar esse item}?", cid) elseif getstorage == 4 then npcHandler:say("Voce completou todas as missoes.", cid) end elseif msgcontains(msg, 'yes') then if talkState[talkUser] == 1 then if getstorage < 0 then if doPlayerRemoveItem(cid, knightarmor, 1) == TRUE then npcHandler:say("Obrigado, pegue um pouco de experiencia. Voce jah me deu uma knight armor. Agora irei precisar de uma crown legs. Voce pode me {dar esse item}?", cid) setPlayerStorageValue(cid, storage, 1) doPlayerAddExp(cid, 50000) talkState[talkUser] = 0 elseif doPlayerRemoveItem(cid, knightarmor, 1) == FALSE then npcHandler:say(sorrymessage, cid) talkState[talkUser] = 0 end elseif getstorage == 1 then if doPlayerRemoveItem(cid, crownlegs, 1) == TRUE then npcHandler:say("Ja estou me sentindo mais seguro, pegue mais um pouco de experiencia. Voce jah me deu uma crown legs. Agora irei precisar de uma boots of haste. Voce pode me {dar esse item}?", cid) setPlayerStorageValue(cid, storage, 2) doPlayerAddExp(cid, 50000) talkState[talkUser] = 0 elseif doPlayerRemoveItem(cid, crownlegs, 1) == FALSE then npcHandler:say(sorrymessage, cid) talkState[talkUser] = 0 end elseif getstorage == 2 then if doPlayerRemoveItem(cid, bootsofhaste, 1) == TRUE then npcHandler:say("Agora posso correr se surgir algum perigo, pegue mais um pouco de experiencia, Agora que voce jah me deu uma boots of haste irei precisar de um ultimo item: um winged helmet. Voce pode me {dar esse item}?", cid) setPlayerStorageValue(cid, storage, 3) doPlayerAddExp(cid, 50000) talkState[talkUser] = 0 elseif doPlayerRemoveItem(cid, bootsofhaste, 1) == FALSE then npcHandler:say(sorrymessage, cid) talkState[talkUser] = 0 end elseif getstorage == 3 then if doPlayerRemoveItem(cid, wingedhelmet, 1) == TRUE then npcHandler:say("Muito obrigado, agora eu posso viajar mais seguro. Irei te dar 80.000 e alguma experiencia como recompensa, tome cuidado viajante, ouvi dizer que existe uma criatura bastante perigosa por essas redondezas.", cid) setPlayerStorageValue(cid, storage, 4) doPlayerAddExp(cid, 50000) doPlayerAddItem(cid, 2160, 8) talkState[talkUser] = 0 elseif doPlayerRemoveItem(cid, wingedhelmet, 1) == FALSE then npcHandler:say(sorrymessage, cid) talkState[talkUser] = 0 end end end elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then npcHandler:say("Eu estava contando com voce, mas tudo bem. Volte quando estiver pronto.", cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) (18) 98134-9991 [email protected]
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.