SC2Mapster Forums

Resources > Trigger Libraries & Scripts

[Library] Boss Bars+ b04b

    #1 Nov 15, 2010 at 03:44 UTC - 2 likes

    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 here

    All Rights Reserved 2011 - FuzzYD

    Last edited Feb 13, 2014 by FuzzYD
    • Screenshot2011-11-13_21_06_45.jpg
      Boss bars in action!
    • Screenshot2011-11-13_21_10_06.jpg
      Our ghost is under attack!
    • Screenshot2011-12-18_22_30_20.jpg
      Beta 03, New Design
    • iE4TM4PS_Example.png
      Showcase by iE4TM4PS
    • BBS_DragonRider.png
      Showcase by xxdRaGoNrIdErxx
    Works
    AoS2
    Coder
    Boss Bars+
    Custom boss bars
    GXML
    Dialog XML parser
    Project W
    Coder
    RandNAligning dialog labels

    #2 Jan 03, 2011 at 22:11 UTC - 0 likes

    I'm really looking forward to the finished product for this, will be nice to finally have some powerful boss bars for use with both RPG-esque maps and a variety of others.

    #3 Jan 04, 2011 at 11:03 UTC - 0 likes

    @Shadowclaimer: Go

    I'm happy to hear that. Its really great to get some feedback :) Its about 70% complete at the moment. There's quite a few thing's I'd still like to polish up. Hoping to launch a release candidate before the end of January. Looking at a time-line about 1-3 weeks from now. Got a couple of projects pipelined at the moment. This is the one I usually work on when I have time to burn :P

    Last edited Jan 04, 2011 by FuzzYD
    #4 Jun 17, 2011 at 09:00 UTC - 0 likes

    I am not shure weather this will work. I mean, it is definantly possible to make a boss bar using dialogs. The problem is that regenerating health is a fast paced action. I tested a simple boss bar on a boss with high regeneration. If you use the "health changed" trigger to update the boss bar, it will break down the map script. 1-2 frames per second. I will be trying to modify the blizzard boss bar and incorporate it in my bossbar. I will post it here if it works.

    • Boss_Bar_v4.jpg

    Check out my RPG. 6 heroes with 8 abilities each, 1-4 player coop plus villain player, multistate quests, boss fights with stages, over 180000 items in 4 classes, 5 attributes, custom skilltree, custom journal, trading, hybrid hero-villain gameplay, adaptive soundtrack

    #5 Jun 17, 2011 at 09:25 UTC - 0 likes

    @elunder: Go

    I noticed that too :/ Have you tried it without the trigger debugger? I'm wondering if it's got anything to do with the fact that the trigger debugger doesn't like having a huge number of events.

    #6 Jun 17, 2011 at 20:48 UTC - 0 likes

    Yes, I tried that. Doesn't really da anything. My approach is on ice though, I can't find the template for the boss bar. (I hope its not a dialog!)

    #7 Jun 18, 2011 at 09:15 UTC - 0 likes

    Suprise! It is a dialog... (Built-In>UI>Boss Bar) Blizzard realized it as I did it, but way more inefficiont since they almost completly redraw the entire dialog instead of only updating the health bar. Still, no lag using theirs... I don't get it.

    #8 Oct 12, 2011 at 04:41 UTC - 0 likes
    Quote from elunder: Go

    I am not shure weather this will work. I mean, it is definantly possible to make a boss bar using dialogs. The problem is that regenerating health is a fast paced action. I tested a simple boss bar on a boss with high regeneration. If you use the "health changed" trigger to update the boss bar, it will break down the map script. 1-2 frames per second. I will be trying to modify the blizzard boss bar and incorporate it in my bossbar. I will post it here if it works.

    Forgive the necro, but I'd just like to share a recent discovery. Its possible to have lagless HP/MP updating by running a separate trigger thread that checks every 0.0625s on a units HP and MP, then updating the lengths of the dialog. This is much better as opposed to using events that catch changes in the units HP or MP.

    #9 Nov 13, 2011 at 13:24 UTC - 0 likes

    <necro>

    I am happy to announce that this I've finally managed to find the time to complete this. It is officially in beta now for everyone to test out :) Any feedback on improvements is welcome!

    </necro>

    #10 Nov 13, 2011 at 13:44 UTC - 0 likes

    i am glad this is done it works perfectly for what i need i was just wondering if its possible to make the picture a circle its just a thought thanks FuzzYD your definitely going in my credits

    Last edited Nov 13, 2011 by xXdRaGoNrIdDeRXx
    #11 Nov 13, 2011 at 14:43 UTC - 0 likes
    Quote from xXdRaGoNrIdDeRXx: Go

    i am glad this is done it works perfectly for what i need i was just wondering if its possible to make the picture a circle its just a thought thanks FuzzYD your definitely going in my credits

    I'm happy to hear that :) It certainly could be made a circle, however you would need custom assets for that. All dialog items are created with a specified width and height. There is unfortunately no support by blizzard at this point for circular shaped dialog items, only dialog items that appear to be circular (with custom images)

    To get the circle effect, simply import a circular image and use the BossBarSetImage function to set c_Icon to the directory of your custom asset.

    #12 Nov 13, 2011 at 15:11 UTC - 0 likes

    ok now there is another problem. I want the boss bar to display the name of the player and this is not possible as you made it a string not text if you can change that will be great

    Last edited Nov 13, 2011 by xXdRaGoNrIdDeRXx
    #13 Nov 13, 2011 at 15:41 UTC - 0 likes

    @xXdRaGoNrIdDeRXx: Go

    Alright, Give me a day or two? As I'm currently working on another development. I'll think of some kinda workaround. Text is very hard to manipulate, thus is the reason I originally used strings. Fixing this is not as easy as it sounds, But it's definitely possible as I've done it before.

    Last edited Nov 13, 2011 by FuzzYD
    #14 Nov 13, 2011 at 15:51 UTC - 0 likes

    @FuzzYD: Go

    ok thanks one other question how do i actually change the image the bar uses i see in the example its using the image from the unit well what do i change on the unit to change the picture

    #15 Nov 13, 2011 at 15:57 UTC - 0 likes

    @xXdRaGoNrIdDeRXx: Go

    i might have found out how to do it lol didnt read readme woops

    #16 Nov 13, 2011 at 16:13 UTC - 0 likes

    @xXdRaGoNrIdDeRXx: Go

    Hehe, good to know you found out :)

    #17 Nov 13, 2011 at 17:36 UTC - 0 likes

    Considered uploading what you have so far to the trigger libraries forum?

    #18 Nov 13, 2011 at 17:54 UTC - 0 likes

    @FuzzYD: Go

    noticed you can't click through the dialog is there a way of doing that its not that big of an issue my biggest issue is getting the player name on the dialog

    Last edited Nov 13, 2011 by xXdRaGoNrIdDeRXx
    #19 Nov 13, 2011 at 19:02 UTC - 0 likes

    i am getting some error messages involving catalog stuff here are the messages from trigger debugger

    Quote:

    00:00:05.00 Trigger Error in 'gt_Player2Status_Func': Catalog entry 'AmazonPortrait' was not found
    00:00:05.00 Trigger Error in 'gt_Player2Status_Func': Could not get 'entry' from parameter in 'CatalogFieldValueGet' (value: 4720832)
    00:00:05.00 bbSetImgDC: No image input @ BossBar#1
    00:00:05.00 Trigger Error in 'gt_Player3Status_Func': Catalog entry 'AmazonPortrait' was not found
    00:00:05.00 Trigger Error in 'gt_Player3Status_Func': Could not get 'entry' from parameter in 'CatalogFieldValueGet' (value: 11733197)
    00:00:05.00 bbSetImgDC: No image input @ BossBar#2
    00:00:05.00 Trigger Error in 'gt_Player4Status_Func': Catalog entry 'AmazonPortrait' was not found
    00:00:05.00 Trigger Error in 'gt_Player4Status_Func': Could not get 'entry' from parameter in 'CatalogFieldValueGet' (value: 11733202)
    00:00:05.00 bbSetImgDC: No image input @ BossBar#3
    00:00:05.00 Trigger Error in 'gt_Player5Status_Func': Catalog entry 'AmazonPortrait' was not found
    00:00:05.00 Trigger Error in 'gt_Player5Status_Func': Could not get 'entry' from parameter in 'CatalogFieldValueGet' (value: 11733207)
    00:00:05.00 bbSetImgDC: No image input @ BossBar#4

    Note this is in a quote because i wanted a box around it :)

    I would like to point out i have 5 separate boss bars 1 for the 4 other players and the 5th for the monsters
    am i having this issue because i haven't set something on the unit keep in mind all my units are custom and this happens when the image wants to be create as it happens in monster bar that shows no image could you help me fix this

    #20 Nov 14, 2011 at 04:13 UTC - 0 likes

    @xXdRaGoNrIdDeRXx: Go

    Noted. I'll have to add an option to disable the automatic portrait update feature. It's currently set in a way where whenever you set a boss into the boss bar, it will automatically detect the portrait.

    I recommend you have 4 boss bars for the monsters, 1 for each player. Then use BossBarSetGroup to make each one exclusive to each player. If you have 1 that is shared amongst 4 people, you're going to see the bar switch between monsters every time any player attacks.

    Its done this way because a boss bar that caters multiple units is extremely confusing to work with, due to the number of extra variables that would be necessary to make it work. Source: First attempt at coding this library.

You must login to post a comment. Don't have an account? Register to get one!