Difference between revisions of "Dialogs"

From HIVE
Jump to navigation Jump to search
(Updated the trigger.)
Line 98: Line 98:
  
  
http://vgshorts.com/BBCode/BBCode3.php?ID=15
+
http://vgshorts.com/BBCode/BBCode3.php?ID=220
  Leaderboard Intialization
+
  Leaderboard
 
     Events
 
     Events
 
         Game - Map initialization
 
         Game - Map initialization
 
     Local Variables
 
     Local Variables
 
         Row offset = 0 <Integer>
 
         Row offset = 0 <Integer>
 +
        MD_Y = 157 <Integer>
 
     Conditions
 
     Conditions
 
     Actions
 
     Actions
Line 113: Line 114:
 
                     Then
 
                     Then
 
                         Variable - Modify Current no. of players: + 1
 
                         Variable - Modify Current no. of players: + 1
 +
                        Variable - Modify MD_Y: + 27
 
                     Else
 
                     Else
         Dialog - Create a Modal dialog of size (350, 250) at (0, 25) relative to Top Right of screen
+
         Dialog - Create a Modal dialog of size (350, MD_Y) at (0, 25) relative to Top Right of screen
 
         Variable - Set Main Dialog window = (Last created dialog)
 
         Variable - Set Main Dialog window = (Last created dialog)
 
         Variable - Set Row offset = 130
 
         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 (220, 25) anchored to Top Left with an offset of (50, 50) with the text "Phantom Dodge Ra</c" 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 (100, 25) anchored to Top Right with an offset of (40, 100) with the text "Laps" 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 - Set (Last created dialog item) tooltip to "8 laps to win." for (All players)
         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
+
        ------- Only currently set to support up to three players. It can be set for as many as you want. All you need to do is to reproduce the following IF-THEN-ELSE loop and change what you see has to change for every new loop.
        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
+
        General - If (Conditions) then do (Actions) else do (Actions)
        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
+
            If
        Variable - Set Label Score[0] = (Last created dialog item)
+
                Current no. of players >= 1
        Variable - Modify Row offset: + 27
+
            Then
         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 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 (Name of player 1) 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 "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 (125, 25) anchored to Top Left with an offset of (50, Row offset) with the text (Name of player 1) 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[1])) color set to (Color((Default player 4 color))) 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 (45, Row offset) with the text (Text(Score[1])) color set to (Color((Default player 1 color))) text writeout set to false with a writeout duration of 2.0
        Variable - Set Label Score[1] = (Last created dialog item)
+
                Variable - Set Label Score[1] = (Last created dialog item)
        Variable - Modify Row offset: + 27
+
                Variable - Modify Row offset: + 27
 +
            Else
 +
         General - If (Conditions) then do (Actions) else do (Actions)
 +
            If
 +
                Current no. of players >= 2
 +
            Then
 +
                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 (Name of player 2) 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 (Name of player 2) 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(Score[2])) color set to (Color((Default player 1 color))) text writeout set to false with a writeout duration of 2.0
 +
                Variable - Set Label Score[2] = (Last created dialog item)
 +
                Variable - Modify Row offset: + 27
 +
            Else
 +
         General - If (Conditions) then do (Actions) else do (Actions)
 +
            If
 +
                Current no. of players >= 3
 +
            Then
 +
                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 (Name of player 3) 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 (Name of player 3) 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(Score[3])) color set to (Color((Default player 1 color))) text writeout set to false with a writeout duration of 2.0
 +
                Variable - Set Label Score[3] = (Last created dialog item)
 +
                Variable - Modify Row offset: + 27
 +
            Else
 
         Dialog - Show Main Dialog window for (All players)
 
         Dialog - Show Main Dialog window for (All players)
 
         Variable - Set Row Offset for theme = Row offset
 
         Variable - Set Row Offset for theme = Row offset
Line 135: Line 158:
 
         Variable - Set Row Offset for theme = 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 only "maintenance" it requires is to update the "'''Set Label Score[]'''" variable.
+
 
 +
Note: The only "maintenance" it requires is to update the "'''Set Label Score[]'''" variable.
 +
 
 +
It can be long to try to reproduce this trigger. In order to save you time, you should take a look at the "See Also" section where a map has been listed for you to "steal" the trigger from without any requirements of credits.
  
 
=See Also=
 
=See Also=
 +
*[http://www.staredit.net/starcraft2maps/49-Phantom-Dodge-Race Phantom Dodge Race]: An Open Source map project from StarEdit Network that features a Dialog-Leaderboard (in fact, the trigger reference of this current wiki comes directly from this map, so if you want a quicker way to reproduce it, just copy-paste it from the map to yours)
 
*[http://www.sc2mapster.com/maps/dialog-designer/ 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.
 
*[http://www.sc2mapster.com/maps/dialog-designer/ 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]]
 
*[[Dialog Item]]

Revision as of 03:12, 1 December 2010

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

General Theory

Dialogs' coordinates are relative to the screen. The Dialogs basically act as "content boxes" which will be filled with information.

Those "informations" are Dialog Items. There are different types: Image, Button, Text, etc.

All Dialog Items must be linked to a Dialog (Create Dialog Item 'x' for Dialog 'x'). Their coordinates are relative to the Dialog box itself (for example, "(0,0) offset from Top Right of Dialog 'x'").

Hiding a Dialog will hide all the Dialog Items it contains.

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, a StarEdit Network community's member. 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=220

Leaderboard
   Events
       Game - Map initialization
   Local Variables
       Row offset = 0 <Integer>
       MD_Y = 157 <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
                       Variable - Modify MD_Y: + 27
                   Else
       Dialog - Create a Modal dialog of size (350, MD_Y) 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 "Phantom Dodge Ra</c" 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 (100, 25) anchored to Top Right with an offset of (40, 100) with the text "Laps" color set to White text writeout set to false with a writeout duration of 2.0
       Dialog - Set (Last created dialog item) tooltip to "8 laps to win." for (All players)
       ------- Only currently set to support up to three players. It can be set for as many as you want. All you need to do is to reproduce the following IF-THEN-ELSE loop and change what you see has to change for every new loop.
       General - If (Conditions) then do (Actions) else do (Actions)
           If
               Current no. of players >= 1
           Then
               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 (Name of player 1) 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 (Name of player 1) 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(Score[1])) color set to (Color((Default player 1 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
           Else
       General - If (Conditions) then do (Actions) else do (Actions)
           If
               Current no. of players >= 2
           Then
               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 (Name of player 2) 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 (Name of player 2) 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(Score[2])) color set to (Color((Default player 1 color))) text writeout set to false with a writeout duration of 2.0
               Variable - Set Label Score[2] = (Last created dialog item)
               Variable - Modify Row offset: + 27
           Else
       General - If (Conditions) then do (Actions) else do (Actions)
           If
               Current no. of players >= 3
           Then
               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 (Name of player 3) 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 (Name of player 3) 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(Score[3])) color set to (Color((Default player 1 color))) text writeout set to false with a writeout duration of 2.0
               Variable - Set Label Score[3] = (Last created dialog item)
               Variable - Modify Row offset: + 27
           Else
       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: The only "maintenance" it requires is to update the "Set Label Score[]" variable.

It can be long to try to reproduce this trigger. In order to save you time, you should take a look at the "See Also" section where a map has been listed for you to "steal" the trigger from without any requirements of credits.

See Also

  • Phantom Dodge Race: An Open Source map project from StarEdit Network that features a Dialog-Leaderboard (in fact, the trigger reference of this current wiki comes directly from this map, so if you want a quicker way to reproduce it, just copy-paste it from the map to yours)
  • 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
  • Timer Dialogs