[Library] Boss Bars Advanced
Boss Bars Plus
Current Version: Beta 04c
Status: Hotfixed (Patch 1.5), Pending feedback on stability
Latest file: BossBars+ b04c
Changelog: Quick link
Introduction
Where did the idea for this library originate? It was noted that Blizzards existing boss bar functions were very restricted, not allowing much control over how it was displayed. It didn't feel like enough, so the idea came up to create a boss bar library that is much more flexible than the vanilla one. After a year of development on and off, It is finally complete. I look forward to seeing what the rest of the community can do with the tools that are provided here.
How to use
1) Copy the BossBars+ vX.X folder into your script.
2) BossBars+ and its dependencies are Library files, thus they must be placed at the top of your script.
3a) Open the 'Core' folder to view Galaxy functions available (Advanced)
3b) Open the 'GUI Core Extension' folder to view the GUI functions/actions available
- If you downloaded the BossBarPlus_vX.X.SC2Map file, you will find examples of how to make use of it's functions.
Note that all functions have helpful hints to help you if you get stuck.
4) Additional steps
- BossBarsPlus is dependent on QuickLib A03c & GXML B02c
If already have a copy of either of these libraries, please remove them to avoid duplicate constants/functions declaration conflicts
5) Run the map to view the available examples to get a brief idea of how to use the library.
Features
- Pre-allocated memory for up to 100 boss bars
- High level of customizability, entire look can be modified
- May be used in both Galaxy and GUI
- Supports HP, Shields and Energy
- Smoothly animated bars when units are damaged or regenerating
- Boss bar label may be set as a string or text (Player names)
- Automatic updates when units are set as the boss (Auto-portraits can be disabled)
- Optimized to contribute minimal map size increase in large projects
- Optimized to contribute minimal processing overhead
- Open source, modify at your leisure, but remember to give credit! :)
Function List
Core functions
- bbNew:
Creates a new boss bar and returns the boss bar identifier as an integer. This is a function and must be directly called into a variable to work. - bbLastCreated:
Returns the boss bar identifier of the last created boss bar. - bbDestroy:
Destroys a boss bar by its identifier, freeing up allocated memory for the boss bars. - bbMove:
- Moves the boss bar to the selected x and y offset according to a chosen anchor.
- bbShow:
Shows the boss bar to all players in the player group set by bbSetGroup - bbLock:
Locks the boss bar to the unit it is currently bonded to. This feature is intended for use with revivable heroes that should not have their units replaced - bbAutoPortrait:
Enables/disables auto-portrait detection for specific boss bar. Useful for preventing debug error messages when where the boss does not have a portrait model. - bbSetSize:
Sets the size of the boss bar dialog - bbSetLabel:
Sets the title of the boss bar dialog as a string - bbSetTextLabel:
Sets the title of the boss bar dialog as text. If text styles and/or colors are set, they will override bbSetStyleDC and/or bbSetColorDC.
Note: This function was created specially for setting the boss bar title to player names, which are always detected as text.
- bbSetRace:
Sets the race of the boss bar dialog. This is the only function that has the option of selecting which player groups view which race. Three themes are available: c_Terr, c_Prot and c_Zerg - bbSetBoss:
Sets the boss of the boss bar and updates it as necessary - bbSetGroup:
Sets the playergroup that that boss bar is visible to
Advanced functions
Note: All these functions make use of boss bar dialog item constants. The full list of boss bar dialog item constants can be viewed either in the Core folder (c_bb) or the GUI Core Extension/Constants folder
- bbShowDC:
Shows/hides the selected boss bar dialog item - bbSetSizeDC:
Sets the size of the selected boss bar dialog item - bbSetPosDC:
Sets the position of the selected boss bar dialog item, with a fixed anchor to the top left of the holding dialog. - bbSetStyleDC:
Sets the text style of any of the label dialog items: c_Label, c_HPLabel, c_SPLabel, c_EPLabel
Note: An image displaying most of the text styles can be exported from the imported assets attached inside the map (F9). Credits goes to whomever created that image (It wasn't me)
- bbSetColorDC:
Sets the color of any of the dialog item elements as a hex value with the following format: RRGGBBAA. Where alpha is the opacity of the dialog item. - bbSetImageDC:
Sets the image of the selected boss bar dialog item element. This function works for all the elements except c_Label. c_HPLabel, c_SPLabel, c_EPLabel can have their images changed, however, they are border dialog items and thus only border image types will display correctly.
Any image path should work so long as the image exists. For vanilla assets, a shortcut is available, whereby you can encapsulate any image name between "Assets\ \Textures\ \" and ".dds". (The Asset(string s) function seen in Example 1 in the map)
Note: You can browse for all the available images by opening the console (Alt+ tilde) and typing 'browse'. Look under the assets and textures folder.
- bbSetImageTypeDC:
Sets the image type of the selected boss bar dialog item element. This function works for all boss bar elements except labels. This function was implemented to make it easier to use custom boss bar images (Normal image type), as many of Blizzards assets are cut up in strange ways.
Note: The image types referred here are the same as in blizzard natives.
Examples
Examples on library usage can be found in the .SC2map download
Known Caveats
- Units with unidentical Unit Type and Model actor references will bug. This will require feedback on the 'broken' units to completely fix, as I would not be able to scan all the data just to find all the differences.
- Boss bar needs to be manually refreshed if a unit with no Shield/Energy gains Shield/Energy capacity via a behavior or other means.
- GUI code needs some cleanup
Got feedback?/Found a bug?
Feel free to report it to [email protected] with the subject title Boss Bar Library or make a post in here
All Rights Reserved 2011 - FuzzYD
You're welcome mate :)
Thanks you :)
@Kingor50: Go
Hi Kingor50,
You will need to use the bbSetGroup function (Sets the playergroup that that boss bar is visible to)
In elaborate detail, what this is is expected to do, is control who the boss bar appears to when the bbShow function is called.
For example:
If I wanted to have a Boss bar appear for only player 1, I would first use bbSetGroup for that boss bar ID to PlayerGroupSingle(1), then use bbShow to control it's visibility.
Answering the question
The 5 players case, I'm assuming you wish to have a single boss bar that all 5 players can see.
Simply create an "Example 2" boss bar, then set the Player Group with the group of 5 players to the bbSetGroup function.
For the targeting case. Create one "Example 3"' for each player and set each respective player as a Player Group Single to the bbSetGroup function.
That's about it :)
How do we do to do a bars ''Example 2'' For 5 players and a Target ''Example 3'' For each player ?
I need that ! :)
@junpark84: Go
Hi junpark84,
Sorry I wasn't able to respond sooner. I've been rather inactive on site as of late. Life's sort of catching up with me. :(
Due to the nature of the script, I'm afraid that it's not possible to modify to be able to handle Minerals and Gas. The reason being is that the triggers in the script core directly reference unit properties. In order to refer to minerals and gas instead, The script would need to reference player data (The location where the Mineral and Gas values are stored if I'm not mistaken)
I'm not 100% clear on your requirement (How you plan to display the bars, what should the maximum values be set to?), but there is a workaround you could try that does not require any modification to the Boss Bar script.
(*) Do not use Health, as it would not be able to represent 0 minerals or gas (The unit would die - 0/100 HP)
Hope this helps. If you need any further help, feel free to drop me a mail at [email protected]. I'll respond as soon as it's convenient.
Cheers,
FuzzYD
If I am reading this right you would like to display a player's minerals, gas instead of health, energy. If that is the case i'm fairly sure a lot of scripts need to be rewritten FuzzYD will have more insight on this but to me it sounds like a lot of work to do which in turn goes beyond my knowledge of this script, and my time sorry :(.
i want to use this nice bossbar. but i cant modify it... i wanner express player mineral and gas using bossbar+ but i dont know how to change your script code. anyone can help me?
Hotfixed a bug with the Warpig mercenary Autoportrait not detecting properly. Fixed a little error with the versioning too.
Credits: xXdRaGoNrIdDeRXx :)
@xXdRaGoNrIdDeRXx: Go
Works like a charm! Thanks for the explanation too; this is a great asset to have.
@Gaelidan: Go
Gaelidan - i know what the issue is let me find the right entries and the image should appear as normal the issue involves a mismatch between names when translating the portrait from the unit name will have the code to edit shortly just need to familiarize myself again with this library
Answer to your portrait changing question the portrait that is referenced from using auto mode is in the actor of the unit under art - Model it uses that model file.
The file to edit is in the core folder the name is BossBars+, replace the code in that script with the code in the attached notepad file
Newb question maybe - I am using the bossbar style from example #2, shows hp/shield/energy. Everything is working great but I am using a warpig marine as the setboss. I can use the AutoPortrait=False to get rid of the error message I get in game for the image missing, but it defaults to raynor portrait. I was wondering how I could modify the portrait of my bossbar.
Thanks! This is really a huge help for me; it's literally taken me minutes to implement into my game, but I know it took a lot of hard work to make this work so well.
@xXdRaGoNrIdDeRXx: Go
Thanks for the contribution :) Will upload it shortly!
It works here is a showcase screenshot if you would like
@xXdRaGoNrIdDeRXx: Go
Great :) If you have any further inquiries just drop em here, I've gotta get to bed now. Will respond when I'm able.
@FuzzYD: Go
when i set the positioning it doesnt affect centering it centers it on the x value i set so in esscence the x value i set is in the center of the label thats good
@xXdRaGoNrIdDeRXx: Go
I believe it can only be overridden by the following function:
Where ModCenterSize16 is the string/text format.
@FuzzYD: Go
well if i set the x position statically it should override it right i will check with a trigger that increases the health ingame
@xXdRaGoNrIdDeRXx: Go
Search the QuickLib dependency for a custom script function "void dcCenter(int dc)". What this function does when applied to label control types is that any text set to it will always be automatically centered, thus there should never be a need to dynamically calculate the position of the text to have it centered.
It only needs to be applied once, and the effect lasts until it is overridden.
As I recall, this is already applied to the HPLabel when the boss bar is rendered, so the label should already be auto-centered even as HP get's longer. Please let me know if I'm mistaken on this.
I've got gmail [email protected], No skype I'm afraid. Chat there?
@FuzzYD: Go
ok i have the height correct but is there an auto centering i could have done in that function we edited like it takes the size of the label - size of the bar then divide the result and thats our x position and do it like that for the y axis
math: (labelHeight - BarHeight) / 2 = y
i will have an issue later on when the health value gets bigger'
Edit: idk if ive asked you this but do you have skype if you do my skypename is xxdragonridderxx
@xXdRaGoNrIdDeRXx: Go
Thanks for pointing this out, I'll keep a note to have this enabled in future releases.
Here's the override:
Search for the bbSetPosDC function in the BossBars+ Core, and search for the following line of code:
Replace it with this
If you need to move any of the other labels manually, just add them into this condition.