I've been trying to learn a lot of new things for my project, but I'm so swamped with other things that I'm working on that this is something I'd just rather live without than learn from scratch. However, if someone already has something similar that I can borrow and adapt, I'd be eternally grateful.
I need two Inventory style boxes that appear when a unit type is clicked on. All they need to actually do is have an appropriate background icon and display an integer that would be set by triggers. If unit type 1 is clicked, the boxes show up displaying integers 1a and 1b. It doesn't need to be large or impressive. It's just meant to show the user some in game information.
From now on, I'm going to use the phrase Pick and do anytime I need to refer to the action Pick each (whatever) and do actions. Because it just sounds awesome in my head.
A word of caution: the "pick each..." family of actions suffers from a couple of weird bugs that can cause errors for no apparent reason whatsoever. They cannot be relied upon and as such I recommend getting in the habit of using the "for each..." actions instead.
I'd considered it, but the icons there are something I would actually like to leave as is. The upgrades that normally go there will still be displayed there. If I changed them (the weapon, at least), you would no longer be able to see the unit's damage, correct?
A word of caution: the "pick each..." family of actions suffers from a couple of weird bugs that can cause errors for no apparent reason whatsoever. They cannot be relied upon and as such I recommend getting in the habit of using the "for each..." actions instead.
Interesting. I've actually only stumbled across "for each" once, and it was in the 101 thread about using do while loops. At least I believe the one the TC was comparing it to was "for each". It only compared "while loops" with "for loops".
I meant adding another icon to the unit's equipment array, but I just found out that apparently there's no way to set the level number that way.
However, the same style could be used in a custom UI panel and you could set the textures and number through triggers.
Or would something like this be more to your liking?
The problem with that, I've found, is that the numbers can be pretty difficult to read against the colorful backgrounds, which is why I dimmed them slightly, which helps mitigate that issue.
If you can be more specific how you want it to look I can try making it so.
Sorry for the delay. The thing is I'm not quite happy with the solution I came up with yet. Specifically, I want to make it so you can have nice tooltips (instead of this) on the icons and also allow you to position them more flexibly (right now it's positioned relative to the command card and changing it to, for example, above the minimap would require several XML edits).
But the layout engine in SC2 is hard...
Just to give you an idea, the functionality I'm trying to leverage ("CollapseLayout"), isn't documented anywhere and comes up with a mere two pages of search results on Google. This is a dark magic that very few people understand and are willing to teach...
Anyway, what I showed you can be done quick & dirty through triggers (minus the tooltips). Do you want an example map for that in the meantime or can it wait? Or do you want me to just send you what I have now?
I understand that. The part that I don't understand is how to apply this to frames containing many different frames, especially frames that aren't tooltips. E.g. I want to wrap up those two number icons (each one made up of a background image, an image and a label) in a container that could then be positioned anywhere easily. Right now I have the container stretching up all the way to $parent (FullscreenUpperContainer) except for the bottom, which is anchored to the top of the command card, because I can't make it only as tall and wide as it needs to be (without hard-coding values).
I've been toying around with dialog a little bit, and I've come up with a solution that I can live with, after a little more experimentation. I've not even got to the text portion yet, but is there a trick I need to know in advance to make a counter display in real time?
The dialog is supposed to show up for 8 seconds, which it does, but I want one of the text displays to show an actively changing integer value. If I convert the integer into text, will it automatically update as the integer does, or does it need to be "refreshed" every half second or so?
I understand that. The part that I don't understand is how to apply this to frames containing many different frames, especially frames that aren't tooltips. E.g. I want to wrap up those two number icons (each one made up of a background image, an image and a label) in a container that could then be positioned anywhere easily. Right now I have the container stretching up all the way to $parent (FullscreenUpperContainer) except for the bottom, which is anchored to the top of the command card, because I can't make it only as tall and wide as it needs to be (without hard-coding values).
The container is not visible, so its size can be pretty much the entire screen. There is no problem with that.
But, if you really want to, you can set an anchor to a child frame via just using the child frame's name in the anchor's relative="ChildFrame". If you position your last upgrade icon slot properly, you can just use its top border (= "Min").
You need to refresh it yourself by setting the dialog item text.
Is there a specific loop to use, or just copy paste a bunch of waits?
I attempted my first do while loop that had a Boolean break and was supposed to set a progress bar to an integer. Outside the loop was an 8 second wait and then it set the Boolean. The result was that anytime the trigger fired ingame, it froze for 8 seconds and didn't show anything.
The container is not visible, so its size can be pretty much the entire screen. There is no problem with that.
Yes, there is a problem with that. Changing the positioning is unnecessarily more convoluted than it should be. Right now the icons are anchored to the bottom-right of the container. If I wanted them above the unit portrait, I'd have to change the anchoring of the container and the icon template. Also, it interferes with being able to click on other frames in the UI editor.
But, if you really want to, you can set an anchor to a child frame via just using the child frame's name in the anchor's relative="ChildFrame". If you position your last upgrade icon slot properly, you can just use its top border (= "Min").
And what if I later decide to add/rearrange/remove things? Then I have to find and update every other frame that was anchoring to some arbitrary child instead of the container when that was really the intent.
I'm not looking for good 'nuff's. I want to know the proper, clean way.
Don't update the UI if you don't have to. Just set the text together when you actually change the value.
Well, the idea is for the dialog text to show a kill count. And the way the map works, it will definitely be changing a lot more often than every 8 seconds...
Yes, there is a problem with that. Changing the positioning is unnecessarily more convoluted than it should be. Right now the icons are anchored to the bottom-right of the container. If I wanted them above the unit portrait, I'd have to change the anchoring of the container and the icon template. Also, it interferes with being able to click on other frames in the UI editor.
You only have to change the anchoring of your container.
And what if I later decide to add/rearrange/remove things? Then I have to find and update every other frame that was anchoring to some arbitrary child instead of the container when that was really the intent.
I don't understand the problem. My organization would be like this:
1. Child elements inside the container are collapsible, their height and width are. The child elements are positioned in a row next to each other in the bottom right of their container frame. Their anchors are bound to another, e.g. bottom anchor of the first child and right anchor bound to predecessor child.
To describe the content of each slot, you can create and apply templates as every slot's label and images are created in the same way.
2. The container is anchored with its left anchor to the last child element slot. The bottom right anchors are bound to wherever you want the child elements to appear. If you want the top border to be set correctly, you can use animations for each frame in UI or a state group in UI or set the height in trigger code. But you would only need to do that if you really require the height to be 0 when there are no slots visible.
3. Other frames anchor to the container and are always closely positioned to the space requirements of that container (except for the height unless you add that in one of the 3 ways described above).
4. Triggers hook up each slot's frame, the label and the icon image and edit visibility, text and the image file.
2013 is when the UI stuff was new and I learned everything. Nowadays I am most likely the person outside Blizzard that knows most about UI editing in SC2/Heroes of the Storm. For example, only a couple of people know about the new UI feature of animations and state groups (but to use these features you need to abandon the SC2 editor for UI editing).
So, trying to make me understand your problems is a good way of getting my input. Currently, I am struggling a bit understanding what exactly the problem is as most likely you come with other UI concepts that I do not know.
I dont do any UI editing; but I do a lot of dialog work to make my own UI like stuff. Considering you are setting values for this box with triggers anyway, why not just make a dialog box and use the triggers to update said dialog box?
More specifically, say what you want in the long run, so we can show you other ways of getting there. If what you want is an icon on the screen with a number on it reflecting a variable, yes, use a dialog box. This is 5 minutes worth of work.
Dialog - Create a Modal dialog of size (335, 320) at (-20, 140) relative to Right of screen
Variable - Set Help Dialog Buttons - Dialog Box = (Last created dialog)
Dialog - Show (Last created dialog) for (All players)
Dialog - Hide the background image of (Last created dialog)
Dialog - Create an image for dialog (Last created dialog) with the dimensions ((X Size - 10), (Y Size - 10)) anchored to Top Left with an offset of ((X Pos + 5), (Y Pos + 5)) setting the tooltip to "" using the image Temp Image[index] as a Normal type with tiled set to False tint color (100%, 100%, 100%) and blend mode Normal
Variable - Set Help Dialog Buttons - Dialog Items[index][2] = (Last created dialog item)
Dialog - Create an image for dialog (Last created dialog) with the dimensions ((X Size - 0), (Y Size - 0)) anchored to Top Left with an offset of ((X Pos + 0), (Y Pos + 0)) setting the tooltip to "" using the image Assets\Textures\ui_multiplayerload_avatarborder_grandmaster.dds as a Normal type with tiled set to False tint color (100%, 100%, 100%) and blend mode Normal
Variable - Set Help Dialog Buttons - Dialog Items[index][3] = (Last created dialog item)
Dialog - Create a label for dialog (Last created dialog) with the dimensions (160, 70) anchored to Top Left with an offset of ((X Pos - 170), (Y Pos + 22)) with the text Temp Text[index] color set to Automatic text writeout set to False with a writeout duration of 2.0
Variable - Set Help Dialog Buttons - Dialog Items[index][4] = (Last created dialog item)
Dialog - Create a button for dialog (Last created dialog) with the dimensions ((X Size - 14), (Y Size - 14)) anchored to Top Left with an offset of ((X Pos + 7), (Y Pos + 7)) setting the tooltip to Temp Text 2[index] with button text "" and the hover image set to Dialog - Highlighted
Dialog - Fade (Last created dialog item) to a transparency of 80.0% over a period of 0.0 seconds for (All players)
Variable - Set Help Dialog Buttons - Dialog Items[index][5] = (Last created dialog item)
Just a copy and paste of one of my dialogs, which puts buttons on the right of the screen to tell players when they have too much gold, skill points, stat points. This gives it a cool border, an icon, a button to be clicked (for triggering events) and text. If you only want a picture and text, you only need 2 parts from it. (Picture attached, the plus sign bottom right)
To update it, you either need to run a loop endlessly (use a repeat - forever, with a wait) or trigger specifically when the data is updated. If it is just a simple display, not like HP or something that needs to be specific to the .1 second, using a 1 second loop isnt bad. Having a lot of little repeat loops isnt good though; if you have multiple repeat loops like that, you should combine them all into 1 trigger and put them on their own thread.
For example, only a couple of people know about the new UI feature of animations and state groups (but to use these features you need to abandon the SC2 editor for UI editing).
Raises his hand, I know about em, I just have never got animations working properly, and have never needed more than 2 states.
Edit: How do you get a button to use 3 states anyways?
As you can imagine, being able to apply templates based on conditions is very powerful. The stategroup above checks the visibility of a couple of other frames to change the state and apply the correct template.
You can set a couple of properties directly with it, too, but which actions and conditions exist is unknown to me. I only know the ones that Blizzard uses in their UIs in SC2 and Heroes.
Animations are for direct responses to events, for example in the following snippet, a frame checks if the unit in the current scope has a special behavior. Its state causes a frame to become visible/hidden. That frame's visibility is used above in the state group.
I dont do any UI editing; but I do a lot of dialog work to make my own UI like stuff.Considering you are setting values for this box with triggers anyway, why not just make a dialog box and use the triggers to update said dialog box?
More specifically, say what you want in the long run, so we can show you other ways of getting there.If what you want is an icon on the screen with a number on it reflecting a variable, yes, use a dialog box.This is 5 minutes worth of work.
I thought dialog was UI? At least, dialog is what I started experimenting with.
And when I first brought this to the UI thread, the information I needed to display didn't need to update. I didn't decide to add the kill counter until I realized it would be better to store all of the information in one place. (One Dialog)
To update it, you either need to run a loop endlessly (use a repeat - forever, with a wait) or trigger specifically when the data is updated.If it is just a simple display, not like HP or something that needs to be specific to the .1 second, using a 1 second loop isnt bad.Having a lot of little repeat loops isnt good though; if you have multiple repeat loops like that, you should combine them all into 1 trigger and put them on their own thread.
As long as there is only one loop running at a time, then it's okay? I have a Boolean "Break" set when the trigger fires, so that it can't be triggered repeatedly, and then when the loop is done, it destroys the dialog and sets the break back to allow it to fire again.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I've been trying to learn a lot of new things for my project, but I'm so swamped with other things that I'm working on that this is something I'd just rather live without than learn from scratch. However, if someone already has something similar that I can borrow and adapt, I'd be eternally grateful.
I need two Inventory style boxes that appear when a unit type is clicked on. All they need to actually do is have an appropriate background icon and display an integer that would be set by triggers. If unit type 1 is clicked, the boxes show up displaying integers 1a and 1b. It doesn't need to be large or impressive. It's just meant to show the user some in game information.
How about using the equipment icons?
A word of caution: the "pick each..." family of actions suffers from a couple of weird bugs that can cause errors for no apparent reason whatsoever. They cannot be relied upon and as such I recommend getting in the habit of using the "for each..." actions instead.
@temhawk: Go
I'd considered it, but the icons there are something I would actually like to leave as is. The upgrades that normally go there will still be displayed there. If I changed them (the weapon, at least), you would no longer be able to see the unit's damage, correct?
Interesting. I've actually only stumbled across "for each" once, and it was in the 101 thread about using do while loops. At least I believe the one the TC was comparing it to was "for each". It only compared "while loops" with "for loops".
I meant adding another icon to the unit's equipment array, but I just found out that apparently there's no way to set the level number that way.
However, the same style could be used in a custom UI panel and you could set the textures and number through triggers.
Or would something like this be more to your liking?
The problem with that, I've found, is that the numbers can be pretty difficult to read against the colorful backgrounds, which is why I dimmed them slightly, which helps mitigate that issue.
If you can be more specific how you want it to look I can try making it so.
That is absolutely perfect. I still haven't decided what kind of icon I want in the background, But that style is exactly what I'm looking for.
Sorry for the delay. The thing is I'm not quite happy with the solution I came up with yet. Specifically, I want to make it so you can have nice tooltips (instead of this) on the icons and also allow you to position them more flexibly (right now it's positioned relative to the command card and changing it to, for example, above the minimap would require several XML edits).
But the layout engine in SC2 is hard...
Just to give you an idea, the functionality I'm trying to leverage ("CollapseLayout"), isn't documented anywhere and comes up with a mere two pages of search results on Google. This is a dark magic that very few people understand and are willing to teach...
Anyway, what I showed you can be done quick & dirty through triggers (minus the tooltips). Do you want an example map for that in the meantime or can it wait? Or do you want me to just send you what I have now?
@temhawk: Go
<CollapseLayout val="true"/> causes a frame's width and height properties to become 0 while the frame's visibility is false.
I understand that. The part that I don't understand is how to apply this to frames containing many different frames, especially frames that aren't tooltips. E.g. I want to wrap up those two number icons (each one made up of a background image, an image and a label) in a container that could then be positioned anywhere easily. Right now I have the container stretching up all the way to $parent (FullscreenUpperContainer) except for the bottom, which is anchored to the top of the command card, because I can't make it only as tall and wide as it needs to be (without hard-coding values).
@temhawk: Go
I've been toying around with dialog a little bit, and I've come up with a solution that I can live with, after a little more experimentation. I've not even got to the text portion yet, but is there a trick I need to know in advance to make a counter display in real time?
The dialog is supposed to show up for 8 seconds, which it does, but I want one of the text displays to show an actively changing integer value. If I convert the integer into text, will it automatically update as the integer does, or does it need to be "refreshed" every half second or so?
You need to refresh it yourself by setting the dialog item text.
The container is not visible, so its size can be pretty much the entire screen. There is no problem with that.
But, if you really want to, you can set an anchor to a child frame via just using the child frame's name in the anchor's relative="ChildFrame". If you position your last upgrade icon slot properly, you can just use its top border (= "Min").
Is there a specific loop to use, or just copy paste a bunch of waits?
I attempted my first do while loop that had a Boolean break and was supposed to set a progress bar to an integer. Outside the loop was an 8 second wait and then it set the Boolean. The result was that anytime the trigger fired ingame, it froze for 8 seconds and didn't show anything.
Yes, there is a problem with that. Changing the positioning is unnecessarily more convoluted than it should be. Right now the icons are anchored to the bottom-right of the container. If I wanted them above the unit portrait, I'd have to change the anchoring of the container and the icon template. Also, it interferes with being able to click on other frames in the UI editor.
And what if I later decide to add/rearrange/remove things? Then I have to find and update every other frame that was anchoring to some arbitrary child instead of the container when that was really the intent.
I'm not looking for good 'nuff's. I want to know the proper, clean way.
I guess you already gave up...
Don't update the UI if you don't have to. Just set the text together when you actually change the value.
Well, the idea is for the dialog text to show a kill count. And the way the map works, it will definitely be changing a lot more often than every 8 seconds...
You only have to change the anchoring of your container.
I don't understand the problem. My organization would be like this:
1. Child elements inside the container are collapsible, their height and width are. The child elements are positioned in a row next to each other in the bottom right of their container frame. Their anchors are bound to another, e.g. bottom anchor of the first child and right anchor bound to predecessor child.
To describe the content of each slot, you can create and apply templates as every slot's label and images are created in the same way.
2. The container is anchored with its left anchor to the last child element slot. The bottom right anchors are bound to wherever you want the child elements to appear. If you want the top border to be set correctly, you can use animations for each frame in UI or a state group in UI or set the height in trigger code. But you would only need to do that if you really require the height to be 0 when there are no slots visible.
3. Other frames anchor to the container and are always closely positioned to the space requirements of that container (except for the height unless you add that in one of the 3 ways described above).
4. Triggers hook up each slot's frame, the label and the icon image and edit visibility, text and the image file.
2013 is when the UI stuff was new and I learned everything. Nowadays I am most likely the person outside Blizzard that knows most about UI editing in SC2/Heroes of the Storm. For example, only a couple of people know about the new UI feature of animations and state groups (but to use these features you need to abandon the SC2 editor for UI editing).
So, trying to make me understand your problems is a good way of getting my input. Currently, I am struggling a bit understanding what exactly the problem is as most likely you come with other UI concepts that I do not know.
I dont do any UI editing; but I do a lot of dialog work to make my own UI like stuff. Considering you are setting values for this box with triggers anyway, why not just make a dialog box and use the triggers to update said dialog box?
More specifically, say what you want in the long run, so we can show you other ways of getting there. If what you want is an icon on the screen with a number on it reflecting a variable, yes, use a dialog box. This is 5 minutes worth of work.
Dialog - Create a Modal dialog of size (335, 320) at (-20, 140) relative to Right of screen
Variable - Set Help Dialog Buttons - Dialog Box = (Last created dialog)
Dialog - Show (Last created dialog) for (All players)
Dialog - Hide the background image of (Last created dialog)
Dialog - Create an image for dialog (Last created dialog) with the dimensions ((X Size - 10), (Y Size - 10)) anchored to Top Left with an offset of ((X Pos + 5), (Y Pos + 5)) setting the tooltip to "" using the image Temp Image[index] as a Normal type with tiled set to False tint color (100%, 100%, 100%) and blend mode Normal
Variable - Set Help Dialog Buttons - Dialog Items[index][2] = (Last created dialog item)
Dialog - Create an image for dialog (Last created dialog) with the dimensions ((X Size - 0), (Y Size - 0)) anchored to Top Left with an offset of ((X Pos + 0), (Y Pos + 0)) setting the tooltip to "" using the image Assets\Textures\ui_multiplayerload_avatarborder_grandmaster.dds as a Normal type with tiled set to False tint color (100%, 100%, 100%) and blend mode Normal
Variable - Set Help Dialog Buttons - Dialog Items[index][3] = (Last created dialog item)
Dialog - Create a label for dialog (Last created dialog) with the dimensions (160, 70) anchored to Top Left with an offset of ((X Pos - 170), (Y Pos + 22)) with the text Temp Text[index] color set to Automatic text writeout set to False with a writeout duration of 2.0
Variable - Set Help Dialog Buttons - Dialog Items[index][4] = (Last created dialog item)
Dialog - Create a button for dialog (Last created dialog) with the dimensions ((X Size - 14), (Y Size - 14)) anchored to Top Left with an offset of ((X Pos + 7), (Y Pos + 7)) setting the tooltip to Temp Text 2[index] with button text "" and the hover image set to Dialog - Highlighted
Dialog - Fade (Last created dialog item) to a transparency of 80.0% over a period of 0.0 seconds for (All players)
Variable - Set Help Dialog Buttons - Dialog Items[index][5] = (Last created dialog item)
Just a copy and paste of one of my dialogs, which puts buttons on the right of the screen to tell players when they have too much gold, skill points, stat points. This gives it a cool border, an icon, a button to be clicked (for triggering events) and text. If you only want a picture and text, you only need 2 parts from it. (Picture attached, the plus sign bottom right)
To update it, you either need to run a loop endlessly (use a repeat - forever, with a wait) or trigger specifically when the data is updated. If it is just a simple display, not like HP or something that needs to be specific to the .1 second, using a 1 second loop isnt bad. Having a lot of little repeat loops isnt good though; if you have multiple repeat loops like that, you should combine them all into 1 trigger and put them on their own thread.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
Raises his hand, I know about em, I just have never got animations working properly, and have never needed more than 2 states.
Edit: How do you get a button to use 3 states anyways?
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
State groups are a construct for logic. They resemble a series of IF-THEN statements.
For example, here is the one I use to change mana bar colors in Heroes of the Storm's observer UI:
As you can imagine, being able to apply templates based on conditions is very powerful. The stategroup above checks the visibility of a couple of other frames to change the state and apply the correct template.
You can set a couple of properties directly with it, too, but which actions and conditions exist is unknown to me. I only know the ones that Blizzard uses in their UIs in SC2 and Heroes.
Animations are for direct responses to events, for example in the following snippet, a frame checks if the unit in the current scope has a special behavior. Its state causes a frame to become visible/hidden. That frame's visibility is used above in the state group.
I thought dialog was UI? At least, dialog is what I started experimenting with.
And when I first brought this to the UI thread, the information I needed to display didn't need to update. I didn't decide to add the kill counter until I realized it would be better to store all of the information in one place. (One Dialog)
As long as there is only one loop running at a time, then it's okay? I have a Boolean "Break" set when the trigger fires, so that it can't be triggered repeatedly, and then when the loop is done, it destroys the dialog and sets the break back to allow it to fire again.