Colour Names
#78
This will colour monster names based on the names and values you set in the list.
local colorTable = {
['Dragon'] = {'#008C9A', '#00707B', '#00545C', '#00383E', '#000E0F', '#000000'},
['Dragon Lord'] = {'#F59E03', '#C47E02', '#935F02', '#623F01', '#191000', '#000000'},
['Default'] = {'#D5082F', '#AA0626', '#80051C', '#550313', '#150105', '#000000'},
}
function doChangeColor(creature, healthPercent)
if creature:isMonster() then
local name = creature:getName()
local color = colorTable[name]
if not color then
color = colorTable['Default']
end
if color then
if healthPercent >= 95 then
creature:setInformationColor(color[1])
elseif healthPercent > 60 then
creature:setInformationColor(color[2])
elseif healthPercent > 30 then
creature:setInformationColor(color[3])
elseif healthPercent > 10 then
creature:setInformationColor(color[4])
elseif healthPercent > 3 then
creature:setInformationColor(color[5])
elseif healthPercent >= 0 then
creature:setInformationColor(color[6])
end
end
end
end
local monstercolor = macro(20000, "Coloured names", function() end)
onCreatureAppear(function(creature)
if monstercolor:isOff() then return end
doChangeColor(creature, creature:getHealthPercent())
end)
onCreatureHealthPercentChange(function(creature, healthPercent)
doChangeColor(creature, healthPercent)
end)
- remove | + add
19 Feb 2022