Alguem aqui tem ou sabe como fazer uma task que em vez de matar monster tem que matar player? por exemplo, começou a task pelo npc e tem que matar 50 players, qualquer player, ai quando terminar ganhar uma certa storage
só isso, flw
Alguem aqui tem ou sabe como fazer uma task que em vez de matar monster tem que matar player? por exemplo, começou a task pelo npc e tem que matar 50 players, qualquer player, ai quando terminar ganhar uma certa storage
só isso, flw
Área incorreta, tópico movido. Mais cuidado da próxima vez.
Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.
desculpa ai cara, jurei que tinha posto no lugar correto.
ninguem tem um script desse não ? ;-;
O jogador irá receber a storage automaticamente, após matar os 50 jogadores, ou terá que falar novamente com o NPC?
Bom, fiz aqui.
Qualquer erro, só postar.
NPC: (suponho que você saiba fazer o .xml dele)
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 cfg = { storage_mission = 193811, --Não mexa. qnt_kill = 50, --Quantidade de players que deverá matar. sto = xxx, --Storage que o player vai ganhar ao completar a task. } if msgcontains(msg, "task") then if getPlayerStorageValue(cid, cfg.storage_mission) >= 1 then selfSay("Você já está fazendo minha missão.", cid) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, 918381) >= 1 then selfSay("Oh, vejo que você matou os "..cfg.qnt_kill.." jogadores! Aqui está seu prêmio.", cid) setPlayerStorageValue(cid, cfg.sto, 1) setPlayerStorageValue(cid, 91832, 1) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, 91832) >= 1 then selfSay("Você já completou minha task.", cid) talkState[talkUser] = 0 return true else selfSay("Hm, então você gostaria de fazer uma task? Bem, você terá que matar "..cfg.qnt_kill.." jogadores.", cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then selfSay("Certo, boa sorte!", cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You received a task: kill "..cfg.qnt_kill.." players. Good luck!") setPlayerStorageValue(cid, cfg.storage_mission, cfg.qnt_kill) talkState[talkUser] = 0 return true elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then selfSay("Tudo bem, então.", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
data/creaturescripts/scripts
function onKill(cid, target, lastHit) local qnt_kill = 50 --Quantidade necessário de players que o jogador deverá matar. if getPlayerStorageValue(cid, 193811) >= 1 and getPlayerStorageValue(cid, 193811) <= qnt_kill then if isPlayer(target) then if getPlayerStorageValue(cid, 193811) <= (qnt_kill - 2) then setPlayerStorageValue(cid, 193811, getPlayerStorageValue(cid, 193811) - 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You killed 1 player. You need kill more "..(qnt_kill - getPlayerStorageValue(cid, 193811)).." "..((qnt_kill - getPlayerStorageValue(cid, 193811)) > 1 and "players" or "player").." to complete the task.") else setPlayerStorageValue(cid, 183811, 0) setPlayerStorageValue(cid, 918381, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Congratulations, you complete the task! Talk to the NPC for get your prize.") end end end return true end function onLogin(cid) registerCreatureEvent(cid, "taskPlayer") return true end
<event type="kill" name="taskPlayer" script="nome do arquivo.lua"/> <event type="login" name="taskPlayerLogin" script="nome do arquivo.lua"/>
Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.
Eu gostaria de ter que falar com o npc novamente mesmo, e eu não entendo muito de script, não sei fazer o do npc
valeu ai pela força cara e aproveitando tambem, ali em valor da storage eu não entendi, quero que o player ganhe aquela storage, coloco 1?
tipo a xml dele eu sei fazer, n é só copiar e mudar os nomes e etc? o npc não tem que ter um script?
Vou alterar aqui o NPC.
O valor, sim, você coloca 1.
O script .lua do NPC, eu passei acima. O .xml, tente fazer tirando como base outros NPCs no mesmo modelo.
#EDIT: Códigos alterados.
Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.
Está dando error, toda vez que eu mato um jogador(o primeiro tbm), aparece Congratulations, you complete the task! Talk to the NPC for get your prize.
vlw ai pela atenção
ah, e se possivel tem como por para só valer os frags de jogador acima de um certo level? se não souber não tem problema
Tenta assim:
function onKill(cid, target, lastHit) local qnt_kill = 50 --Quantidade necessário de players que o jogador deverá matar. local min_lv = 100 --Level mínimo para a frag contar. if getPlayerStorageValue(cid, 193811) >= 1 and getPlayerStorageValue(cid, 193811) <= qnt_kill then if isPlayer(target) then if getPlayerLevel(target) >= min_lv then if getPlayerStorageValue(cid, 193811) >= 2 then setPlayerStorageValue(cid, 193811, getPlayerStorageValue(cid, 193811) - 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You killed 1 player. You need kill more "..(qnt_kill - getPlayerStorageValue(cid, 193811)).." "..((qnt_kill - getPlayerStorageValue(cid, 193811)) > 1 and "players" or "player").." to complete the task.") else setPlayerStorageValue(cid, 183811, 0) setPlayerStorageValue(cid, 918381, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Congratulations, you complete the task! Talk to the NPC for get your prize.") end end end end return true end function onLogin(cid) registerCreatureEvent(cid, "taskPlayer") return true end
Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.
agora está começando ao contrário tipo começa assim 00:45 You killed 1 player. You need kill more 1 players to complete the task. e termina com 00:45 You killed 1 player. You need kill more 49 players to complete the task. e quando diz que terminou, vou no npc e diz Você já está fazendo minha missão.
Sobre o NPC, vou arrumar logo.
function onKill(cid, target, lastHit) local min_lv = 100 --Level mínimo para a frag contar. if getPlayerStorageValue(cid, 193811) >= 1 and getPlayerStorageValue(cid, 193811) <= qnt_kill then if isPlayer(target) then if getPlayerLevel(target) >= min_lv then if getPlayerStorageValue(cid, 193811) >= 2 then setPlayerStorageValue(cid, 193811, getPlayerStorageValue(cid, 193811) - 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You killed 1 player. You need kill more "..(getPlayerStorageValue(cid, 193811) - 1).." "..((getPlayerStorageValue(cid, 193811) - 1) > 1 and "players" or "player").." to complete the task.") else setPlayerStorageValue(cid, 183811, 0) setPlayerStorageValue(cid, 918381, 1) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Congratulations, you complete the task! Talk to the NPC for get your prize.") end end end end return true end function onLogin(cid) registerCreatureEvent(cid, "taskPlayer") return true end
NPC:
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 cfg = { storage_mission = 193811, --Não mexa. qnt_kill = 50, --Quantidade de players que deverá matar. sto = xxx, --Storage que o player vai ganhar ao completar a task. } if msgcontains(msg, "task") then if getPlayerStorageValue(cid, 918381) >= 1 then selfSay("Oh, vejo que você matou os "..cfg.qnt_kill.." jogadores! Aqui está seu prêmio.", cid) setPlayerStorageValue(cid, cfg.sto, 1) setPlayerStorageValue(cid, 91832, 1) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, 91832) >= 1 then selfSay("Você já completou minha task.", cid) talkState[talkUser] = 0 return true elseif getPlayerStorageValue(cid, cfg.storage_mission) >= 1 then selfSay("Você já está fazendo minha missão.", cid) talkState[talkUser] = 0 return true else selfSay("Hm, então você gostaria de fazer uma task? Bem, você terá que matar "..cfg.qnt_kill.." jogadores.", cid) talkState[talkUser] = 1 return true end elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then selfSay("Certo, boa sorte!", cid) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You received a task: kill "..cfg.qnt_kill.." players. Good luck!") setPlayerStorageValue(cid, cfg.storage_mission, cfg.qnt_kill) talkState[talkUser] = 0 return true elseif msgcontains(msg, "no") and talkState[talkUser] == 1 then selfSay("Tudo bem, então.", cid) talkState[talkUser] = 0 return true end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.
ai cara, perfeito, muito obrigado mesmo
pode fechar o topico aew
Tópico movido para a seção de dúvidas e pedidos resolvidos.
Não respondo PMs solicitando suporte. Já existem seções no fórum para isto.