Need Help with Health bar modifcation
Is there a way to change the colors of a health bar so that it turns yellow, orange red sooner than it does now? If there is an easy way to do that, can someone post an example? Thank you so much.
|
Assuming there's an appropriate event trigger for ProgressBars(I don't know where there is an up-to-date list). Maybe use the OnTextChanged event for a health label instead.
Anyhow, I expect you'd have to disable EQ2's option to change the color at all so that it remains red. It's an actual game option, but probably a scriptable slash command as well. I'd hope that once it stays red that EQ2's hardcoding doesn't reset it to red on every change or you'll have difficulty. Depending on which event you handle you'll either have a progress of 0.000 to 1.000 or a text of 0 to 100. You'll have to create a script to compare the current values to the steppings that you want. If you want smoother color transitions, you'll have to add more comparisons. Sorta like: Code removed At the end, you'll end up with a color of red, yellow or green as ProgColor depending on the value of Prog, which you'll have to replace with the actual ProgressBar value or whatever. If you end up using the 1-100, you'll obviously have to use integers not decimals. So as a short answer, it's not "easy" but not "hard" either. You'd have to calculate your own color transitions and hope EQ2 doesn't override you. |
Thank you for your reply. I am not sure how to implement this however - can variables be declared in the xml? I have not found a sample of that and I have been looking through these posts for hours lol.
|
Sure they can be declared. When you write something in UI scripting, it first checks to see if it was a valid variable. It also considers the XML attributes of that node as variable names. In my above example, I use Prog and ProgColor as variables. ProgColor I actually assign a value to in scripting and Prog I assume has a value. If EQ2 can't find an assigned variable(or XML attribute) of that name, it treats it as a string. It also likes to treat things as arithmetic when possible.
Conversely you can assign XML attributes values in scripting as if they were internal variables. Lemme just throw some of the things you want to do together in a simple way instead of speaking abstractly. Code:
<Progressbar Color="#FF0000" DynamicData="/GameData.Group.Group_1.HealthPercent" Name="HealthBar" Progress="1.000" /> |
I think I understand the idea behind your example. I tried changing the health bar, that did not work, so I tried to change the color in a power bar. The following code snippet does not work. The original color of the progress bar remains. Am I missing something?
Code:
<Page DynamicData="/GameData.Self.Power" DynamicDataFilter="0001" Location="5,5" Name="PowerBar" PackSize="absolute,fixed" ScrollExtent="200,30" Size="200,30" Visible="true"> |
Apparently I wasn't thinking when I was writing out that code. You can't have the UI scripting evaluate a boolean condition in the same line that it is using it. I apologize and I'll fix my previous code.
|
In addition, depending on where you try to change the colors, you will need to change the name of the health/power bar because otherwise the game will override your color changes when it sets the color itself.
|
Oh and both of you - I am in awe of the things you have done for the EQ2 community!!
I am a fervent promoter of both ACT and ProfitUI - they have certainly made my game experience much better!!! I thank you for your time. |
Yay! I have gotten the power bar to work!
I have yet to get the health bar to work. Here is the current code snippet: Code:
<Page DynamicData="/GameData.Self.Health" DynamicDataFilter="0001" Location="5,5" Name="HealthBar" PackSize="absolute,fixed" ScrollExtent="200,30" Size="200,30" Visible="true"> |
The attribute, Name in the ProgressBar element. Changing the name will cause EQ2's hardcoding of the recoloring not able to find the element. Of course it will make your script unable to find it too, so you'll have to change the Parent.Bar.XMLAttribute from Bar to whatever you change the name to.
|
I understand what attribute to change, just not exactly where to change it lol.
|
Quote:
PS: Isn't that a renamed bar already? I don't remember it being called "Bar" in the default. Also just briefly looking at this shouldn't it be Parent.Parent.Bar ? Also this line "Parent.Parent.Health.Color=ProgColor" is referencing a non-existant object. |
Here is my confusion. The progress bar, when created is named Bar
and so that is how we reference it to either query its Progress attribute or to set the value of the color. So ... In order to rename the progress bar from Bar to something else, I need to first reference it as Bar - so do I query it as Bar then rename it to FooBar for instance, THEN change the color? OR Do you mean that I should not make the name of the progress bar the default name from the start? I am not sure what the default is but in case that is what you mean will try it with the name of FooBar in the first place and see what I can see. The answer to the last question is no, not a typo - it is changing the text that is defined in code not showing in the snippet. |
No, you only ever reference elements only by their name.
However, you only need to rename it if you modify an alreay existing default UI window, there is no need to rename your custom created "bar", so just ignore that for your mod. :) Apart from that, unless I'm not looking straight: I still think you need to reference it from within that Text element as Parent.Parent.Bar, not Parent.Bar. |
Ok - no not a modification of a default window, so no need to rename.
The Text object is a sibling of the progress bar (sorry, my indentations were not correct) Here is the full code for the xml file: Code:
And thank you again for taking the time to look at this. |
The only thing I immediately see is that you must remove the DynamicDataFilter from the "Percent" object (or set one that lets only the text through). Otherwise your color cycle is a bit messed up (it goes red->orange->green->orange) but that's just a style question.
|
LOL yes it ends on orange just so that I can see right away if it will work, which it does not.
If the color value gets through on the text object Progress, it should not have an effect on the progress bar should it? |
I got it to work! By making the progress bar invisible and copying the progress attribute from it to the visible progress bar. Here is the code:
Code:
<?xml version="1.0" encoding="utf-8"?> Now, one more question lol Is there a way to script the sprint ability? I cannot find the command anywhere. "sprint" does not seem to work. |
I believe it's /useability Sprint
But that's entirely from memory. |
yes thanks that worked!
|
All times are GMT -5. The time now is 07:20 AM. |
vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI