Ir para conteúdo
Propaganda

NpcDialog Modal Completo


Posts Recomendados

Tutorial de Instalação e Configuração do Módulo npcdialog

image.png.7bbb33b4dc014c900421b06c2c9bb262.png

Instalação

  1. Colocar a pasta do módulo no cliente:

    • Copie a pasta game interface e cole na pasta modules do seu cliente.
  2. Adicionar o arquivo da biblioteca no servidor:

    • Copie o arquivo npcdialog_lib e cole na pasta /servidor/data/lib do seu servidor.
  3. Inserir arquivos de exemplo do NPC:

    • Pegue o arquivo de NPC de exemplo chamado prefeito.
    • Coloque os arquivos eduardo.lua e eduardo.xml na pasta dos NPCs.

Configuração para Habilitar a Modal ao Clicar no NPC

  1. Editar a interface do jogo:

    • Dentro da pasta game interface, abra o arquivo necessário.
  2. Procurar pela função específica:

    • Procure pela função function processMouseAction.
  3. Substituir o código:

    • Substitua o conteúdo da função processMouseAction pelo código fornecido a seguir.
      function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, useThing, creatureThing, attackCreature, marking)
        local keyboardModifiers = g_keyboard.getModifiers()
      
        if g_app.isMobile() then
          if mouseButton == MouseRightButton then
            createThingMenu(menuPosition, lookThing, useThing, creatureThing)
            return true      
          end
          if mouseButton ~= MouseLeftButton and mouseButton ~= MouseTouch2 and mouseButton ~= MouseTouch3 then
            return false
          end
          local action = getLeftAction()
          if action == "look" then
            if lookThing then
              resetLeftActions()
              g_game.look(lookThing)
              return true    
            end
            return true    
          elseif action == "use" then
            if useThing then
              resetLeftActions()
              if useThing:isContainer() then
                if useThing:getParentContainer() then
                  g_game.open(useThing, useThing:getParentContainer())
                else
                  g_game.open(useThing)
                end
                return true
              elseif useThing:isMultiUse() then
                startUseWith(useThing)
                return true
              else
                g_game.use(useThing)
                return true
              end
            end
            return true
          elseif action == "attack" then
            if attackCreature and attackCreature ~= player then
              resetLeftActions()
              g_game.attack(attackCreature)
              return true
            elseif creatureThing and creatureThing ~= player and creatureThing:getPosition().z == autoWalkPos.z then
              resetLeftActions()
              g_game.attack(creatureThing)
              return true
            end
            return true
          elseif action == "follow" then
            if attackCreature and attackCreature ~= player then
              resetLeftActions()
              g_game.follow(attackCreature)
              return true
            elseif creatureThing and creatureThing ~= player and creatureThing:getPosition().z == autoWalkPos.z then
              resetLeftActions()
              g_game.follow(creatureThing)
              return true
            end
            return true
          elseif not autoWalkPos and useThing then
            createThingMenu(menuPosition, lookThing, useThing, creatureThing)      
            return true
          end
        elseif not modules.client_options.getOption('classicControl') then
          if keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
            createThingMenu(menuPosition, lookThing, useThing, creatureThing)
            return true
          elseif lookThing and keyboardModifiers == KeyboardShiftModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.look(lookThing)
            return true
          elseif useThing and keyboardModifiers == KeyboardCtrlModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            if useThing:isContainer() then
              if useThing:getParentContainer() then
                g_game.open(useThing, useThing:getParentContainer())
              else
                g_game.open(useThing)
              end
              return true
            elseif useThing:isMultiUse() then
              startUseWith(useThing)
              return true
            else
              g_game.use(useThing)
              return true
            end
            return true
          elseif attackCreature and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.attack(attackCreature)
            return true
          elseif creatureThing and creatureThing:getPosition().z == autoWalkPos.z and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.attack(creatureThing)
            return true
      	elseif creatureThing.isNpc() and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            local destPos = attackCreature:getPosition()
                 local myPos = g_game.getLocalPlayer():getPosition()                       
      			 if ((destPos.x >= myPos.x - 3) and (destPos.x <= myPos.x + 3) and (destPos.y >= myPos.y - 3) and (destPos.y <= myPos.y + 3)) then
      			   scheduleEvent(g_game.talkChannel(11,0,"hi"), 500)
      			 else
      				modules.game_textmessage.displayFailureMessage("Você não pode conversar com o NPC pois você está muito longe. Aproxime-se e tente novamente.")
      			 end
      	 return true
          end
        else
          if useThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton and not g_mouse.isPressed(MouseLeftButton) then
            local player = g_game.getLocalPlayer()
            if attackCreature and attackCreature ~= player then
              if not attackCreature:isNpc() then
                 g_game.attack(attackCreature)
              else
      		   local destPos = attackCreature:getPosition()
                 local myPos = player:getPosition()                       
      			 if ((destPos.x >= myPos.x - 3) and (destPos.x <= myPos.x + 3) and (destPos.y >= myPos.y - 3) and (destPos.y <= myPos.y + 3)) then
      			   scheduleEvent(g_game.talkChannel(11,0,"hi"), 500)
      			 else
      				modules.game_textmessage.displayFailureMessage("Você não pode conversar com o NPC pois você está muito longe. Aproxime-se e tente novamente.")
      			 end
      		end
              return true
            elseif creatureThing and creatureThing ~= player and creatureThing:getPosition().z == autoWalkPos.z then
              g_game.attack(creatureThing)
              return true
            elseif useThing:isContainer() then
              if useThing:getParentContainer() then
                g_game.open(useThing, useThing:getParentContainer())
                return true
              else
                g_game.open(useThing)
                return true
              end
            elseif useThing:isMultiUse() then
              startUseWith(useThing)
              return true
            else
              g_game.use(useThing)
              return true
            end
            return true
          elseif lookThing and keyboardModifiers == KeyboardShiftModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.look(lookThing)
            return true
          elseif lookThing and ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then
            g_game.look(lookThing)
            return true
          elseif useThing and keyboardModifiers == KeyboardCtrlModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            createThingMenu(menuPosition, lookThing, useThing, creatureThing)
            return true
          elseif attackCreature and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.attack(attackCreature)
            return true
          elseif creatureThing and creatureThing:getPosition().z == autoWalkPos.z and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.attack(creatureThing)
            return true
          end
        end
      
        local player = g_game.getLocalPlayer()
        player:stopAutoWalk()  
      
        if autoWalkPos and keyboardModifiers == KeyboardNoModifier and (mouseButton == MouseLeftButton or mouseButton == MouseTouch2 or mouseButton == MouseTouch3) then
          local autoWalkTile = g_map.getTile(autoWalkPos)
          if autoWalkTile and not autoWalkTile:isWalkable(true) then
            modules.game_textmessage.displayFailureMessage(tr('Sorry, not possible.'))
            return false
          end
          player:autoWalk(autoWalkPos)
          return true
        end
      
        return false
      end

      Dentro da pasta fornecida com os arquivos tem o arquivo interface.lua, não utilize-o , ele serve para você poder comparar a linha, facilitando o trabalho.

      Pronto só aproveitar o module.

SCAM:

This is the hidden content, please

 

Créditos:Thales script para clicar no Npc.

NpcDialog.rar

  • Like 18
  • Thanks 3
Link para o comentário
Compartilhar em outros sites

  • Suporte

Boa tarde, tópico muito bom, agradecemos a contribuição!
Poderia postar o scan do rar?
 

Link para o comentário
Compartilhar em outros sites

  • Administrador
32 minutos atrás, eduardogaier disse:

Tutorial de Instalação e Configuração do Módulo npcdialog

image.png.7bbb33b4dc014c900421b06c2c9bb262.png

Instalação

  1. Colocar a pasta do módulo no cliente:

    • Copie a pasta game interface e cole na pasta modules do seu cliente.
  2. Adicionar o arquivo da biblioteca no servidor:

    • Copie o arquivo npcdialog_lib e cole na pasta /servidor/data/lib do seu servidor.
  3. Inserir arquivos de exemplo do NPC:

    • Pegue o arquivo de NPC de exemplo chamado prefeito.
    • Coloque os arquivos eduardo.lua e eduardo.xml na pasta dos NPCs.

Configuração para Habilitar a Modal ao Clicar no NPC

  1. Editar a interface do jogo:

    • Dentro da pasta game interface, abra o arquivo necessário.
  2. Procurar pela função específica:

    • Procure pela função function processMouseAction.
  3. Substituir o código:

    • Substitua o conteúdo da função processMouseAction pelo código fornecido a seguir.
      function processMouseAction(menuPosition, mouseButton, autoWalkPos, lookThing, useThing, creatureThing, attackCreature, marking)
        local keyboardModifiers = g_keyboard.getModifiers()
      
        if g_app.isMobile() then
          if mouseButton == MouseRightButton then
            createThingMenu(menuPosition, lookThing, useThing, creatureThing)
            return true      
          end
          if mouseButton ~= MouseLeftButton and mouseButton ~= MouseTouch2 and mouseButton ~= MouseTouch3 then
            return false
          end
          local action = getLeftAction()
          if action == "look" then
            if lookThing then
              resetLeftActions()
              g_game.look(lookThing)
              return true    
            end
            return true    
          elseif action == "use" then
            if useThing then
              resetLeftActions()
              if useThing:isContainer() then
                if useThing:getParentContainer() then
                  g_game.open(useThing, useThing:getParentContainer())
                else
                  g_game.open(useThing)
                end
                return true
              elseif useThing:isMultiUse() then
                startUseWith(useThing)
                return true
              else
                g_game.use(useThing)
                return true
              end
            end
            return true
          elseif action == "attack" then
            if attackCreature and attackCreature ~= player then
              resetLeftActions()
              g_game.attack(attackCreature)
              return true
            elseif creatureThing and creatureThing ~= player and creatureThing:getPosition().z == autoWalkPos.z then
              resetLeftActions()
              g_game.attack(creatureThing)
              return true
            end
            return true
          elseif action == "follow" then
            if attackCreature and attackCreature ~= player then
              resetLeftActions()
              g_game.follow(attackCreature)
              return true
            elseif creatureThing and creatureThing ~= player and creatureThing:getPosition().z == autoWalkPos.z then
              resetLeftActions()
              g_game.follow(creatureThing)
              return true
            end
            return true
          elseif not autoWalkPos and useThing then
            createThingMenu(menuPosition, lookThing, useThing, creatureThing)      
            return true
          end
        elseif not modules.client_options.getOption('classicControl') then
          if keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton then
            createThingMenu(menuPosition, lookThing, useThing, creatureThing)
            return true
          elseif lookThing and keyboardModifiers == KeyboardShiftModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.look(lookThing)
            return true
          elseif useThing and keyboardModifiers == KeyboardCtrlModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            if useThing:isContainer() then
              if useThing:getParentContainer() then
                g_game.open(useThing, useThing:getParentContainer())
              else
                g_game.open(useThing)
              end
              return true
            elseif useThing:isMultiUse() then
              startUseWith(useThing)
              return true
            else
              g_game.use(useThing)
              return true
            end
            return true
          elseif attackCreature and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.attack(attackCreature)
            return true
          elseif creatureThing and creatureThing:getPosition().z == autoWalkPos.z and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.attack(creatureThing)
            return true
      	elseif creatureThing.isNpc() and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            local destPos = attackCreature:getPosition()
                 local myPos = g_game.getLocalPlayer():getPosition()                       
      			 if ((destPos.x >= myPos.x - 3) and (destPos.x <= myPos.x + 3) and (destPos.y >= myPos.y - 3) and (destPos.y <= myPos.y + 3)) then
      			   scheduleEvent(g_game.talkChannel(11,0,"hi"), 500)
      			 else
      				modules.game_textmessage.displayFailureMessage("Você não pode conversar com o NPC pois você está muito longe. Aproxime-se e tente novamente.")
      			 end
      	 return true
          end
        else
          if useThing and keyboardModifiers == KeyboardNoModifier and mouseButton == MouseRightButton and not g_mouse.isPressed(MouseLeftButton) then
            local player = g_game.getLocalPlayer()
            if attackCreature and attackCreature ~= player then
              if not attackCreature:isNpc() then
                 g_game.attack(attackCreature)
              else
      		   local destPos = attackCreature:getPosition()
                 local myPos = player:getPosition()                       
      			 if ((destPos.x >= myPos.x - 3) and (destPos.x <= myPos.x + 3) and (destPos.y >= myPos.y - 3) and (destPos.y <= myPos.y + 3)) then
      			   scheduleEvent(g_game.talkChannel(11,0,"hi"), 500)
      			 else
      				modules.game_textmessage.displayFailureMessage("Você não pode conversar com o NPC pois você está muito longe. Aproxime-se e tente novamente.")
      			 end
      		end
              return true
            elseif creatureThing and creatureThing ~= player and creatureThing:getPosition().z == autoWalkPos.z then
              g_game.attack(creatureThing)
              return true
            elseif useThing:isContainer() then
              if useThing:getParentContainer() then
                g_game.open(useThing, useThing:getParentContainer())
                return true
              else
                g_game.open(useThing)
                return true
              end
            elseif useThing:isMultiUse() then
              startUseWith(useThing)
              return true
            else
              g_game.use(useThing)
              return true
            end
            return true
          elseif lookThing and keyboardModifiers == KeyboardShiftModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.look(lookThing)
            return true
          elseif lookThing and ((g_mouse.isPressed(MouseLeftButton) and mouseButton == MouseRightButton) or (g_mouse.isPressed(MouseRightButton) and mouseButton == MouseLeftButton)) then
            g_game.look(lookThing)
            return true
          elseif useThing and keyboardModifiers == KeyboardCtrlModifier and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            createThingMenu(menuPosition, lookThing, useThing, creatureThing)
            return true
          elseif attackCreature and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.attack(attackCreature)
            return true
          elseif creatureThing and creatureThing:getPosition().z == autoWalkPos.z and g_keyboard.isAltPressed() and (mouseButton == MouseLeftButton or mouseButton == MouseRightButton) then
            g_game.attack(creatureThing)
            return true
          end
        end
      
        local player = g_game.getLocalPlayer()
        player:stopAutoWalk()  
      
        if autoWalkPos and keyboardModifiers == KeyboardNoModifier and (mouseButton == MouseLeftButton or mouseButton == MouseTouch2 or mouseButton == MouseTouch3) then
          local autoWalkTile = g_map.getTile(autoWalkPos)
          if autoWalkTile and not autoWalkTile:isWalkable(true) then
            modules.game_textmessage.displayFailureMessage(tr('Sorry, not possible.'))
            return false
          end
          player:autoWalk(autoWalkPos)
          return true
        end
      
        return false
      end

      Dentro da pasta fornecida com os arquivos tem o arquivo interface.lua, não utilize-o , ele serve para você poder comparar a linha, facilitando o trabalho.

      Pronto só aproveitar o module.

 

Créditos:Thales script para clicar no Npc.

NpcDialog.rar 409.25 kB · 1 download

Top demais, obrigado 😃 

Link para o comentário
Compartilhar em outros sites

33 minutos atrás, george192 disse:

Boa tarde, tópico muito bom, agradecemos a contribuição!
Poderia postar o scan do rar?
 

Salve postado

Link para o comentário
Compartilhar em outros sites

Participe da Conversa

Você pode postar agora e se cadastrar mais tarde. Cadastre-se Agora para publicar com Sua Conta.

Visitante
Responder

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.

×
  • Criar Novo...