Ir para conteúdo

Featured Replies

Postado

Galera, to precisando de uma ajuda... Coloquei no meu client um sistema de quando coloca o pokemon, aparece a imagem dele em cima da pokebola, em 3d, porém tem algum erro que eu não sei qual é, que o pokemon não aparece..
 

Já tenho as imagens certinhas e tal, tudo configurado, mas deve ter algum errinho que eu nao achei, queria saber se vocês podem me ajudar... Quem ajudar, dou rep+ !

post-23517-0-03562500-1412011589_thumb.p

Postado

como vamos ajuda sem ver o sistema? 

esse sistema de chama Heal Barra, algo do tipo,

 

Galera, to precisando de uma ajuda... Coloquei no meu client um sistema de quando coloca o pokemon, aparece a imagem dele em cima da pokebola, em 3d, porém tem algum erro que eu não sei qual é, que o pokemon não aparece..

 

Já tenho as imagens certinhas e tal, tudo configurado, mas deve ter algum errinho que eu nao achei, queria saber se vocês podem me ajudar... Quem ajudar, dou rep+ !

 Coruja para fazer isso você precisa ter a scripter dentro da pasta do server.

  • 4 weeks later...
Postado
  • Autor

Eu já tenho esse script no meu OTC, mas não ta funcionando, não sei pq... :s

 

é o Game_Health...

Vê ai pra mim se tem algo errado ? e.e

 

-- Local variables

local barWindow = nil
local barPanel = nil
local barButton = nil
local healthBar = nil
local pokeHealthBar = nil
local invButton = nil
local orderIcon = nil
local healthTooltip = 'Your character health is %d out of %d.'
local pokeHealthTooltip = 'Your pokemon health is %d out of %d.'
local pbs = {}
local path = '/images/ui/pxg/topMenu_icons/'
 
local currentSlot = 0
 
local fightModeRadioGroup = nil
local fightOffensiveBox = nil
local fightBalancedBox = nil
local fightDefensiveBox = nil
 
local InventorySlotStyles = {
  [inventorySlotHead] = "HeadSlot",
  [inventorySlotNeck] = "NeckSlot",
  [inventorySlotBack] = "BackSlot",
  [inventorySlotBody] = "BodySlot",
  [inventorySlotRight] = "RightSlot",
  [inventorySlotLeft] = "LeftSlot",
  [inventorySlotLeg] = "LegSlot",
  [inventorySlotFeet] = "FeetSlot",
  [inventorySlotFinger] = "FingerSlot", 
  [inventorySlotAmmo] = "AmmoSlot"
}
-- End local variables
 
-- Public functions
function init()
   barWindow = g_ui.loadUI('HealthBar', modules.game_interface.getRightPanel())  
   barWindow:disableResize()
   barPanel = barWindow:getChildById('contentsPanel')
   
   barButton = modules.client_topmenu.addRightGameButton('barButton', 'Pokemon', path..'pokemon_icon_apagado', toggle, false)
   barButton:setVisible(false)
   
   healthBar = barWindow:recursiveGetChildById("healthBar")
   pokeHealthBar = barWindow:recursiveGetChildById("pokeHealthBar")
   
   invButton = barWindow:recursiveGetChildById("invButton")
   invButton:setVisible(false)
   
   fightOffensiveBox = barWindow:recursiveGetChildById('fightOffensiveBox')
   fightBalancedBox = barWindow:recursiveGetChildById('fightBalancedBox')
   fightDefensiveBox = barWindow:recursiveGetChildById('fightDefensiveBox')
   
   fightModeRadioGroup = UIRadioGroup.create()
   fightModeRadioGroup:addWidget(fightOffensiveBox)
   fightModeRadioGroup:addWidget(fightBalancedBox)
   fightModeRadioGroup:addWidget(fightDefensiveBox)
   
   connect(LocalPlayer, { onInventoryChange = onInventoryChange,
                          onHealthChange = onHealthChange,
                          onManaChange = onManaChange,
                          onStatesChange = onStatesChange})
   connect(g_game, 'onTextMessage', onPokeHealthChange)
   connect(g_game, 'onTextMessage', onNewPortrait)
   connect(g_game, { onGameStart = refresh,
                     onGameEnd = hide,
                     onFightModeChange = update })
   connect(fightModeRadioGroup, { onSelectionChange = onSetFightMode })
   
   createPbs()
   
   barWindow:setup()
   --barWindow:open()
