Postado Setembro 19, 2014 10 anos queria colocar nessa script de npc uma condição, tipo, só players com certa storage podem falar com o npc, se o player tiver a storage ele falará de boas com o npc, se não, retornara uma mensagem para o player avisando que ele ainda n tem aquela missão, bem simples mas eu n sei fazer a script do 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 msg = string.lower(msg) local storage,pos = 89745,{x=1090, y=957, z=7} if isInArray({"lutar","fight","entrar","participar"}, msg) then npcHandler:say("HAHAHAHA, um mero shinobi louco por aventura, quer mesmo ir comigo? {yes}", cid) talkState[talkUser] = 1 elseif isInArray({"yes","sim"}, msg) and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage) <= 0 then npcHandler:say("Vamos nessa então, mas não vale voltar atraz!", cid) talkState[talkUser] = 0 doTeleportThing(cid, pos) else npcHandler:say("Você já terminou a missão", cid) talkState[talkUser] = 0 end elseif msg == "no" then selfSay("Hahahaha, sabia que voce medroso, então saia da minha frente seu muleque!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) quem ajudar como sempre irei dar rep ++!
Postado Setembro 19, 2014 10 anos queria colocar nessa script de npc uma condição, tipo, só players com certa storage podem falar com o npc, se o player tiver a storage ele falará de boas com o npc, se não, retornara uma mensagem para o player avisando que ele ainda n tem aquela missão, bem simples mas eu n sei fazer a script do 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 msg = string.lower(msg) local storage,pos = 89745,{x=1090, y=957, z=7} if isInArray({"lutar","fight","entrar","participar"}, msg) then npcHandler:say("HAHAHAHA, um mero shinobi louco por aventura, quer mesmo ir comigo? {yes}", cid) talkState[talkUser] = 1 elseif isInArray({"yes","sim"}, msg) and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, storage) <= 0 then npcHandler:say("Vamos nessa então, mas não vale voltar atraz!", cid) talkState[talkUser] = 0 doTeleportThing(cid, pos) else npcHandler:say("Você já terminou a missão", cid) talkState[talkUser] = 0 end elseif msg == "no" then selfSay("Hahahaha, sabia que voce medroso, então saia da minha frente seu muleque!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) quem ajudar como sempre irei dar rep ++! Não seria mais facil um item? :] I helped you ? REP +. Att: Abreu
Postado Setembro 19, 2014 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 talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid local msg = string.lower(msg) local storage,pos = 89745,{x=1090, y=957, z=7} if isInArray({"lutar","fight","entrar","participar"}, msg) then npcHandler:say("HAHAHAHA, um mero shinobi louco por aventura, quer mesmo ir comigo? {yes}", cid) talkState[talkUser] = 1 elseif isInArray({"yes","sim"}, msg) and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, STORAGE) ~= 1 then npcHandler:say("Vamos nessa então, mas não vale voltar atraz!", cid) talkState[talkUser] = 0 doTeleportThing(cid, pos) else npcHandler:say("Voce ja fez essa missao!", cid) talkState[talkUser] = 0 end elseif msg == "no" then selfSay("Hahahaha, sabia que voce medroso, então saia da minha frente seu muleque!", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Já estava ai a função.. Só coloquei diferente de ~= 1 pra da mais certinho.. Em Storage você poe a STORAGE da Missao que quer.. Onde está -- getPlayerStorageValue(cid, --> STORAGE <-- ) Editado Setembro 19, 2014 10 anos por lucasromero (veja o histórico de edições)
Postado Setembro 19, 2014 10 anos Autor acho que vc n entendeu cara, a storage que tem ai é para um player que ja fez a missão n fassa denovo e a condição que eu pedi é que um player deverá ter tal storage para poder fazer a missão.
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.