I searched and couldn't find a similar / remotely relevant thread that would be useful. I may have overlooked though. Just so you know I did search first:
I'd like to replace the health, armor and sprint bars with simple icons that would change transparency or color (or both) similar to the vanilla Radiation icon, instead of.. a bar. Since the HUDs are partially maintained through XML files, I thought it might be possible. So I've been mainly looking at ABC Hud (and other mods that change HUD, including the UI mod) for there is an added Radiation bar there which I thought might give me some hints, and I also extracted the vanilla scripts to take a look at, but even after scanning what I think to be relevant files, I can find nothing useful. So, could anyone tell me if it's possible? Basically, I want all of them (health, armour, sprint, radiation) to be invisible when at best values and appear in different colors and if possible, different transparency as they worsen.
Oblivion Lost supplier
25th March 2008
I cannot tell you everything about it, because I wanted to do something similar but didn't try yet. What I can tell you:
The XML files only set the positions and size of the icons and UI windows. The graphics you see are stored in \gamedata\textures\ui\ui_hud.dds You can edit that file with a graphic editor + a dds plugin.
So you can make new icons and relocated them etc. Everything beyond that requires some serious scripting. For example the radiation bar is scripted by the author of ABC, afaik. Sorry I can't tell you in detail how it could be done.
Well, knowing that the radiation bar isn't a default feature which was left out by GSC and is instead scripted might be a good start (if I'm interpreting your post correctly). I'm downloading ABC and the 1.4 beta patch you mentioned in your readme to take a look at the scripts there, and I may try to contact the author for help as well.
Thank you for your reply.
I've been able to locate the script segment responsible for managing a radiation bar in ABC Inferno. There is only one yellow bar in the mod's ui_hud.dds so I looked for references to its coordinates. There were only two files with references, which are typically "ui_hud.xml" and "ui_custom_msgs.xml". In the latter, there is the custom tag (I believe it's custom because I was unable to find the same reference in any of the original game files) , and the only other file with the same reference is abc.script.
So here's the relevant function in abc.script, starting at line 1765:
function checkrad() if db.actor ~= nil then local gametime = time_global() local radwidth = db.actor.radiation if gametime > db.radtimeout then db.radtimeout = time_global() + 1900 if db.actor.radiation > 0 then db.crad = db.actor.radiation local my_hud = get_hud() local radw = radwidth * 160 if (radw > 110) then radw = 110 end local hud = get_hud()
local noobscreen = chkwidescreen() if noobscreen == "no" then local custom_static = hud:GetCustomStatic("hud_rad") if custom_static ~= nil then hud:RemoveCustomStatic("hud_rad") end my_hud:AddCustomStatic("hud_rad", true) my_hud=get_hud():GetCustomStatic("hud_rad"):wnd() my_hud:SetHeight(10) my_hud:SetWidth(radw) elseif noobscreen == "yes" then local custom_static = hud:GetCustomStatic("hud_radwide") if custom_static ~= nil then hud:RemoveCustomStatic("hud_radwide") end my_hud:AddCustomStatic("hud_radwide", true) my_hud=get_hud():GetCustomStatic("hud_radwide"):wnd() my_hud:SetHeight(10) my_hud:SetWidth(radw) end
end if (db.actor.radiation == 0) and (db.crad > 0) then db.crad = 0 local hud = get_hud() local noobscreen = chkwidescreen() if noobscreen == "no" then local custom_static = hud:GetCustomStatic("hud_rad") if custom_static ~= nil then hud:RemoveCustomStatic("hud_rad") end elseif noobscreen == "yes" then local custom_static = hud:GetCustomStatic("hud_radwide") if custom_static ~= nil then hud:RemoveCustomStatic("hud_radwide") end end end end end end
I was unable to find a function named checkrad in original game files, so either this is a brand new function, or it's hardcoded in original game, though I doubt the game would give priority to anything else over hardcoded stuff, correct me if I'm wrong.
So what now? I've no idea. I'm entirely new to this whole modding business for Stalker and LUA scripts. Is there a list somewhere where I can look up default functions/expressions in Stalker?
Could someone at least help me with the circular throwing strength indicator? I've also been looking at what makes that indicator work that way and if it would be possible to make similar indicators for other HUD elements, but so far I've been unable to single out any line of code that manages the said indicator (looked for coordinates of both indicators at the bottom in ui_hud.dds).
I think I may have found a work around but I just don't have enough knowledge to even attempt to do anything. Since I couldn't determine what made HUD elements work the way they do, I looked at functions in lua_help and found the function SetTextColor(), that seems to take 4 values ( SetTextColor(#,#,#,#) ) which are alpha, Red, Green, Blue respectively. The idea is to edit one of the fonts or add a new custom font set (though I don't even know if that's possible) and make desired HUD icons instead of letters. Then I guess I could have any letter displayed on screen at all times, and use SetTextColor() to change the letter's color or alpha level according to health. I think I could do something like: local aHP local rHP local gHP local bHP -devise and script a formula to adapt 0-255 scale to 0-100 in HP or armor or what have you (including the color range I intend between worst and best value colors) and then put- SetTextColor(aHP,rHP,gHP,bHP) in wherever the necessary script segment to display text on screen at all times is.
I'll be quite grateful should anyone tell me if this is the right way to go and perhaps even hint me on how to construct a script.
Oblivion Lost supplier
25th March 2008
Hi! Sorry, I missed your post last week.
Checkrad is surely russos work and doesn't exist in vanilla stalker. You can check gamedata\scripts\lua_help.script for the names of some hard-coded functions.
Sorry I don't know what circular throwing strength indicator you mean. Generally I think the icons in gamedata\textures\ui\ui_hud.dds are made visibly by different color settings. For example bleeding icon: First use green channel, then use green and red channel = yellow, then red channel. All with a different mixture.
But I didn't yet change anything about the dynamic elements or made dynamic text, so i don't know in detail.
Maybe I could at least help you with scripting
function get_health_for_color() if db.actor and db.actor.alive() then return db.actor.health*255 else return nil end end This SHOULD give you the player health in a range up to 255, since db.actor.health returns a value like 0.50 for 50% health. Multiplied with 255 gives you the same percentage for 255. I didn't test that script.
If you have more questions about dynamic hud, maybe it would be better to ask on >this forum<. It is pretty deserted, but the author of ABC is more active there and might help you with dynamic stuff.
Thank you a lot for your reply. It's a start. Trying out dynamic text seems like an easier option right now so I guess I'll use that and my own scripting in bind_stalker.script for constant display of the text.
I'll take my problem to that forum as well.
Sorry I don't know what circular throwing strength indicator you mean
Meanwhile, I should at least post some script segments I've written -which hopefully will provide color and alpha change in my text should I ever get it to be displayed- for feedback from you.
The idea is to define a range of desired values for opacity and each color by using the vanilla function SetTextColor() (which accepts 4 values for a, r, g, b) and to scale those ranges to thedesired stat (health, armor, sprint, radiation, etc.) to be displayed as text.
The script below should return the equivalent of current player health in a range between 0 and 255, and change the returned decimal (because it will always be a decimal) into the closest higher or lower integer to be used by SetTextColor function, ie. if player health is 0,670, then it will be 0,67*255 = 170,85 which will be changed to 171.
function return_rgb() if db.actor and db.actor.alive() then vhp = db.actor.health * 255 if vhp > 200 then vhp2 = vhp - 200 elseif vhp > 100 then vhp2 = vhp - 100 elseif vhp2 > 50 then vhp2 = vhp2 - 50 elseif vhp2 > 20 then vhp2 = vhp2 - 20 elseif vhp2 > 10 then vhp2 = vhp2 - 10 elseif vhp2 > 5 then vhp2 > vhp2 - 5 elseif vhp2 > 1 then vhp2 > vhp2 - 1 elseif vhp2 < 1 then vhp = vhp - vhp2 if vhp2 <= 0.500 then return vhp elseif vhp2 > 0.500 then vhp = vhp + 1 return vhp end else return nil end end endThe difference of the script below is that it takes 2 values to define a custom range between 0 and 255 to scale to the player health. For instance, if I want red 180 to reflect full health, and red 115 to reflect 0 health / death, I'll put those values in:
function return_rgb2("min","max") if db.actor and db.actor.alive() then diff = max - min vhp = db.actor.health * diff if min < 0 then min = 0 end if max > 255 then max = 255 end if vhp > 200 then vhp2 = vhp - 200 elseif vhp > 100 then vhp2 = vhp - 100 elseif vhp2 > 50 then vhp2 = vhp2 - 50 elseif vhp2 > 20 then vhp2 = vhp2 - 20 elseif vhp2 > 10 then vhp2 = vhp2 - 10 elseif vhp2 > 5 then vhp2 > vhp2 - 5 elseif vhp2 > 1 then vhp2 > vhp2 - 1 elseif vhp2 < 1 then vhp = vhp - vhp2 vhp = vhp + min if vhp2 <= 0.500 then return vhp elseif vhp2 > 0.500 then vhp = vhp + 1 return vhp end else return nil end end end
I've tried using these functions in various places both in vanilla game scripts and in some other mods'. When there was a call for that function, I inserted the code below right before it:
local ahp = return_rgb("100","255") local rhp = return_rgb("0","255") local ghp = return_rgb("0") local bhp = return_rgb("0") I'm afraid I can't even confirm whether the fault is with my scripts or the things I did to test these, or both!
Forlorn Hopes Crusader
10th June 2008
ok i have difficulty understanding very basic script at the best of times... what does all this mean? and how does that value 171 relate to the coulor of the health bar? and what does diff mean? i know its value is255 but why? I do not understand this much at all