[Library] Boss Bars Advanced

Beta 03, New design

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 must login to post a comment. Don't have an account? Register to get one!

  • Avatar of FuzzYD FuzzYD Jun 29, 2013 at 06:36 UTC - 0 likes

    You're welcome mate :)

    Works
    AoS2
    Coder
    Boss Bars+
    Custom boss bars
    GXML
    Dialog XML parser
    Project W
    Coder
    RandNAligning dialog labels

  • Avatar of Kingor50 Kingor50 Jun 28, 2013 at 00:27 UTC - 0 likes

    Thanks you :)

    DeadCrusader

    Current Project : The emergence of the of Xalibus championship

    Project in the toilet: Rebuild the Swarm

  • Avatar of FuzzYD FuzzYD Jun 24, 2013 at 02:27 UTC - 0 likes

    @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 :)

  • Avatar of Kingor50 Kingor50 Jun 23, 2013 at 23:25 UTC - 0 likes

    How do we do to do a bars ''Example 2'' For 5 players and a Target ''Example 3'' For each player ?

    I need that ! :)

  • Avatar of FuzzYD FuzzYD May 13, 2013 at 13:25 UTC - 1 like

    @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.

    1. Create a dummy unit. The dummy unit would of course be hidden somewhere on your map where it is not visible.
    2. Have a separate trigger update the Current and Maximum Energy and Shield (*) values of the dummy unit to suit your requirements
    3. Attach the Boss bar to the Dummy unit.
    4. Use the bbSetColorDC To adjust the colors of the bars to your liking, Guessing gas should be Green, minerals Blue.
    5. Whenever the maximum values of either HP or Energy are changed, it may be necessary to refresh the boss bar to update the maximum health value. (I can't remember if I coded it to update HP maximum values automatically)
    6. Have a separate trigger that uses a while loop to periodically update the mineral values. Warning: Do NOT use a periodic trigger event as it is very process intensive and will cause your map to lag.

    (*) 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

    Last edited May 13, 2013 by FuzzYD
  • Avatar of xXdRaGoNrIdDeRXx xXdRaGoNrIdDeRXx Apr 15, 2013 at 16:21 UTC - 0 likes

    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 :(.

    Last edited Apr 15, 2013 by xXdRaGoNrIdDeRXx: comma splice
  • Avatar of junpark84 junpark84 Apr 15, 2013 at 08:31 UTC - 0 likes

    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?

  • Avatar of FuzzYD FuzzYD Mar 06, 2013 at 15:25 UTC - 1 like

    Hotfixed a bug with the Warpig mercenary Autoportrait not detecting properly. Fixed a little error with the versioning too.

    Credits: xXdRaGoNrIdDeRXx :)

  • Avatar of Gaelidan Gaelidan Feb 04, 2013 at 21:56 UTC - 1 like

    @xXdRaGoNrIdDeRXx: Go

    Works like a charm! Thanks for the explanation too; this is a great asset to have.

  • Avatar of xXdRaGoNrIdDeRXx xXdRaGoNrIdDeRXx Feb 04, 2013 at 17:55 UTC - 1 like

    @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.

    Quote from FuzzYD:

    Yes, this is possible. Every unit by default has an actor correct? The auto detect works as such.
    1) Retrieve the actor unit.
    2) Check the actor catalog for the supposed units model name.
    3) Use the name to read into the portrait model catalog, which typically has the same name as the model name with the added string +"Portrait"

    The Artosis Bot for example, has the model name "UtilityBot" under the actor "Model" field.
    It's portrait model is stored in "UtilityBotPortrait" under the "Image" field

    Thus in order to put a portrait for a unit, it should be possible to do by making sure your actor "model" field points to a valid portrait.

    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

    Last edited Feb 04, 2013 by xXdRaGoNrIdDeRXx
    Name Description Size MD5
    BossBars_.txt The edited code to fix ... 35.0 KiB 87c4c5558b7a...

Facts

Date created
Nov 15, 2010
Categories
Last update
Mar 06, 2013
Development stage
Beta
Language
  • enUS
License
All Rights Reserved
Downloads
1,024
Recent files

Authors