Ir para conteúdo
  • 0

Barra, vida, mana, exp, ?


curruwilliam

Pergunta

Olá,

 

Podem me ajudar a colocar uma barra de vida, mana e exp igual fiz nessa imagem:

 

Imagem:

 

 

jSSQXvx.jpg

 

 

 

Quadrado Verde = Vida - Azul = Mana - Azul Claro = Exp e o Preto é aqueles icone de PZ tar com poison etc..

 

Agradeço desde já!! :D

Link para o comentário
Compartilhar em outros sites

9 respostass a esta questão

Posts Recomendados

  • 0

Acredito que o script das Health é esse:

 

Healthinfo.lua

 

 

Icons = {}
Icons[1] = { tooltip = tr('You are poisoned'), path = '/images/game/states/poisoned', id = 'condition_poisoned' }
Icons[2] = { tooltip = tr('You are burning'), path = '/images/game/states/burning', id = 'condition_burning' }
Icons[4] = { tooltip = tr('You are electrified'), path = '/images/game/states/electrified', id = 'condition_electrified' }
Icons[8] = { tooltip = tr('You are drunk'), path = '/images/game/states/drunk', id = 'condition_drunk' }
Icons[16] = { tooltip = tr('You are protected by a magic shield'), path = '/images/game/states/magic_shield', id = 'condition_magic_shield' }
Icons[32] = { tooltip = tr('You are paralysed'), path = '/images/game/states/slowed', id = 'condition_slowed' }
Icons[64] = { tooltip = tr('You are hasted'), path = '/images/game/states/haste', id = 'condition_haste' }
Icons[128] = { tooltip = tr('You may not logout during a fight'), path = '/images/game/states/logout_block', id = 'condition_logout_block' }
Icons[256] = { tooltip = tr('You are drowning'), path = '/images/game/states/drowning', id = 'condition_drowning' }
Icons[512] = { tooltip = tr('You are freezing'), path = '/images/game/states/freezing', id = 'condition_freezing' }
Icons[1024] = { tooltip = tr('You are dazzled'), path = '/images/game/states/dazzled', id = 'condition_dazzled' }
Icons[2048] = { tooltip = tr('You are cursed'), path = '/images/game/states/cursed', id = 'condition_cursed' }
Icons[4096] = { tooltip = tr('You are strengthened'), path = '/images/game/states/strengthened', id = 'condition_strengthened' }
Icons[8192] = { tooltip = tr('You may not logout or enter a protection zone'), path = '/images/game/states/protection_zone_block', id = 'condition_protection_zone_block' }
Icons[16384] = { tooltip = tr('You are within a protection zone'), path = '/images/game/states/protection_zone', id = 'condition_protection_zone' }
Icons[32768] = { tooltip = tr('You are bleeding'), path = '/images/game/states/bleeding', id = 'condition_bleeding' }
Icons[65536] = { tooltip = tr('You are hungry'), path = '/images/game/states/hungry', id = 'condition_hungry' }

healthInfoWindow = nil
healthBar = nil
manaBar = nil
experienceBar = nil
soulLabel = nil
capLabel = nil
healthTooltip = 'Your character health is %d out of %d.'
manaTooltip = 'Your character mana is %d out of %d.'
experienceTooltip = 'You have %d%% to advance to level %d.'

function init()
  connect(LocalPlayer, { onHealthChange = onHealthChange,
                         onManaChange = onManaChange,
                         onLevelChange = onLevelChange,
                         onStatesChange = onStatesChange,
                         onSoulChange = onSoulChange,
                         onFreeCapacityChange = onFreeCapacityChange })

  connect(g_game, { onGameEnd = offline })

  healthInfoButton = modules.client_topmenu.addRightGameToggleButton('healthInfoButton', tr('Health Information'), '/images/topbuttons/healthinfo', toggle)
  healthInfoButton:setOn(true)

  healthInfoWindow = g_ui.loadUI('healthinfo', modules.game_interface.getRightPanel())
  healthInfoWindow:disableResize()

  healthBar = healthInfoWindow:recursiveGetChildById('healthBar')
  manaBar = healthInfoWindow:recursiveGetChildById('manaBar')
  experienceBar = healthInfoWindow:recursiveGetChildById('experienceBar')
  soulLabel = healthInfoWindow:recursiveGetChildById('soulLabel')
  capLabel = healthInfoWindow:recursiveGetChildById('capLabel')

  healthInfoWindowHp = g_ui.displayUI('healthinfoHp', modules.game_interface.getRightPanel())
  healthInfoWindowMp = g_ui.displayUI('healthinfoMp', modules.game_interface.getRightPanel())
  healthInfoWindowXp = g_ui.displayUI('healthinfoXp', modules.game_interface.getRightPanel())

  healthInfoWindowHp:hide()
  healthInfoWindowMp:hide()
  healthInfoWindowXp:hide()

  healthBarP = healthInfoWindowHp:recursiveGetChildById('healthBar')
  manaBarP = healthInfoWindowMp:recursiveGetChildById('manaBar')
  experienceBarP = healthInfoWindowXp:recursiveGetChildById('experienceBar')

  -- load condition icons
  for k,v in pairs(Icons) do
    g_textures.preload(v.path)
  end

  if g_game.isOnline() then
    local localPlayer = g_game.getLocalPlayer()
    onHealthChange(localPlayer, localPlayer:getHealth(), localPlayer:getMaxHealth())
    onManaChange(localPlayer, localPlayer:getMana(), localPlayer:getMaxMana())
    onLevelChange(localPlayer, localPlayer:getLevel(), localPlayer:getLevelPercent())
    onStatesChange(localPlayer, localPlayer:getStates(), 0)
    onSoulChange(localPlayer, localPlayer:getSoul())
    onFreeCapacityChange(localPlayer, localPlayer:getFreeCapacity())
  end

  healthInfoWindow:setup()
end

function terminate()
  disconnect(LocalPlayer, { onHealthChange = onHealthChange,
                            onManaChange = onManaChange,
                            onLevelChange = onLevelChange,
                            onStatesChange = onStatesChange,
                            onSoulChange = onSoulChange,
                            onFreeCapacityChange = onFreeCapacityChange })

  disconnect(g_game, { onGameEnd = offline })

  healthInfoWindow:destroy()
  healthInfoButton:destroy()
  healthInfoWindowHp:destroy()
  healthInfoWindowMp:destroy()
  healthInfoWindowXp:destroy()
end

function toggle()
  if healthInfoButton:isOn() then
    healthInfoWindow:close()
    healthInfoButton:setOn(false)
  else
    healthInfoWindow:open()
    healthInfoButton:setOn(true)
  end
end

function showHp()
  if onHp == 'yes' then
    healthInfoWindowHp:hide()
    onHp = 'no'
  else
    healthInfoWindowHp:show()
    onHp = 'yes'
  end
end

function showMp()
  if onMp == 'yes' then
    healthInfoWindowMp:hide()
    onMp = 'no'
  else
    healthInfoWindowMp:show()
    onMp = 'yes'
  end
end

function showXp()
  if onXp == 'yes' then 
    healthInfoWindowXp:hide()
    onXp = 'no'
  else
    healthInfoWindowXp:show()
    onXp = 'yes'
  end
end

function toggleIcon(bitChanged)
  local content = healthInfoWindow:recursiveGetChildById('conditionPanel')

  local icon = content:getChildById(Icons[bitChanged].id)
  if icon then
    icon:destroy()
  else
    icon = loadIcon(bitChanged)
    icon:setParent(content)
  end
end

function loadIcon(bitChanged)
  local icon = g_ui.createWidget('ConditionWidget', content)
  icon:setId(Icons[bitChanged].id)
  icon:setImageSource(Icons[bitChanged].path)
  icon:setTooltip(Icons[bitChanged].tooltip)
  return icon
end

function offline()
  healthInfoWindow:recursiveGetChildById('conditionPanel'):destroyChildren()
end

-- hooked events
function onMiniWindowClose()
  healthInfoButton:setOn(false)
end

function onHealthChange(localPlayer, health, maxHealth)
  healthBar:setText(health .. ' / ' .. maxHealth)
  healthBar:setTooltip(tr(healthTooltip, health, maxHealth))
  healthBar:setValue(health, 0, maxHealth)

  healthBarP:setText(health .. ' / ' .. maxHealth)
  healthBarP:setTooltip(tr(healthTooltip, health, maxHealth))
  healthBarP:setValue(health, 0, maxHealth)
end

function onManaChange(localPlayer, mana, maxMana)
  manaBar:setText(mana .. ' / ' .. maxMana)
  manaBar:setTooltip(tr(manaTooltip, mana, maxMana))
  manaBar:setValue(mana, 0, maxMana)

  manaBarP:setText(mana .. ' / ' .. maxMana)
  manaBarP:setTooltip(tr(manaTooltip, mana, maxMana))
  manaBarP:setValue(mana, 0, maxMana)
end

