Postado Janeiro 20, 2015 10 anos Esqueci desse detalhe 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 msg = string.lower(msg) if (msgcontains(msg, 'quest) or msgcontains(msg, 'mission)) then selfSay("Voce tem as storages da mission?.", cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'yes') and talkState[talkUser] == 1 then if getPlayerStorageValue(cid, 2050) == 1 and getPlayerStorageValue(cid, 2051) == 1 and getPlayerStorageValue(cid, 2052) == 1 and getPlayerStorageValue(cid, 2053) == 1 then selfSay("Legal, vc pode fazer a Quest.", cid) setPlayerStorageValue(cid, 2050, -1) setPlayerStorageValue(cid, 2051, -1) setPlayerStorageValue(cid, 2052, -1) setPlayerStorageValue(cid, 2053, -1) doTeleportThing(cid, {x= 99, y= 189, z= 7}) talkState[talkUser] = 0 else selfSay("Voce nao tem todas as storages", cid) talkState[talkUser] = 0 return true end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
Postado Janeiro 20, 2015 10 anos EDITADO Demorei tanto pra responder que já responderam kkk Editado Janeiro 20, 2015 10 anos por xBlackWolf (veja o histórico de edições) xBlackWolf THX @Storm Night Best Avatar Ever
Postado Janeiro 21, 2015 10 anos Não deveria ter fechado o Tópico sem antes ter testado o Script. -- < Script by Frenesy > -- 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 doCreatureSayWithDelay(cid,text,type,delay,e) if delay<=0 then doCreatureSay(cid,text,type) else local func=function(pars) doCreatureSay(pars.cid,pars.text,pars.type) pars.e.done=TRUE end e.done=FALSE e.event=addEvent(func,delay,{cid=cid, text=text, type=type, e=e}) end end function cancelNPCTalk(events) local ret=1 for aux=1,table.getn(events) do if events[aux].done==FALSE then stopEvent(events[aux].event) else ret=ret+1 end end events=nil return(ret) end function doNPCTalkALot(msgs,interval) local e={} local ret={} if interval==nil then interval=3000 end --3 seconds is default time between messages for aux=1,table.getn(msgs) do e[aux]={} doCreatureSayWithDelay(getNpcCid(),msgs[aux],TALKTYPE_PRIVATE_NP,(aux-1)*interval,e[aux]) table.insert(ret,e[aux]) end return(ret) 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 if(msgcontains(msg, 'Quest') or msgcontains(msg, 'Mission')) then selfSay('Quer fazer a mission?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) and if getPlayerStorageValue(cid, 2050) == 1 and getPlayerStorageValue(cid, 2051) == 1 and getPlayerStorageValue(cid, 2052) == 1 and getPlayerStorageValue(cid, 2053) == 1 then selfSay('Ok, voce pode fazer a quest agora.', cid) doSendMagicEffect(getPlayerPosition(cid), 10) doTeleportThing(cid, {x= 99, y= 189, z= 7}) setPlayerStorageValue(cid, 2050, -1) -- Remover Missão setPlayerStorageValue(cid, 2051, -1) -- Remover Missão setPlayerStorageValue(cid, 2052, -1) -- Remover Missão setPlayerStorageValue(cid, 2053, -1) -- Remover Missão talkState[talkUser] = 0 else selfSay('Voce nao tem o que e necessario para essa mission.', cid) end elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) and selfSay('Volte quando estiver pronto.', cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Janeiro 21, 2015 10 anos por Frenesy (veja o histórico de edições)
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.