• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

How to make a mulit used dialogs for players

Status
Not open for further replies.
Level 1
Joined
Mar 2, 2012
Messages
2
Hi,
I am new to the galaxy editor and trying to finish this hero selection. I have learned most of the basic stuff from YouTube tutorials.
The problem I have current is when players selects character and spams the button it will create duplicate dialogs of the selection character and the duplicated when players move on. I have asked a few people but I could not get the hold of the person to help me finish it. I know that I have to put a critical section but don’t know where.

That is the trigger that I am having problem with written below. Any help would be great thanks.


Dialog;Class Selected
Events
Dialog - Any Dialog Item is used by Player Any Player with event type Clicked
Local Variables
ClassSelected = 0 <Integer>
Conditions
DialogeConfirmSelection != (Used dialog item)
Actions
Variable - Set ClassSelected = (Dialog;FindClassSelected(, (Used dialog item)))
UI - Display (Text(ClassSelected)) for (All players) to Subtitle area
Dialog - Destroy Dialog;PreviousSelectedItem
Dialog - Destroy Dialog;PreviousSelectedDialog
General - Enter critical section using Dialog;MuTEX[(Picked player)]
Actions
General - Switch (Actions) depending on ClassSelected
Cases
General - If (0)
Actions
Dialog;ZoomtoClass((Triggering player), Point 001, 5.0, 35.0, 0.0, 2.0)
Dialog;Class Visual Rifleman()
General - If (1)
Actions
Dialog;ZoomtoClass((Triggering player), Point 002, 5.0, 35.0, -45.0, 2.0)
Dialog;Class Visual Medic()
General - If (2)
Actions
Dialog;Class Visual Gunner()
Dialog;ZoomtoClass((Triggering player), Point 003, 5.0, 35.0, -90.0, 2.0)
General - If (3)
Actions
Dialog;ZoomtoClass((Triggering player), Point 004, 5.0, 35.0, -125.0, 2.0)
Dialog;Class Visual Flamer()
General - If (4)
Actions
Dialog;ZoomtoClass((Triggering player), Point 005, 5.0, 35.0, -180.0, 2.0)
Dialog;Class Visual Recon()
General - If (5)
Actions
Dialog;ZoomtoClass((Triggering player), Point 006, 5.0, 35.0, -225.0, 2.0)
Dialog;Class Visual MM()
General - If (6)
Actions
Dialog;ZoomtoClass((Triggering player), Point 007, 5.0, 35.0, -270.0, 2.0)
Dialog;Class Visual CE()
General - If (7)
Actions
Dialog;ZoomtoClass((Triggering player), Point 008, 5.0, 35.0, -315.0, 2.0)
Dialog;Class Visual IUL()
Default
Variable - Set Dialog;PreviousSelectedDialog = (Last created dialog)
Variable - Set Dialog;PreviousSelectedItem = (Last created dialog item)
 
I haven't even looked at all that jumbled mess of a trigger but I can tell you one thing;
In SC2 a player can click a dialogue item multiple times before the game recognizes that it's been clicked but will still read all clicks.
So if you tell a dialogue item to close immediately after being clicked the player can still click multiple times.
The solution to this? None, really.
All I can do is offer advise on ways around it;
Create a custom unit and give it custom abilities with custom buttons in place for any game-altering actions (for example a vote kick.. you wouldnt want one player being able to vote 3 times would you?) instead of using dialogues.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Use boolean variables. When players make choices you set the boolean variable representing the choice that he has made so any further attempts to make choices of that type from that player can be discarded (simple conditional test and then shut down the thread).

Create a custom unit and give it custom abilities with custom buttons in place for any game-altering actions (for example a vote kick.. you wouldnt want one player being able to vote 3 times would you?) instead of using dialogues.
Yes so you just prevent him for registering more than 1 vote from a dialog? In any case you have to do these tests as hidden dialogs can still have their buttons interacted with via hackers.

Think of you trying to vote in real life. You can try to vote real life, even filling in two ballots but the problem is the system of voting does not allow you to submit two ballots, the other will have to be discarded.

The concept is you design the trigger handlers to fire multiple times from dialog events. If a specific action is not meant to occur multiple times you make the script execute in such a state that it will not.
 
Here's an example of a dialog with a label I made. I just copypaste this to make new dialogues and I have ones with buttons and stuff too, my order form dialogue is the most complicated of them all with a lot of buttons, labels, and other stuff involved.

JASS:
void gt_TerrainDialogCreate_Func () {
    const int   lv_width    = 800;
    const int   lv_height   = 35;
    const int   lv_anchor   = c_anchorCenter;
    const int   lv_offsetX  = 0;
    const int   lv_offsetY  = 0;
    const bool  lv_modal    = false;
    const string lv_bgImage = "Assets\\Textures\\blank.dds";
    const string lv_style   = "<s val=\"ModCenterSize20Bold\">";
    
    text        lv_txt;
    
    gv_terrainDialog = DialogCreate(lv_width, lv_height, lv_anchor, lv_offsetX, lv_offsetY, lv_modal);
    DialogSetImage(gv_terrainDialog, lv_bgImage);
    DialogSetVisible(gv_terrainDialog, gv_allPlayers, false);
    
    gv_terrainLabel = DialogControlCreate(gv_terrainDialog, c_triggerControlTypeLabel);
    DialogControlSetSize(gv_terrainLabel, gv_allPlayers, lv_width, lv_height);
    DialogControlSetPosition(gv_terrainLabel, gv_allPlayers, c_anchorBottom, 0, 0);
    lv_txt = StringToText("<c val=\"FFAA56\">Generating ???");
    DialogControlSetPropertyAsText(gv_terrainLabel, c_triggerControlPropertyText, gv_allPlayers, StringToText(lv_style) + lv_txt);
    DialogControlSetPropertyAsString(gv_terrainLabel, c_triggerControlPropertyStyle, gv_allPlayers, "CenterJustified");
    DialogControlSetVisible(gv_terrainLabel, gv_allPlayers, true);
}
 
Status
Not open for further replies.
Top