• 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.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

[Trigger] How to create an dialog array?

Status
Not open for further replies.
Level 11
Joined
Oct 9, 2015
Messages
721
Is it possible to make dialog arrays so I don't need to make one dialog for each player?

When a player opens the dialog, it clears the dialog for the player that was using it before him, is there a way to make it work properly?

Thanks in advice, help is much appreciated!
 
Level 14
Joined
Nov 30, 2013
Messages
924
When a player opens the dialog, it clears the dialog for the player that was using it before him

That part confused me.
I created a simple dialog trigger below but I'm not sure if this how you wanted.
  • Melee Initialization
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Dialog - Clear Dialog[(Player number of (Picked player))]
          • Dialog - Change the title of Dialog[(Player number of (Picked player))] to Who are you?
          • Dialog - Create a dialog button for Dialog[(Player number of (Picked player))] labelled It's me.
          • Set DialogBut1[(Player number of (Picked player))] = (Last created dialog Button)
          • Dialog - Create a dialog button for Dialog[(Player number of (Picked player))] labelled Bill Gates
          • Set DialogBut2[(Player number of (Picked player))] = (Last created dialog Button)
          • Dialog - Create a dialog button for Dialog[(Player number of (Picked player))] labelled Tarantula
          • Set DialogBut3[(Player number of (Picked player))] = (Last created dialog Button)
          • Dialog - Show Dialog[(Player number of (Picked player))] for (Picked player)
 
Level 14
Joined
Nov 30, 2013
Messages
924
My trigger is very similar to this but then how can I check for clicking dialog buttons?

Somehow like this maybe?
For example, if a dialog button is clicked by Player 1, this will run.
  • Player 1 Dialog
    • Events
      • Dialog - A dialog button is clicked for Dialog[1]
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogBut1[1]
        • Then - Actions
          • Game - Display to (All players) the text: What
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogBut2[1]
        • Then - Actions
          • Game - Display to (All players) the text: What2
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogBut3[1]
        • Then - Actions
          • Game - Display to (All players) the text: What3
        • Else - Actions
Or if it clicked by Player 2, this will run.
  • Player 2 Dialog
    • Events
      • Dialog - A dialog button is clicked for Dialog[2]
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogBut1[2]
        • Then - Actions
          • Game - Display to (All players) the text: Bruj
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogBut2[2]
        • Then - Actions
          • Game - Display to (All players) the text: Bruh
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogBut3[2]
        • Then - Actions
          • Game - Display to (All players) the text: Bruh
        • Else - Actions
 
Level 11
Joined
Oct 9, 2015
Messages
721
I have these triggers:

  • Dialogs
    • Events
      • Player - Player 1 (Red) Selects a unit
      • Player - Player 4 (Purple) Selects a unit
      • Player - Player 5 (Yellow) Selects a unit
      • Player - Player 6 (Orange) Selects a unit
      • Player - Player 7 (Green) Selects a unit
      • Player - Player 8 (Pink) Selects a unit
      • Player - Player 9 (Gray) Selects a unit
      • Player - Player 10 (Light Blue) Selects a unit
      • Player - Player 11 (Dark Green) Selects a unit
      • Player - Player 12 (Brown) Selects a unit
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (armastime1 <gen> contains Unit[(Player number of (Triggering player))]) Equal to True
          • (armastime2 <gen> contains Unit[(Player number of (Triggering player))]) Equal to True
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to Armoreiro (armas)
    • Actions
      • Dialog - Clear Armas[(Player number of (Triggering player))]
      • Dialog - Change the title of Armas[(Player number of (Triggering player))] to Escolha uma Arma
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Espada
      • Set DialogButtonsArmas[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Escudo
      • Set DialogButtonsArmas[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Arco
      • Set DialogButtonsArmas[3] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Espada Longa
      • Set DialogButtonsArmas[4] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Lança
      • Set DialogButtonsArmas[5] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Martelo de Bronze
      • Set DialogButtonsArmas[6] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Marreta de Bronze
      • Set DialogButtonsArmas[7] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Sair
      • Set DialogButtonsArmas[8] = (Last created dialog Button)
      • -------- Showing the dialog to all players --------
      • Dialog - Show Armas[(Player number of (Triggering player))] for (Triggering player)
      • Selection - Select Unit[(Player number of (Triggering player))] for (Triggering player)
      • -------- Setup for Dialog 1 --------
  • Dialogs2
    • Events
    • Conditions
      • (Clicked dialog button) Not equal to DialogButtonsArmas[8]
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButtonsArmas[1]
          • (Unit[(Player number of (Triggering player))] has an item of type Espada de Bronze) Equal to False
        • Then - Actions
          • Hero - Create Espada de Bronze and give it to Unit[(Player number of (Triggering player))]
        • Else - Actions
      • -------- Setup for Dialog 1 --------
      • Dialog - Clear Armas[(Player number of (Triggering player))]
      • Dialog - Change the title of Armas[(Player number of (Triggering player))] to Escolha uma Arma
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Espada
      • Set DialogButtonsArmas[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Escudo
      • Set DialogButtonsArmas[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Arco
      • Set DialogButtonsArmas[3] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Espada Longa
      • Set DialogButtonsArmas[4] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Lança
      • Set DialogButtonsArmas[5] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Martelo de Bronze
      • Set DialogButtonsArmas[6] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Marreta de Bronze
      • Set DialogButtonsArmas[7] = (Last created dialog Button)
      • Dialog - Create a dialog button for Armas[(Player number of (Triggering player))] labelled Sair
      • Set DialogButtonsArmas[8] = (Last created dialog Button)
      • -------- Showing the dialog to all players --------
      • Dialog - Show Armas[(Player number of (Triggering player))] for (Triggering player)
      • Selection - Select Unit[(Player number of (Triggering player))] for (Triggering player)
I've added the event for the scond trigger by another trigger with action:
  • Trigger - Add to Dando o item <gen> the event (Dialog - A dialog button is clicked for Armas[(Player number of (Triggering player))])
But this dialog are only working for player 1 and when I managed to make it work for all players if a player opened the dialog and another player was using it, then the dialog for player that was using it before gets cleared.
 
Level 14
Joined
Nov 30, 2013
Messages
924
Can't see a better way of doing it (including those text messages :p)

This is even better.
It would be a waste if you created several Dialog Button arrays per the single Dialog Array.
You can try this: set DialogBut[(0 * 9) + 1] = (Last created dialog Button)

Here's how its work btw. set DialogBut[(1st Index * MaxAmount) + 2nd Index]
If you set the MaxAmount into 9 for example, you can set the 2nd Index between 0-8.
But if you set the 2nd Index above 8, it would messed it up.

DialogBut[(0 * 15) + 0)] = DialogBut[0] (Works fine)

DialogBut[(2 * 15) + 4)] = DialogBut[34] (Works fine)

DialogBut[(0 * 15) + 15)] = DialogBut[15]
DialogBut[(1 * 15) + 0)] = DialogBut[15] (Both of these will messed up each other)

DialogBut[(0 * 15) + 14)] = DialogBut[14]
DialogBut[(1 * 15) + 0)] = DialogBut[15] (Both of these works fine)

Since you only pick 12 players, it's still far off the Array's limit so this probably work as well.

This kind of trick is actually similar to this: set DialogBut[0][1] = (Last created dialog Button)
but the difference is you'll kinda annoyed because of the MaxAmount
 
Status
Not open for further replies.
Top