Dialogs

From HIVE
Revision as of 06:16, 21 November 2010 by DevliN (talk | contribs) (1 revision: StarEdit.net Wiki)
Jump to navigation Jump to search

Dialogs are used mainly either to create Custom UIs, Choosing Menus or Leaderboard. They create a "floating" cadre that you can fill with text, buttons and variables.

Custom UI

Custom UI are the kind of things that really gives a unique feeling to your map. And it greatly improves the professionalism of your map.

In order to know how to create your own Custom UI, it is highly recommended that you watch this video by Swampfox, one of our members. What's really great about this video is the fact that it also teaches you how to create great Dialogs in general, and not just in the cadre of Custom UIs.

Choosing Menus

You could want to use this application of the Dialogs in a situation where you want players to select a RPG character, a difficulty, and pretty much anything that relates with having a choice and pressing a button. As mentioned in the introduction, you must use a lot of (empty) variables to create a Dialog. Here's an exhaustive list of the type of variables you should create:

  • Dialog
  • 'x' Dialog Item (Where 'x' is the number of buttons you will have)
  • Player Group (Optional - Only if you're planning on not showing the menu to all players)

As you can see, pretty much everything in a Dialog uses up a variable. If you are planning on not showing the menu to all players, fill the "Player Group" variable with the players that will see the menu.

It is strongly recommended to create a whole trigger just for the Dialog itself instead of incorporating it into the "Map Initialization" trigger.

Reference triggers

This is how the "Map Initialization" trigger should look:


http://vgshorts.com/BBCode/BBCode3.php?ID=11

Init
   Events
       Game - Map initialization
   Local Variables
   Conditions
   Actions
       Player Group - Add player 1 to Host
       Trigger - Run Host_Dialog (Ignore Conditions, Don't Wait until it finishes)

As you can see, I am planning on showing the menu only for the Host.


http://vgshorts.com/BBCode/BBCode3.php?ID=12

Host_Dialog
   Events
   Local Variables
   Conditions
   Actions
       Dialog - Create a Modal dialog of size (500, 400) at (0, 0) relative to Center of screen
       Variable - Set Game_Mode_Dialog = (Last created dialog)
       Dialog - Show Game_Mode_Dialog for Host
       Dialog - Set title of Game_Mode_Dialog to "Select a Game Mode"
       Dialog - Display button 1 of size (200, 50) with text "Game mode #1" at Center of screen with offset (0, -90)  (run Game Mode 1 when button is clicked)
       Variable - Set GM_1 = (Last created dialog item)
       Dialog - Set (Last created dialog item) tooltip to "This is a description of the Game mode #1" for (All players)
       Dialog - Display button 2 of size (200, 50) with text "Game mode #2" at Center of screen with offset (0, -40)  (run Game Mode 2 when button is clicked)
       Variable - Set GM_2 = (Last created dialog item)
       Dialog - Set (Last created dialog item) tooltip to "This is a description of the Game mode #2" for (All players)
       Dialog - Display button 3 of size (200, 50) with text "Game mode #3" at Center of screen with offset (0, 10)  (run Game Mode 3 when button is clicked)
       Variable - Set GM_3 = (Last created dialog item)
       Dialog - Set (Last created dialog item) tooltip to "This is a description of the Game mode #3" for (All players)
Note that there aren't any Events or Conditions.
It is also easy to see how often a Variable type action is called in such a trigger.
And again, notice how I this trigger itself references to more triggers (Game Mode #).
Last remark on this trigger: the "positions data" (offset values) have randomly been chosen and do not guarantee any aesthetic result.


http://vgshorts.com/BBCode/BBCode3.php?ID=13

Game Mode 1
   Events
   Local Variables
   Conditions
   Actions
       ------- Insert any action you want to trigger when the player presses this button (the first one, in this case) here

IMPORTANT NOTE: The triggers that buttons triggers must be flagged as Not Initially On. To achieve such a thing, select the trigger and press "Ctrl + Shift + I" or right click it and uncheck the "Initially On" option. If this step has been applied properly, the little white page's trigger icon should have been greyed out. And again, notice that there are no Events nor Conditions.

Leaderboards

Most of the people are using the Leaderboard trigger-label to make this task easier, but here is how you can make Leaderboards with Dialogs.

Reference triggers

The variable list:

       Leaderboard = No Leaderboard <Leaderboard>
       Round Score = 0 <Integer[2]>
       Label Score = No Dialog Item <Dialog Item[2]>
       Row Offset for theme = 0 <Integer>
       Current no. of players = 0 <Integer>
       Main Dialog window = No Dialog <Dialog>

The trigger:


http://vgshorts.com/BBCode/BBCode3.php?ID=15

Leaderboard Intialization
   Events
       Game - Map initialization
   Local Variables
       Row offset = 0 <Integer>
   Conditions
   Actions
       Player Group - Pick each player in (Active Players) and do (Actions)
           Actions
               General - If (Conditions) then do (Actions) else do (Actions)
                   If
                       (Status of player (Picked player)) == Playing
                   Then
                       Variable - Modify Current no. of players: + 1
                   Else
       Dialog - Create a Modal dialog of size (350, 250) at (0, 25) relative to Top Right of screen
       Variable - Set Main Dialog window = (Last created dialog)
       Variable - Set Row offset = 130
       Dialog - Create a label for dialog Main Dialog window with the dimensions (220, 25) anchored to Top Left with an offset of (50, 50) with the text "Random Micro A<" color set to White text writeout set to false with a writeout duration of 2.0
       Dialog - Create a label for dialog Main Dialog window with the dimensions (75, 25) anchored to Top Right with an offset of (100, 100) with the text "Round" color set to White text writeout set to false with a writeout duration of 2.0
       Dialog - Create a label for dialog Main Dialog window with the dimensions (75, 25) anchored to Top Right with an offset of (30, 100) with the text "Score" color set to White text writeout set to false with a writeout duration of 2.0
       Dialog - Create an image for dialog Main Dialog window with the dimensions (282, 37) anchored to Top Left with an offset of (35, (Row offset - 9)) setting the tooltip to "Left Team" using the image Assets\Textures\ui_battlenet_loading_bar_player_frame_highlighted.dds as a Normal type with tiled set to false tint color (Color((Current player 1 color))) and blend mode Normal
       Dialog - Create a label for dialog Main Dialog window with the dimensions (125, 25) anchored to Top Left with an offset of (50, Row offset) with the text "Left Team" color set to (Color((Default player 1 color))) text writeout set to true with a writeout duration of 2.0
       Dialog - Create a label for dialog Main Dialog window with the dimensions (75, 25) anchored to Top Right with an offset of (45, Row offset) with the text (Text(Round Score[0])) color set to (Color((Default player 1 color))) text writeout set to false with a writeout duration of 2.0
       Variable - Set Label Score[0] = (Last created dialog item)
       Variable - Modify Row offset: + 27
       Dialog - Create an image for dialog Main Dialog window with the dimensions (282, 37) anchored to Top Left with an offset of (35, (Row offset - 9)) setting the tooltip to "Right Team" using the image Assets\Textures\ui_battlenet_loading_bar_player_frame_highlighted.dds as a Normal type with tiled set to false tint color (Color((Current player 4 color))) and blend mode Normal
       Dialog - Create a label for dialog Main Dialog window with the dimensions (125, 25) anchored to Top Left with an offset of (50, Row offset) with the text "Right Team" color set to (Color((Default player 4 color))) text writeout set to true with a writeout duration of 2.0
       Dialog - Create a label for dialog Main Dialog window with the dimensions (75, 25) anchored to Top Right with an offset of (45, Row offset) with the text (Text(Round Score[1])) color set to (Color((Default player 4 color))) text writeout set to false with a writeout duration of 2.0
       Variable - Set Label Score[1] = (Last created dialog item)
       Variable - Modify Row offset: + 27
       Dialog - Show Main Dialog window for (All players)
       Variable - Set Row Offset for theme = Row offset
       Variable - Set Current no. of players = 0
       Variable - Set Row Offset for theme = 0

Note: This trigger wasn't designed by me, and I cannot credit the original author since I do not know who it was. The trigger was taken directly from my project "Random Micro Arena". The only "maintenance" it requires is to update the "Set Label Score[]" variable.

See Also

  • Dialog Designer: Creating dialogs isn't hard. However, positioning them so everything looks nice can be hard. This "tool" lets you directly preview what your dialogs would look like from inside Battle.Net.
  • Dialog Item