end
 
function terminate()
   disconnect(LocalPlayer, { onInventoryChange = onInventoryChange,
                             onHealthChange = onHealthChange,
                             onManaChange = onManaChange,
                             onStatesChange = onStatesChange})
   disconnect(g_game, 'onTextMessage', onPokeHealthChange)
   disconnect(g_game, 'onTextMessage', onNewPortrait)
   disconnect(g_game, { onGameStart = refresh,
                     onGameEnd = hide,
                     onFightModeChange = update })
   disconnect(fightModeRadioGroup, { onSelectionChange = onSetFightMode })
   
   fightModeRadioGroup:destroy()
   barPanel:destroy()
   barWindow:destroy()
end
 
--[[  OnChange  ]]--
function onHealthChange(localPlayer, health, maxHealth)
  healthBar:setText(health .. ' / ' .. maxHealth)
  barWindow:recursiveGetChildById("healthIcon"):setTooltip(tr(healthTooltip, health, maxHealth))
  healthBar:setValue(health, 0, maxHealth)
end
 
function onPokeHealthChange(mode, text)
if not g_game.isOnline() then return end
   if mode == MessageModes.Failure then 
      if string.find(text, '#ph#,') then
         local t = text:explode(',')
         local hp, maxHp = tonumber(t[2]), tonumber(t[3])
         pokeHealthBar:setText(hp .. ' / ' .. maxHp)
         barWindow:recursiveGetChildById("pokeHealthIcon"):setTooltip(tr(pokeHealthTooltip, hp, maxHp))
         pokeHealthBar:setValue(hp, 0, maxHp)
      end
   end
end 
 
function onManaChange(localPlayer, mana, maxMana)
  for i = 1, 6 do
      if i > tonumber(mana) then
         pbs:setImageSource('/modules/game_health/img/pb_apagada')
      else
         pbs:setImageSource('/modules/game_health/img/pb_acessa')
      end
  end
end    
 
function onInventoryChange(player, slot, item, oldItem)
  if slot >= InventorySlotPurse then return end
  local itemWidget = barPanel:getChildById('slot' .. slot)
  if itemWidget then
     if item then
        itemWidget:setStyle(InventorySlotStyles[slot])
        itemWidget:setItem(item)
     else
        itemWidget:setStyle(InventorySlotStyles[slot])
        itemWidget:setItem(nil)
     end
  end
end
 
function onStatesChange(localPlayer, now, old)
if now == old then return end
 
  local bitsChanged = bit32.bxor(now, old)
  for i = 1, 32 do
    local pow = math.pow(2, i-1)
    if pow > bitsChanged then break end
    local bitChanged = bit32.band(bitsChanged, pow)
    if bitChanged ~= 0 then
      if bitChanged == 128 then 
         toggleBattle()
      end
    end
  end
end
 
function onSetFightMode(self, selectedFightButton)
  if selectedFightButton == nil then return end
  local buttonId = selectedFightButton:getId()
  local fightMode
  if buttonId == 'fightOffensiveBox' then
    fightMode = FightOffensive
  elseif buttonId == 'fightBalancedBox' then
    fightMode = FightBalanced
  else
    fightMode = FightDefensive
  end
  g_game.setFightMode(fightMode)
  if g_game.isOnline() then g_game.talk('/fightmode '.. fightMode) end
end
--[[  End onChange  ]]--
 
function toggle()
   if barWindow:isVisible() then
      barButton:setIcon(path..'pokemon_icon_apagado')
      barWindow:close()
   else
      barButton:setIcon(path..'pokemon_icon')
      barWindow:open()
   end
