To be honest, you'll be surprised how this is simple.
To 'fix' Niadra HealthBar you'll just need to:
- Your map needs to use Swarm (Campaign) as dependencies.
- Go in UI Module (Shift + F6)
- Right-Click on the left sided list
- Add Layout (Ctrl + L)
- Name it whatever you want, it will be used in data field 'Combat: Custom Unit Status Frame'
- Paste this code below overwriting the existent one and change as you want.
- Go to Data Module (F7), search for your actor unit and change 'Combat: Custom Unit Status Frame' to NameOfLayoutYouDid/NiadraBar (look at the 'name="NiadraBar"' in the code, you can chage that to whatever you want too, just make sure to refer it in the data field as well.
PHP:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Desc>
<Frame type="UnitStatusFrame" name="NiadraBar" template="HotS_UnitStatus/KerriganHeroUnitStatusFrameTemplate">
<Frame type="UnitStatusShieldedHealthBar" name="HealthBar">
<BarCount val="2"/>
<OwnerColor val="34,90,194" index="1"/>
<AllyColor val="34,90,194" index="1"/>
<EnemyColor val="34,90,194" index="1"/>
</Frame>
</Frame>
</Desc>
Also you can edit the color value above (the val="34,90,194") to any color you want, so OwnerColor is who own the unit with the bar will see the shield as that color, so goes to AllyColor (team allies) and EnemyColor (enemies, obvious
).
I'll explain a little bit of what I experienced yesterday doing those bars.
- Shield bar is a mess in Starcraft.
- Life bar and shield bar use the same bar itself.
- The amount calculated bar for each one is % in each other, so unit with 10 current life and 10 current shield will have a 50% life bar and 50% shield bar.
- The math of the item above is basically: (currentLife% + currentShield%) - Difference of totalLife, so my unit that has 700/700 shield, 1076/3200 life looks like this:
- Shield bar doesn't calculate your maximum shield as life bar does, so it only count the current one (so bar will move a little silly).
- If your life is too much for the Starcraft calculate the segment, it will just ignore the segment configs and change the bar to non-segmented, sames applies to shield bar (and energy) like this: , the first unit has 200/200 shield and 200/200 life, the second unit has 700/700 shield and 3200/3200 life.
Also one more thing, if you want a segmented shield bar, you just need to add this in any part inside the Frame Type UnitStatusShieldedHealthBar:
PHP:
<Segmented val="true" index="1"/>
<SegmentValue val="EachSegment" index="1"/>
<MaxSegmentCount val="MaximumSegments" index="1"/>
And change EachSegment to a number (if 100, then each 100 life will be a segment) and MaximumSegments to another number (if 3, it'll fix the maximum number of segments, if unit pass the EachSegment*MaximumSegments, it starts to calculate as %, so 3 will be 1/3 of life, etc).
Sorry for all the texts
but hope you learn and enjoy something I writed.
Any question or something more, feel free to ask me anytime.
PS: I saw your PM but I prefer to make this public because as you I searched a lot and didn't found HOW make the mana bar work in Starcraft, so I started to try some tricks.