Postado Junho 11, 2014 10 anos Solução -- < 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, 'trocar') or msgcontains(msg, 'changer')) and getPlayerStorageValue(cid,1000) == -1 then -- Configura Storage Aqui selfSay('Deseja trocar uma {Boots of Haster} por uma {Soft Boots}?', cid) talkState[talkUser] = 1 elseif((msgcontains(msg, 'no') or msgcontains(msg, 'nao')) and talkState[talkUser] == 1) then selfSay('Tudo bem entao. Adeus!.', cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 and getPlayerStorageValue(cid,1000) == -1 and getPlayerItemCount(cid, BootIfHasterID) >= 1 then selfSay('Aqui esta!', cid) doSendMagicEffect(getPlayerPosition(cid), 13) setPlayerStorageValue(cid, 1000, 1) doPlayerAddItem(cid,BootOfHasterID, -1) doPlayerAddItem(cid,SoftBootsID, 1) talkState[talkUser] = 0 elseif(msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 and getPlayerStorageValue(cid,1000) == -1 and getPlayerItemCount(cid, BootIfHasterID) < 1 then selfSay('Voce nao possui o item.', cid) talkState[talkUser] = 0 elseif(msgcontains(msg, 'trocar') or msgcontains(msg, 'changer')) and getPlayerStorageValue(cid,1000) == 1 then -- Configura Storage Aqui selfSay('Voce so pode realiazar esta troca apenas uma vez.', cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Editado Junho 11, 2014 10 anos por Frenesy (veja o histórico de edições)
Postado Junho 11, 2014 10 anos Autor Frenesy obrigado pelo script Hj a noite eu testo, agr to no trabalho depois digo se funciono. Ate maiss..
Postado Junho 11, 2014 10 anos Autor Frenesy Esse Script Nao Ta Funcionando Corretamente O Npc Ta Falando Q Eu Nao Tenho O Item J Ja Coloquei o Id E Nada Alguem Sabe Resolver??
Postado Junho 11, 2014 10 anos @wesleyyy segunda vez que peço para tomar cuidado com double post,como você é um membro novo eu vou deixar passar mais uma vez.Caso precise acrescentar alguma coisa que esqueceu ou algo do tipo é só editar o ultimo comentario,não tem necessidade de criar mais um amigo ! Leia as regras do fórum : http://www.tibiaking.com/forum/forum/23-regras-do-forum/ Ajudei = REP+ Não dou suporte por PM qualquer dúvida procure no fórum,caso não encontre oque procura crie um tópico. [email protected]" /> | TFS 0.4 DEV | %5Bcreaturescript%5D Icones no minimap com descrição%5Btalkaction%5D Adicionar ou remover VIP do player.%5Bcreaturescripts%5D Senha para porta%5Btalkaction%5D Mandar mensagem para pasta do servidorMapa Evento War Castle%5Baction%5D Canoa em MovimentoTeleport Scroll System%5Bcreaturescripts%5D Recompensa por level para X vocations%5Btalkaction%5D Adicionar X item para o player%5Btalkactions%5D Adicionar item para todos players online%5Baction%5D Item que teleporta o player para house[action+movement] Passaporte para entrar no barco
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.