[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
@FuzzYD: Go
well if you look at the screenshot it is displaying alittle high i just want to move it down a bit you know so its centered vertically too
@xXdRaGoNrIdDeRXx: Go
Where do you wish to move c_HPLabel to?
I'm checking the script now, I faintly recall I might have c_HPLabel locked centered about the HP bar (by design), thus the bbSetPosDC function is currently configured not to work with c_HPLabel.
Give me a moment, I need to check the script to see it can be enabled. There should be a way to enable it.
@FuzzYD: Go
i figured it out its defaulting to terran race not protoss i remember i changed that any ways how can i fix this label it says constant 8 not supported by the setposdc constant 8 is c_HPLabel
FYI: i want to move it
Note: also figured out that it is C+ + and i just took that class not too long ago so now i understand the syntax
@xXdRaGoNrIdDeRXx: Go
My apologies, It could be due a ninja tweak to the color calculation function I did sometime back but forgot to document. This was done as I realized the colors weren't displaying correctly, verified by attempting to apply "888888" for example, but when the "888888" is compared between what is seen in game and in the web browser, there was a noticeable difference in the output color.
Edit:
Also, I can confirm that the Initialize function settings are preserved when the entire folder is copied from one map to another. I've organized it this way in hopes it will make the library importing process more seamless.
@FuzzYD: Go
i rewrote the script by hand as i found that was easier to do then migrate i opened both editors up using sandboxie and just typed in what was there some copy and paste too
Note: thanks for the fix it works now just need to fix the colours they have changed for some reason
Ah, that error, I encountered it while I was rolling out the last patch. It's occurs when the GXML and BossBar libraries did not have their variables initialized. Its a pretty simple fix.
In the gxml custom script dependency, set the initialization function to InitGXML, in the boss bars script, InitBossBarLib.
Edit: Btw did you copy and paste the entire folder? Or migrate the script manually one custom script at a time? I'm a little concerned here that copying the entire folder isn't always preserving the Initialization functions of the custom scripts as I'm expecting.
well i put the new bossbar in and it is completely broken it gets an out of array index when i try running it the old one worked fine but im just wondering why the new boss bar wont work with my existing code
The problem was that the string conversion natives were causing a ton of errors to appear when you use a string that isn't of the right type. For example: String2Int("") would return 0, but spit out an error in 1.5, but not earlier patches. Note that this happened as the Gxml library uses a lot of string conversion to parse its arguments.
I'm not sure what you mean by creation variables, but I believe you you shouldn't have to change anything apart from the old bossbar library files. If you're concerned something may go wrong, Just copy in the new library files in, disable (ctrl+i) the old one and try to run the map. The only major changes are that the script and dependencies are now compact into their own custom scripts to make it easier to copy files between maps, and the 1.5 hotfix. And of course there's the new function I forgot to document here for changing the way image types are applied
also do i just need to import the new functions in without having to change my creation variables but thanks for the quick update
thanks fuzzy but what was the issue with the boss bars
@DragonRider: Thanks for offering to help :) I really appreciate it.
Hotfix is out. I've also compressed all the script into .galaxy files and copied the contents directly into custom scripts. This was done in an effort to improve the portability of the library.
If anyone encounters any problems, kindly report them at the official BossBars+ Library thread.
damn ill take a look into it aswell fuzzy
020812 Update:
Patch 1.5 broke something, Will be investigating the problem and rolling out a hotfix as soon as possible.
@xXdRaGoNrIdDeRXx
Thanks for the thought. I'm sorry to hear about your family crisis. Best wishes that it will be resolved in due time.
hey fuzz thats a good idea i could use it aswell but i think you should get some needed rest this last update was a big one, im not able to work on my map because of family crisis
@bulletbutter
At this point, not just yet, but that sounds like it would make a nice addition. Should I'll consider adding it in. Probably create it as a hidden feature and make an example to allow it's display. Could probably feature automatic unit type detection as well via catalogs. I can't promise another update anytime soon though, having a pretty busy end of the year.
I assume you intend the unit type to be displayed as a text? Similar to what you see when you select the unit? For example. Biological-Mechanical
Does this allow additional information to be displayed on the bar? I need my bars to display that unit type (armored, light, heroic, mechanical, etc), is that possible with this?
@miofantasy
Glad you like it :) Even I have trouble comprehending the Core after not looking at it for awhile. I'm using a lot of shortcut custom functions, so I apologize if it makes readability hard. :P
Awesome!!
I'm trying to comprehend the Core, it's so difficult even though I've learned C. :D
ya buddy im glad your finished im gonna get right on this ill post some questions if i have any