--[[
AUTO HP modified By ArthasDK v1.2
Press Shift to access the ingame OPTIONS
Credits to :
[main concept] 1. Darius Dunk v0.33 by Lux
2. Darius Ownage v1.1 written by Weee Modified by Delusional Logic
[modes] 3. Script: Sida for providing the solution of the bug.
4. UnlimitedElise for menu.
]]
require "AllClass"
local enemyTable = {}
local allyTable = {}
function getFirst(Table)
local enemy
for i, champ in ipairs(Table) do
enemy = champ
break
end
return enemy
end
function updateTable()
for i=1, heroManager.iCount do
local hero = heroManager:GetHero(i)
if hero.team ~= myHero.team and not enemyTable[hero] then
table.insert(enemyTable,hero)
end
if hero.team == myHero.team and hero.name ~= myHero.name and not allyTable[hero] then
table.insert(allyTable,hero)
end
end
end
function doDraw(unit,Table)
local health = tostring(math.floor((unit.health)+0.5))
PrintFloatText(unit,0,health)
table.remove(Table,1)
end
function OnLoad()
ShowHP = scriptConfig("ShowHP", "Show HP in Text")
ShowHP:addParam("showAlly", "Ally", SCRIPT_PARAM_ONOFF, false)
ShowHP:addParam("showEnemy", "Enemy", SCRIPT_PARAM_ONOFF, true)
ShowHP:addParam("showSelf", "Self", SCRIPT_PARAM_ONOFF, true)
ShowHP:permaShow("showAlly")
ShowHP:permaShow("showEnemy")
end
function OnWndMsg(msg,key) --important for menu
SC__OnWndMsg(msg,key)
end
function OnDraw()
SC__OnDraw() -- also Important for menu
end
function OnTick()
if ShowHP.showEnemy == true then
if enemyTable ~= nil then
if #enemyTable <= 0 then
updateTable()
else
doDraw(getFirst(enemyTable),enemyTable)
end
end
end
if ShowHP.showAlly == true then
if allyTable ~= nil then
if #allyTable <= 0 then
updateTable()
else
doDraw(getFirst(allyTable),allyTable)
end
end
end
if ShowHP.showSelf == true then
if not myHero.dead then PrintFloatText(myHero,0,"" .. math.ceil(myHero.health).. " hp") end
end
end
PrintChat("AUTO HP script loaded! Cut-pasted by ArthasDK \n\t\tPress Shift to bring in the Menu to toggle Modes")
Comments