function onLevelChange(localPlayer, value, percent)
  experienceBar:setText(percent .. '%')
  experienceBar:setTooltip(tr(experienceTooltip, percent, value+1))
  experienceBar:setPercent(percent)

  experienceBarP:setText(percent .. '%')
  experienceBarP:setTooltip(tr(experienceTooltip, percent, value+1))
  experienceBarP:setPercent(percent)
end

function onSoulChange(localPlayer, soul)
  soulLabel:setText(tr('Soul') .. ': ' .. soul)
end

function onFreeCapacityChange(player, freeCapacity)
  capLabel:setText(tr('Cap') .. ': ' .. freeCapacity)
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
      toggleIcon(bitChanged)
    end
  end
end

-- personalization functions
function hideLabels()
  local removeHeight = math.max(capLabel:getMarginRect().height, soulLabel:getMarginRect().height)
  capLabel:setOn(false)
  soulLabel:setOn(false)
  healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
end

function hideExperience()
  local removeHeight = experienceBar:getMarginRect().height
  experienceBar:setOn(false)
  healthInfoWindow:setHeight(math.max(healthInfoWindow.minimizedHeight, healthInfoWindow:getHeight() - removeHeight))
end

function setHealthTooltip(tooltip)
  healthTooltip = tooltip

  local localPlayer = g_game.getLocalPlayer()
  if localPlayer then
    healthBar:setTooltip(tr(healthTooltip, localPlayer:getHealth(), localPlayer:getMaxHealth()))
    healthBarP:setTooltip(tr(healthTooltip, localPlayer:getHealth(), localPlayer:getMaxHealth()))
  end
end

function setManaTooltip(tooltip)
  manaTooltip = tooltip

  local localPlayer = g_game.getLocalPlayer()
  if localPlayer then
    manaBar:setTooltip(tr(manaTooltip, localPlayer:getMana(), localPlayer:getMaxMana()))
    manaBarP:setTooltip(tr(manaTooltip, localPlayer:getMana(), localPlayer:getMaxMana()))
  end
end

function setExperienceTooltip(tooltip)
  experienceTooltip = tooltip

  local localPlayer = g_game.getLocalPlayer()
  if localPlayer then
    experienceBar:setTooltip(tr(experienceTooltip, localPlayer:getLevelPercent(), localPlayer:getLevel()+1))
    experienceBarP:setTooltip(tr(experienceTooltip, localPlayer:getLevelPercent(), localPlayer:getLevel()+1))
  end
end
 

 

 

 

healthinfoHp.otui

 

 

HealthBar < ProgressBar
  id: healthBar
  size: 300 25
  phantom: true
  background-color: #ff4444
  anchors.top: parent.top
  anchors.left: parent.left
  margin-top: 4

UIWindow
  id: healthInfoPlayerWindow
  size: 300 25

  HealthBar 

 

 

healthinfoMp.otui

 

 

ManaBar < ProgressBar
  id: manaBar
  size: 300 25
  phantom: true
  background-color: #4444ff
  anchors.top: parent.top
  anchors.left: healthBar.right
  margin-top: 4

UIWindow
  id: healthInfoPlayerWindow
  size: 300 25
  opacity: 0.8

  ManaBar 

 

 

healthinfoXp.otui

 

 

ExperienceBar < ProgressBar
  id: experienceBar
  size: 500 15
  phantom: true
  background-color: #B6E866
  anchors.top: prev.bottom
  anchors.left: parent.left
  margin-top: 4

UIWindow
  id: healthInfoPlayerWindow
  size: 500 15

  ExperienceBar 

 

 

 

E do chat não sei, vo procura aqui, qualquer coisa edito.

Link para o comentário
Compartilhar em outros sites

  • 0

Humm, cara aqui no meu OTC os 3 .otui são um só, tu que separou? O chat não tem nada a ver pois é só sobre o ctrl . que já tiraste do otc, mas pode mexer ele certo? se puder mexer não adianta em nada, vou pesquisar sobre alguma func para "travar" ali

Editado por eryrrel
Link para o comentário
Compartilhar em outros sites

  • 0

Humm, cara aqui no meu OTC os 3 .otui são um só, tu que separou? O chat não tem nada a ver pois é só sobre o ctrl . que já tiraste do otc, mas pode mexer ele certo? se puder mexer não adianta em nada, vou pesquisar sobre alguma func para "travar" ali

 

Ah esses script que coloquei ai no tópico é desse MOD: http://www.xtibia.com/forum/topic/211780-agarre-sua-vida/

 

E sim, tirei o comando ctrl . e deixei fixo o client todo aberto.

 

Obrigado :)

Editado por curruwilliam
Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...