end
 
function toggleBattle()
   if invButton:isVisible() then
      invButton:setVisible(false)
   else
      invButton:setVisible(false)
   end
end
 
function refresh()
  if barWindow:isVisible() then
     barButton:setIcon(path..'pokemon_icon')
  end
  online()
  local player = g_game.getLocalPlayer()
  for i=InventorySlotFirst,InventorySlotLast do
    if g_game.isOnline() then
      onInventoryChange(player, i, player:getInventoryItem(i))
    else
      onInventoryChange(player, i, nil)
    end
  end
end
 
function hide()
   barButton:setVisible(false)
end
 
function update()
  local fightMode = g_game.getFightMode()
  if fightMode == FightOffensive then
    fightModeRadioGroup:selectWidget(fightOffensiveBox)
  elseif fightMode == FightBalanced then
    fightModeRadioGroup:selectWidget(fightBalancedBox)
  else
    fightModeRadioGroup:selectWidget(fightDefensiveBox)
  end
end
 
function online()
  local player = g_game.getLocalPlayer()
  if player then
    local char = g_game.getCharacterName()
 
    local lastCombatControls = g_settings.getNode('LastCombatControls')
 
    if not table.empty(lastCombatControls) then
      if lastCombatControls[char] then
        g_game.setFightMode(lastCombatControls[char].fightMode)
      end
    end
  end
  if g_game.isOnline() then
     barButton:setVisible(false)
  end
  update()
end
 
function createPbs()
   for i = 1, 6 do
       pbs = g_ui.createWidget((i == 1 and 'pbButtonIni' or 'pbButton'), barWindow)
       pbs:setId('pb'..i)
   end 
end
 
function onMiniWindowClose()
end
 
function startChooseItem(releaseCallback)
  if not releaseCallback then
    error("No mouse release callback parameter set.")
  end
  local mouseGrabberWidget = g_ui.createWidget('UIWidget')
  mouseGrabberWidget:setVisible(false)
  mouseGrabberWidget:setFocusable(false)
 
  connect(mouseGrabberWidget, { onMouseRelease = releaseCallback })
 
  mouseGrabberWidget:grabMouse()
  g_mouse.pushCursor('target')
end
 
function onClickWithMouse(self, mousePosition, mouseButton)
  local item = nil
  if mouseButton == MouseLeftButton then
    local clickedWidget = modules.game_interface.getRootPanel():recursiveGetChildByPos(mousePosition, false)
    if clickedWidget then
      if clickedWidget:getClassName() == 'UIMap' then
        local tile = clickedWidget:getTile(mousePosition)
        if tile then
          if currentSlot == 1 then
             item = tile:getGround()
          else
              local thing = tile:getTopMoveThing()
              if thing and thing:isItem() then
                 item = thing
              else
                 item = tile:getTopCreature()
              end
          end
        elseif clickedWidget:getClassName() == 'UIItem' and not clickedWidget:isVirtual() then
           item = clickedWidget:getItem()
        end
      end
    end
  end
    if item then
       if currentSlot == 6 and not item:isPlayer() then
          modules.game_textmessage.displayFailureMessage('Use it only in players!')
       else   
          local player = g_game.getLocalPlayer()               --2  --6 pokedex
          g_game.useInventoryItemWith(player:getInventoryItem(currentSlot):getId(), item) 
       end
    end
  g_mouse.popCursor()
  self:ungrabMouse()
  self:destroy()
end
 
function toggleOrderIcon()
   currentSlot = 4
   startChooseItem(onClickWithMouse)
end
 
function onNewPortrait(mode, text)
  if not g_game.isOnline() then return end
  if mode == MessageModes.Failure then
    if string.find(text, "#NP#") then
 local t = string.explode(text, ",")
 local poke = t[2]
  local port = barWindow:recursiveGetChildById("portraitt")
  local image = "data/images/pokes/"..poke..".gif"
      port:setImageSource(image)
    end
  end
end
-- End public functions

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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo