
Tudo que Frenesy postou
-
(Resolvido)Venda de comandos por NPC, tem como?
Blessing é todas as 5 benções, né? Quanto custaria? E o que seria essa tal de Bless PvP que reduz 30%? É só 1 Bless? Se for só 1 bless, qual seria? Dê mais detalhes pra reformular o NPC.
-
(Resolvido)Venda de comandos por NPC, tem como?
Que tal assim? 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, 'Bless') or msgcontains(msg, 'bless')) then selfSay('Vejamos, posso vender pra você agora o Comando {bless full} ou {Blessing} e também {Bless PvP}, o que deseja?', cid) talkState[talkUser] = 1 elseif(msgcontains(msg, 'Comando') or msgcontains(msg, 'comando') or msgcontains(msg, 'Bless Full') or msgcontains(msg, 'bless full')) then selfSay('Eu posso vender para você o comando "!bless full". No entanto, ele custa {10.000 gold coin}. Deseja comprar?', cid) talkState[talkUser] = 2 elseif((msgcontains(msg, 'Yes') or msgcontains(msg, 'yes')) and talkState[talkUser] == 2) then if getPlayerStorageValue(cid,834005) == 1 then selfSay('Você já comprou esse comando.', cid) talkState[talkUser] = 0 else if doPlayerRemoveMoney(cid, 10000) == TRUE then selfSay('Pronto! Agora você pode usar o comando {!bless full}', cid) doSendMagicEffect(getPlayerPosition(cid), 49) setPlayerStorageValue(cid, 834005, 1) talkState[talkUser] = 0 else selfSay('Você não tem o dinheiro necessário.', cid) talkState[talkUser] = 0 end end elseif((msgcontains(msg, 'No') or msgcontains(msg, 'no')) and talkState[talkUser] == 2) then selfSay('Sem problemas.', cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
(Resolvido)Venda de comandos por NPC, tem como?
Você tem certeza que instalou corretamente a talkaction? Porque cara, eu acabei de testar aqui e deu tudo certo. Verifica de novo aí com calma.
-
(Resolvido)Venda de comandos por NPC, tem como?
Sim. 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, 'Comando') or msgcontains(msg, 'comando')) then selfSay('Vejamos, posso vender pra você agora o Comando {bless full} ou {Blessing} e também {Bless PvP}, o que deseja?', cid) talkState[talkUser] = 1 elseif((msgcontains(msg, 'Bless Full') or msgcontains(msg, 'bless full')) and talkState[talkUser] == 1) then selfSay('O comando "!bless full" custa {10.000 gold coin}. Deseja comprar?', cid) talkState[talkUser] = 2 elseif((msgcontains(msg, 'Yes') or msgcontains(msg, 'yes')) and talkState[talkUser] == 2) then if getPlayerStorageValue(cid,834005) == 1 then selfSay('Você já comprou esse comando.', cid) talkState[talkUser] = 0 else if doPlayerRemoveMoney(cid, 10000) == TRUE then selfSay('Pronto! Agora você pode usar o comando {!bless full}', cid) doSendMagicEffect(getPlayerPosition(cid), 49) setPlayerStorageValue(cid, 834005, 1) talkState[talkUser] = 0 else selfSay('Você não tem o dinheiro necessário.', cid) talkState[talkUser] = 0 end end elseif((msgcontains(msg, 'No') or msgcontains(msg, 'no')) and talkState[talkUser] == 2) then selfSay('Sem problemas.', cid) talkState[talkUser] = 0 end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
(Resolvido)Venda de comandos por NPC, tem como?
Tem que ver se você instalou a talkaction corretamente. Eu testei aqui essa parte e deu certo. Refaça os passos e veja como fica. Se mesmo assim não der certo, avise aqui. Veja se dar certo. Dialogo: Hi > Comando > bless full > yes 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 if(msgcontains(msg, 'Comando') or msgcontains(msg, 'comando')) then selfSay('Vejamos, posso vender pra você agora o Comando {bless full} ou {Blessing} e também {Bless PvP}, o que deseja?', cid) talkState[talkUser] = 1 elseif((msgcontains(msg, 'Bless Full') or msgcontains(msg, 'bless full')) and talkState[talkUser] == 1) then selfSay('O comando "!bless full" custa {10.000 gold coin}. Deseja comprar?', cid) talkState[talkUser] = 2 elseif((msgcontains(msg, 'Yes') or msgcontains(msg, 'yes')) and talkState[talkUser] == 2) then if getPlayerStorageValue(cid,834005) == 1 then selfSay('Você já comprou esse comando.', cid) talkState[talkUser] = 0 else if doPlayerRemoveMoney(cid, 10000) == TRUE then selfSay('Pronto! Agora você pode usar o comando {!bless full}', cid) doSendMagicEffect(getPlayerPosition(cid), 49) setPlayerStorageValue(cid, 834005, 1) talkState[talkUser] = 0 else selfSay('Você não tem o dinheiro necessário.', cid) talkState[talkUser] = 0 end end elseif((msgcontains(msg, 'No') or msgcontains(msg, 'no')) and talkState[talkUser] == 2) then selfSay('Sem problemas.', cid) talkState[talkUser] = 0 end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) É o seguinte, não acontece nada porque eu não adicionei. To focando apenas no comando. Instale a Talkaction corretamente, instale o script do NPC que passei ai em cima e tenta usar o diálogo que mandei logo acima também e veja se da certo. Dando certo, a gente passa pra essas Blessing e Bless PvP aí. Vamos uma coisa de cada vez.
-
(Resolvido)Venda de comandos por NPC, tem como?
Ok, então vejamos. Fiz um aqui sem testar. Vejamos como fica. Começando com o NPC: Ana.xml <?xml version="1.0"?> <npc name="Ana" script="Ana.lua" walkinterval="2000"> <health now="200" max="200" /> <look type="136" head="113" body="65" legs="0" feet="96" addons="2"/> <parameters> <parameter key="message_greet" value="Ola, sou a vendedora de benção desta cidade, você gostaria de verificar minhas lista de {Bless} ou comprar o Comando !bless full?. Diga {Trade}." /> </parameters> </npc> Ana.lua 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 if(msgcontains(msg, 'Trade') or msgcontains(msg, 'trade')) then selfSay('Vejamos, posso vender pra você agora o Comando {!bless full} ou {Blessing} e também {Bless PvP}, o que deseja?', cid) talkState[talkUser] = 1 elseif((msgcontains(msg, '!bless full') or msgcontains(msg, 'bless full')) and talkState[talkUser] == 1) then selfSay('O comando "!bless full" custa {10.000 gold coin}. Deseja comprar?', cid) talkState[talkUser] = 0 talkState[talkUser] = 2 elseif((msgcontains(msg, 'Yes') or msgcontains(msg, 'yes')) and talkState[talkUser] == 2) then if getPlayerStorageValue(cid,834005) == 1 then selfSay('Você já comprou esse comando.', cid) talkState[talkUser] = 0 else if doPlayerRemoveMoney(cid, 10000) == TRUE then selfSay('Pronto! Agora você pode usar o comando {!bless full}', cid) doSendMagicEffect(getPlayerPosition(cid), 49) setPlayerStorageValue(cid, 834005, 1) talkState[talkUser] = 0 else selfSay('Você não tem o dinheiro necessário.', cid) talkState[talkUser] = 0 end end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) Agora o comando. Talkaction.xml <talkaction words="!Bless Full;!bless full" script="Bless.lua"/> Bless.lua local bless = {1, 2, 3, 4, 5} function onSay(cid, words, param) for i = 1, table.maxn(bless) do if(getPlayerBlessing(cid, bless[i])) then doPlayerSendCancel(cid, "Você já possui todas as Benções.") return TRUE end end if getPlayerStorageValue(cid,834005) == 1 then for i = 1, table.maxn(bless) do doPlayerAddBlessing(cid, bless[i]) end doCreatureSay(cid, "Você recebeu as Benções dos Deuses!" ,19) doSendMagicEffect(getPlayerPosition(cid), 49) else doPlayerSendCancel(cid, "Você não tem o comando, compre na npc X.") end return TRUE end
-
(Resolvido)Venda de comandos por NPC, tem como?
Tudo bem. Faz o seguinte. Me dê as seguintes coisas: - O Script de um comando que você planeja vender. - A ID de um item qualquer que você não use no servidor para por a venda no NPC.
-
(Resolvido)Venda de comandos por NPC, tem como?
É só por nos comandos que quer vender um requisito de storage. (O player precisa de storage para usar tal comando) E no NPC, colocar pra dar tal storage pro player valendo certa quantia. Caso queira a janela de trade, é só selecionar um item qualquer para representar cada comando e por pra vender normalmente no NPC. Ai ao comprar o item, clicar nele e ganhar a storage.
-
Uma Duvida Rápida
Como faço pra verificar o ExtraAttack de um item equipado na minha mão dentro da function onGetFormulaValues? Eu tentei assim e de várias outras maneiras mais não consegui. Alguém me dá uma nova opção, por favor. function onGetFormulaValues(cid, level, skill) local danos = getItemExtraAttack(getPlayerSlotItem(cid, 6).uid) return -((50 + danos)) end
-
Melhorar Sript
Como funciona o NPC? Tipo, o participante ao falar com esse NPC, ele é teleportado para tal área esperando os outros participantes? Ou ao falar com o NPC, eles simplesmente ganham uma Storage e só são teleportados quando tiver pessoas necessárias?
-
ajudem a impedir a segunda action
Que bom que deu certo. Se eu ajudei em algo, já sabe né? REP+ ActionID não possuem value.
-
ajudem a impedir a segunda action
Estranho você dizer que o Script está funcionando perfeitamente, pois instalei ele aqui sem alteração e ele não funciona. Enfim... Vou editar sem testar. Testa você aí em seu servidor e veja se funciona. SUGESTÃO #01 function onUse(cid, item, frompos, itemEx, topos) if getTopCorpse(topos) == null or itemEx.actionid ~= 2497 then return true end if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 or getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue (cid, 17001) >= 1 or getPlayerStorageValue(cid, 75846) >= 1 or getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 or getPlayerStorageValue (cid, 98752) >= 1 then --alterado v1.9 return doPlayerSendCancel(cid, "impossivel fazer isso agora.") end if not isCreature(itemEx.uid) then doCreatureSetNoMove(cid, true) local tmp = getCreatureOutfit(cid) if getPlayerSex(cid) == 1 then tmp.lookType = 2501 else tmp.lookType = 2500 end doSetCreatureOutfit(cid, tmp, -1) setPlayerStorageValue(cid, 98752, 1) -------------------------------------------------- function finalizar(cid,toPos) doRemoveCondition(cid, CONDITION_OUTFIT) doCreatureSetNoMove(cid, false) local itemEx = getTopCorpse(topos) local rand = math.random(1, 5) if itemEx then doPlayerAddItem(cid, 15500, rand) doItemSetAttribute(itemEx.uid,'aid', 2497) end setPlayerStorageValue(cid, 98752, -1) end addEvent(finalizar, 8*1000,cid,toPos) --------------------------------------------- end return true end SUGESTÃO #02 function onUse(cid, item, frompos, itemEx, topos) if getTopCorpse(topos) == null then return true end if getPlayerStorageValue(cid, 17001) >= 1 or getPlayerStorageValue(cid, 63215) >= 1 or getPlayerStorageValue(cid, 17000) >= 1 or getPlayerStorageValue (cid, 17001) >= 1 or getPlayerStorageValue(cid, 75846) >= 1 or getPlayerStorageValue(cid, 6598754) >= 1 or getPlayerStorageValue(cid, 6598755) >= 1 or getPlayerStorageValue (cid, 98752) >= 1 then --alterado v1.9 return doPlayerSendCancel(cid, "impossivel fazer isso agora.") end if not isCreature(itemEx.uid) then doCreatureSetNoMove(cid, true) local tmp = getCreatureOutfit(cid) if getPlayerSex(cid) == 1 then tmp.lookType = 2501 else tmp.lookType = 2500 end doSetCreatureOutfit(cid, tmp, -1) setPlayerStorageValue(cid, 98752, 1) -------------------------------------------------- function finalizar(cid,toPos) doRemoveCondition(cid, CONDITION_OUTFIT) doCreatureSetNoMove(cid, false) local itemEx = getTopCorpse(topos) local rand = math.random(1, 5) if itemEx and itemEx.actionid ~= 2497 then doPlayerAddItem(cid, 15500, rand) doItemSetAttribute(itemEx.uid,'aid', 2497) end setPlayerStorageValue(cid, 98752, -1) end addEvent(finalizar, 8*1000,cid,toPos) --------------------------------------------- end return true end
-
[MOD] OTClient
Alguém aqui que saiba fazer MODs de OTClient para fazer um bem simples para mim? Coisa bem rápida mesmo.
-
ajudem a impedir a segunda action
Eu na verdade ia fazer, só que eu não entendi bem seu script e nem sua finalidade real. Faz assim, posta exatamente o que o script faz que eu tento fazer.
-
ajudem a impedir a segunda action
Uma sugestão seria adicionar uma ActionID pra cada item usado, deixando eles 'marcados' por assim dizer. Tipo assim: Primeiro você checa se o item NÃO TEM actionID: Ai ao usar o Item[1] no Item[2] como você quer, você adiciona a ActionID 2497 no Item[2] para não poder usar nele novamente, assim: Fazendo isso, você não poderá mais usar o Item[1] no Item[2] que ficou com a ActionID. Bom, é só uma sugestão. Espero que der certo.
-
OTClient GIF
Oi Galera, beleza? Então... Estou executando um GIF no OTClient. Funciona tudo normal. No entanto, ele só executa do início ao fim na primeira vez que é executado. Se for executar novamente algum tempo tempo depois, ele não executa a partir do início. Ele executa do meio do GIF (animação). É como se você coloca-se um filme pra assistir, e ao abrir o filme, ele já começar da metade. Eu imagino que o GIF, ao ser executado pela primeira vez, ele continua em execução em segundo plano, mesmo sem ser ativado. Então minha dúvida/problema é: "Existe alguma forma de o GIF ser executado apenas quando acionado a função? Sem que ele fique em execução em segundo plano?" Meio difícil alguém me responder, mas... Minha dúvida ta aí. Obrigado desde já!
-
Como colocar som no mapa no OTClient
@login12, se for só esse o problema, as funções ta aqui: CLIQUE AQUI Acredito que uma modificação no Script do nosso amigo aqui do poster já deve ser o suficiente. Acredito eu que um jeito mais fácil possa ser por SendCancel (a famosa gambiarra do opcodes) Quebra esse galho pra gente. O que parece ser fácil pra você não é pra nós. Grande Abraço!
- [8.60] The Forgotten Server 0.4 By Fir3Element (SQL and MYSQL)
- Como colocar som no mapa no OTClient
-
Como colocar som no mapa no OTClient
kkkkkkkk mano... você é o cara mesmo! E ainda postou tudo "mastigadinho" pra gente ainda. É assim que se faz, broh. Se ajudar apenas quando receber ajuda, aí o brasil não vai pra frente. kkkkk Aqui no fórum nós contribuirmos com o temos pra ajudar o máximo de pessoas e fazer uma excelente database de conteúdo pra todos. Agradeço por contribuir com isso. Ajudou não só a mim mais a todos que estavam loucos atrás disso aí. Já instalei aqui, testei e ficou - como diz o meu primo - "só o filé". Minhas quests agora vão ter trilha sonora. Grande abraço! REP+
-
(Resolvido)Quest Log
g_game.requestQuestLine(1)
-
OtClient com musica
Lance de fórum e assim mesmo, bro. Todos aqui é voluntário e ninguém é obrigado a nada. Se te ajudarem, ótimo. Se não te ajudarem, paciência. Não dá pra exigir algo que é feito voluntariamente, né? Mas então, que bom que deu certo pra você. O Mod de som disponibilizado aqui no TK não funcione e eu não sei o motivo. Como o dono do tópico lá não aparece, quem está interessado no Mod fica à deriva. Quando puder, posta esse pack que criou. Mesmo não sendo compatível com outros OTCliente - já que você compilou o seu próprio - ao menos vai servir de base pra gente fazer o nosso. Grande abraço!
-
OtClient com musica
Cara, se resolveu, você precisa postar a solução para outros - eu - saberem como resolver também caso tenham o mesmo problema. Seja solidário e ajude.
-
(Resolvido)Quest Log
Fala pessoal, beleza? Então... Tentei de tudo aqui e não consegui. Desisti e vim pedir ajuda. É o seguinte: Estou fazendo um novo layout do meu Quest Log. Ele vai ficar assim: Bom, até aí eu consegui - como podem ver na imagem. O problema é o seguinte: Não consigo fazer as missões aparecerem na janela ali do lado. Já tentei de tudo, mas nada. Quem puder me ajudar, vou mandar o .lua que precisa ser editado. questLogButton = nil questLineWindow = nil function init() g_ui.importStyle('questlogwindow') g_ui.importStyle('questlinewindow') questLogButton = modules.client_topmenu.addLeftGameButton('questLogButton', tr('Quest Log'), '/images/topbuttons/questlog', function() g_game.requestQuestLog() end) connect(g_game, { onQuestLog = onGameQuestLog, onQuestLine = onGameQuestLine, onGameEnd = destroyWindows}) end function terminate() disconnect(g_game, { onQuestLog = onGameQuestLog, onQuestLine = onGameQuestLine, onGameEnd = destroyWindows}) destroyWindows() questLogButton:destroy() end function destroyWindows() if questLogWindow then questLogWindow:destroy() end if questLineWindow then questLineWindow:destroy() end end function onGameQuestLog(quests) destroyWindows() questLogWindow = g_ui.createWidget('QuestLogWindow', rootWidget) local questList = questLogWindow:getChildById('questList') for i,questEntry in pairs(quests) do local id, name, completed = unpack(questEntry) local questLabel = g_ui.createWidget('QuestLabel', questList) questLabel:setOn(completed) questLabel:setText(name) questLabel.onDoubleClick = function() questLogWindow:hide() g_game.requestQuestLine(id) end end questLogWindow.onDestroy = function() questLogWindow = nil end questList:focusChild(questList:getFirstChild()) end function onGameQuestLine(questId, questMissions) if questLogWindow then questLogWindow:hide() end if questLineWindow then questLineWindow:destroy() endz questLineWindow = g_ui.createWidget('QuestLineWindow', rootWidget) local missionList = questLineWindow:getChildById('missionList') local missionDescription = questLineWindow:getChildById('missionDescription') connect(missionList, { onChildFocusChange = function(self, focusedChild) if focusedChild == nil then return end missionDescription:setText(focusedChild.description) end }) for i,questMission in pairs(questMissions) do local name, description = unpack(questMission) local missionLabel = g_ui.createWidget('MissionLabel') missionLabel:setText(name) missionLabel.description = description missionList:addChild(missionLabel) end questLineWindow.onDestroy = function() if questLogWindow then questLogWindow:show() end questLineWindow = nil end missionList:focusChild(missionList:getFirstChild()) end Por favor, só uma ajudinha. Grande abraço!
-
[8.60] The Forgotten Server 0.4 By Fir3Element (SQL and MYSQL)
Uoow, @Fir3element! Valeu mesmo por ser tão rápido. Mas assim... Não estou conseguindo utilizar. Nem mesmo o... if isPlayerUsingOtclient(cid) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "YOU USE OTCLIENT") end ...está indo. Espero que eu não esteja fazendo nada de errado. Poderia me dar uma luz?