I want to show a timer in the middle of the screen, counting down at various points in the game, and it will be different based on the player. For example if the player dies I want to show a dialog in the middle of the screen, counting down from xx seconds.
I can use a timer window and only show it for the appropriate player, however I can't see any way to get this in the middle of the screen.
It requires an offset from the left of the screen
I'm not sure if we can find out the width of the screen, making it impossible to find the center of the UI
Even though I can center a dialog, when you retrieve the offset of the dialog, they appear to be relative.
It's a shame because that would have been a very simple solution.
So what are my options? Do I really need to create two separate timers (periodic per second and time elapsed) per player, and have these draw the countdown in a dialog?
@KratsAU:
Edit : Woops I misread the whole thing.
If you want a nice customisable timer in the center of the screen, I recommand using dialog functions.
Timer is just a setup Blizzard put but it's not very convenient.
You'll have to create a dialog and set the text to actualize every seconds so that the countdown is shown.
Now if you're fine with the timer Blizzard gave us, you can create a dialog at center, hide its background and anchor the timer to it.
If you want your player to see it, just use this function "show/hide dialog" (in both cases)
If you want differents timers to show for differents player, make a timer array variable so the index is the player's number.
Thanks, but I don't think you can anchor the timer Blizzard gave us can you? That's the problem, it doesn't behave like a dialog item so there is no way to get it in the middle of the screen or even locate it relative to another dialog.
@KratsAU:
Hmm I think you can with "move timer", setting X to dialog's X and Y to dialog's Y. If the dialog is anchored to center, there's no reason it shouldn't work !
How do get a dialogs position though? I have only seen actions that allow you to get the dialogs offset, and this offset is relative to where it is anchored.
So when the dialog is anchored to the center of the screen, these offsets return zero.
Rollback Post to RevisionRollBack
To post a comment, please login or register a new account.
I want to show a timer in the middle of the screen, counting down at various points in the game, and it will be different based on the player. For example if the player dies I want to show a dialog in the middle of the screen, counting down from xx seconds.
I can use a timer window and only show it for the appropriate player, however I can't see any way to get this in the middle of the screen.
It's a shame because that would have been a very simple solution.
So what are my options? Do I really need to create two separate timers (periodic per second and time elapsed) per player, and have these draw the countdown in a dialog?
Any other suggestions?
Quiet forums this weekend!
Thanks, but I don't think you can anchor the timer Blizzard gave us can you? That's the problem, it doesn't behave like a dialog item so there is no way to get it in the middle of the screen or even locate it relative to another dialog.
How do get a dialogs position though? I have only seen actions that allow you to get the dialogs offset, and this offset is relative to where it is anchored.
So when the dialog is anchored to the center of the screen, these offsets return zero.