Orb colour change with health
Hi Guys,
I'm sry if this has been covered, I've just spend close to 2hrs scowering through pages of code and replies. Is there a way to make the health colour change with the values (in my case it would be the orb colour (rothui)). Meaning at 100 = class colour, 75 = yellow, 50 = orange, 25 = red (prehaps changing the animation/background texture). Ideally with a smooth transition bewteen colours. I saw a few posts talking about min/max health, though being new to Lua code I'm not sure they were referring to this or more the text colour. I get in the situation when multimob grinding, my health gets to 25% and I havent even noticed because it;'s still the same colour, and the swirl animation tends to hide somewhat the empty orb. If I'm not in the right area, please let me know. Keep up the great work. ;) |
This can be done.
Adjust this function with a color calculation: d3o2_updatePlayerHealth Fully OK (100%) = green color. Green color is in RGB = 0,1,0 Nearly dead = red color. Red color is in RGB = 1,0,0 Thus: Code:
local calc_perc = min/max Code:
--colorize the orb filling Code:
--update player health func |
Tyvm for the quick response zork.
with my limited (rapidly increasing ^^ ) knowledge of lua, would I be correct in thinking: Code:
local calc_perc = min/max Code:
-- healthcolor defines what healthcolor will be used I'm ok with green as default colour tbh, just wondering if this code still pulls in rules from previous lines or it's a independant cmd. Also at 25% would it be asking for trouble to add a cmd to lighten to glow of the orb, to make it more promenent. using the Code:
local fog_smoother = 1 Hope you understand what i mean, as I dont know the all the lingo. Appreciate your patience and help. for the moment I'll try the above code you have supplied once I get home, and see how it looks. EDIT: Just looking at some RGB values, and it seems the ones in the code are a lot more simple than other RGB codes I've seen: Example Just to confirm, the RGB in this code is based on the opacity for each colour? 0 = not visible 0.25 = 25% opacity of that colour for example? cheers. |
You only need to adjust the UpdatePlayerHealth function. (Replace it with the one I posted)
This function is called each time the health of the player changes. Other values will become obsolete, especially those that are set at startup. The only thing that should be adjusted is the initial Healthcolor value at startup. RGB in the real world is from 0 to 255. In WoW its from 0 to 1 or for you, from 0/255 to 255/255. Just try my function, it should work. My healhcolor value in my config is just an index number that is used to find the correct line in the orb-table. It has nothing to do with color values. But the color value inside that line on the table does. example: Code:
local orbtab = { |
Hi Zork,
I tried this and it looks sweet tbh, thank you. though it's created a problem. I'll detail what I did, as it's probably my fault. I had both rBottomBarStyler, and roth IU, not rly knowing any better (cause RBBS has /cmds that seemed easier to work with. As this code didnt work at first, I realised there is probably a conflict there. I deleted RBBS addon, and set local use_rbottombarstyler = 0 (as it was originally) With code added, I reloaded to find I now have a sexy green health orb that changes colour as it depletes, and also glows red under 25% (nice touch btw). although I have no mana orb now. I have the blue orb yes, but it's not registering my mana value at all, so there is no text, and stays full when I use mana. it's probably something daft, but staring at the code isnt helping, and as I didnt change anything in the "power" part of the code, I cant see where this issue lies.. Any help would be appreciated. cheers :) EDIT: oUF_D3Orbs\oUF_D3Orbs.lua:294: attempt to call method 'SetVertexColor' (a nil value) oUF-1.3.21\elements\health.lua:98: in function `func' oUF-1.3.21\ouf.lua:506: in function <Interface\AddOns\oUF\ouf.lua:501> (tail call): ?: i pulled this error out of it. not sure if it's related (though I tend to think so). |
update:
I replaced the code back to what it was: Code:
--update player health func Question is..what part of the addition is causing this to happen? I did try adding the last "end" cmd, but this just removed the orbs all together. I'll keep playing and let you know if I figure it out... best way to learn eh ^^ |
well with no success as yet, I'll checking the code in SciTE (not that I rly know what I'm doing).
It's odd that this addition would affect the mana values. any Ideas are appreciated. :D |
All times are GMT -6. The time now is 05:27 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI