• 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.

Error with a Dialog Array

Status
Not open for further replies.
Level 4
Joined
May 6, 2007
Messages
87
Heyas, folks.

I've got a curious error in my trigger. I set up an array of dialog windows (size 7, since there are 7 players), as well as three buttons for each dialog (each button also uses an array of size 7).

You may find my actual problem at the bottom of this post.

  • Do Multiple ActionsFor each (Integer A) from 1 to totalPlayers, do (Actions)
    • Loop - Actions
      • -------- Creates a dialog for each active player, as well as three buttons for each dialog. --------
      • Dialog - Create a dialog button for difficultyDialog[((Integer A) - 1)] labelled Normal
      • Set buttonNormal[((Integer A) - 1)] = (Last created dialog Button)
      • Dialog - Create a dialog button for difficultyDialog[((Integer A) - 1)] labelled Nightmare
      • Set buttonNightmare[((Integer A) - 1)] = (Last created dialog Button)
      • Dialog - Create a dialog button for difficultyDialog[((Integer A) - 1)] labelled Hell
      • Set buttonHell[((Integer A) - 1)] = (Last created dialog Button)
      • Dialog - Change the title of difficultyDialog[((Integer A) - 1)] to |cffffd700Your pers...
      • Dialog - Show difficultyDialog[((Integer A) - 1)] for (Player((Integer A)))
      • Wait 10.00 seconds
      • Trigger - Run Difficulty Safety <gen> (ignoring conditions)
When I test this map alone, totalplayers is set to one, so it should only run once.

When a button is pressed, a trigger checks to see which button is pressed, and announces the choice to the player, as well as updating his multiboard value.

  • Difficulty Dialog Red
    • Events
      • Dialog - A dialog button is clicked for difficultyDialog[0]
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to (==) buttonNormal[0]
        • Then - Actions
          • -------- If the button 'normal' is pressed by player one (red), then his difficulty level is set to one. This is announced and updated on his multiboard row. --------
          • Set playerDifficulty[0] = 1
          • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (|cffaeea8aYou set have your difficulty to |r + (|cffdab8c7 + (Normal + |r|cffaeea8a.|r)))
          • Multiboard - Set the text for (Last created multiboard) item in column 3, row boardRow[0] to |cffdeb887Normal|r
        • Else - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to (==) buttonNightmare[0]
            • Then - Actions
              • -------- If the button that was pressed was not 'normal,' the trigger runs a check to see which button was actually pressed. --------
              • Set playerDifficulty[0] = 2
              • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (|cffaeea8aYou have set your difficulty to |r + (|cffdab8c7 + (Nightmare + |r|cffaeea8a.|r)))
              • Multiboard - Set the text for (Last created multiboard) item in column 3, row boardRow[0] to |cffdf6c35Nightmare...
            • Else - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Clicked dialog button) Equal to (==) buttonHell[0]
                • Then - Actions
                  • Set playerDifficulty[0] = 3
                  • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (|cffaeea8aYou have set your difficulty to |r + (|cffdab8c7 + (Hell + |r|cffaeea8a.|r)))
                  • Multiboard - Set the text for (Last created multiboard) item in column 3, row boardRow[0] to |cff8b0000Hell|r
                • Else - Actions
                  • -------- This should never happen. --------
                  • Set playerDifficulty[0] = 1
                  • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (|cffaeea8aYou have set your difficulty to |r + (|cffdab8c7 + (Normal + |r|cffaeea8a.|r)))
                  • Multiboard - Set the text for (Last created multiboard) item in column 3, row boardRow[0] to |cffdeb887Normal|r
  • [/HIDDEN]
boardRow is set up here:

  • Player Group - Pick every player in (All players matching ((((Matching player) slot status) Equal to (==) Is playing) and (((Matching player) controller) Equal to (==) User))) and do (Actions)
    • Loop - Actions
      • -------- This sets up the initial values for all columns for each player. --------
      • Set boardRow[((Player number of (Picked player)) - 1)] = rowNumber
      • Multiboard - Set the text for (Last created multiboard) item in column 1, row rowNumber to (playerColor[((Player number of (Picked player)) - 1)] + ((Name of (Picked player)) + |r))
      • Multiboard - Set the text for (Last created multiboard) item in column 2, row rowNumber to 0
      • Multiboard - Set the text for (Last created multiboard) item in column 3, row rowNumber to Not Set
      • Set rowNumber = (rowNumber + 1)
rowNumber has an initial value of 2.

If a button (any button; options are normal/nightmare/hell) is not pressed quickly enough, another trigger defaults the difficulty level to one.

  • Difficulty Safety
    • Events
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Multiple ConditionsAnd - All (Conditions) are true
            • Conditions
              • playerDifficulty[0] Greater than (>) 0
              • playerDifficulty[1] Greater than (>) 0
              • playerDifficulty[2] Greater than (>) 0
              • playerDifficulty[3] Greater than (>) 0
              • playerDifficulty[4] Greater than (>) 0
              • playerDifficulty[5] Greater than (>) 0
              • playerDifficulty[6] Greater than (>) 0
        • Then - Actions
          • -------- If every player has chosen a difficulty level (obviously requires every player to be active), then the rest of the if statement is ignored. --------
          • Do nothing
        • Else - Actions
          • Do Multiple ActionsFor each (Integer A) from 0 to 6, do (Actions)
            • Loop - Actions
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • playerDifficulty[(Integer A)] Greater than (>) 0
                • Then - Actions
                  • -------- Loops through every player. If it finds a player that has chosen a difficulty level, it skips him. --------
                  • Do nothing
                • Else - Actions
                  • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Player(((Integer A) + 1))) slot status) Equal to (==) Is playing
                    • Then - Actions
                      • -------- Loops through every player. If it finds a player that has not chosen a difficulty level, then it defaults his level to one. --------
                      • Set playerDifficulty[(Integer A)] = 1
                      • Multiboard - Set the text for (Last created multiboard) item in column 3, row boardRow[(Integer A)] to |cffdeb887Normal|r
                      • Game - Display to (Player group((Player(((Integer A) + 1))))) for 5.00 seconds the text: (|cffaeea8aSince you have not selected a difficulty level, your difficulty has defaulted to |r + (|cffdab8c7 + (Normal + |r|cffaeea8a.|r)))
                    • Else - Actions
                      • Do nothing
      • Trigger - Run First Run <gen> (ignoring conditions)
PROBLEM:

This is my actual problem. As player one while testing alone, the game creates a dialog box for me with the correct buttons. However, when I press a button (any of the three), nothing happens. Eventually the game decides that I did not press a button, and defaults my difficulty level to one (normal).

When I test this with a second computer over a LAN network, the same thing happens. Both players get the dialog box. However, neither player's clicked button is recognized. They both get their difficulty level defaulted.

Does anybody know how to get an array of dialog boxes to work? Or must I create seven different dialog boxes (using seven different variables)?

Thanks for your time.
 
Last edited:
Level 7
Joined
Jul 20, 2008
Messages
377
You know you can use Triggering Player in response to dialog events, correct? You don't need an individual button for each player, so I believe an array is pointless here.

Furthermore, in your Dialog Create trigger, why do you have the "wait 10 secs" and "Run Difficulty Safety" actions inside the loop? Shouldn't these be outside? I know that if you use waits inside a loop, it can screw things up.

And more nitpicking than anything, I have to say your way of structuring your if-then-else statements is weird... and inefficient. Do Nothing is just waste. Don't bother using Do Nothing. In fact, why don't you get rid of the outer if-then-else completely? It's just not useful at all. Your inner if-then-else handles all of that already.
 
Level 5
Joined
Jan 25, 2006
Messages
103
remove Wait 10.00 seconds
ramove Trigger - Run Difficulty Safety <gen> (ignoring conditions) from dialog create and add it to difficulty dialog red to be last action
also in dialog red do:
Events
Dialog - A dialog button is clicked for difficultyDialog[0]
Actions:
if (Clicked dialog button) Equal to (==) buttonNormal[0] then do
set playerDifficulty[0] = 1
Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (|cffaeea8aYou set have your difficulty to |r + (|cffdab8c7 + (Normal + |r|cffaeea8a.|r)))
Multiboard - Set the text for (Last created multiboard) item in column 3, row boardRow[0] to |cffdeb887Normal|r

else do - if dialog hard is selected do bla bla bla and so on until all options are covered.

Also i should say that your triggers are way too complicated for a pretty simple function and the fact that you are using 4 triggers for this 1 thing is wrong.
It should be done in mostly 3 triggers.
 
Level 6
Joined
Apr 24, 2008
Messages
174
Do Multiple ActionsFor each (Integer A) from 1 to totalPlayers, do (Actions)

Loop - Actions

Dialog - Clear difficultyDialog
Dialog - Change title of difficultyDialog to (What ever)
-------- Add the 2 actions above, it might help a bit --------
Dialog - Create a dialog button for difficultyDialog[((Integer A) - 1)] labelled Normal
Set buttonNormal[((Integer A) - 1)] = (Last created dialog Button)
Dialog - Create a dialog button for difficultyDialog[((Integer A) - 1)] labelled Nightmare
Set buttonNightmare[((Integer A) - 1)] = (Last created dialog Button)
Dialog - Create a dialog button for difficultyDialog[((Integer A) - 1)] labelled Hell
Set buttonHell[((Integer A) - 1)] = (Last created dialog Button)
Dialog - Change the title of difficultyDialog[((Integer A) - 1)] to |cffffd700Your pers...
Dialog - Show difficultyDialog[((Integer A) - 1)] for (Player((Integer A)))
Wait 10.00 seconds
Trigger - Run Difficulty Safety <gen> (ignoring conditions)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Im being really off-topic here, but please, Use Trigger Tags! It is really annoying to read text that should be a trigger!

Why dont you use one dialog, and just show it to all players? It is really pointless to make a different dialog for each player,, And you wont need as much events,,

Well, i dont know much about dialogs, but making one for every player is quite useless (i think)

-Yixx,,-
 
Level 4
Joined
May 6, 2007
Messages
87
Heyas, guys. Sorry for the <really> late reply, I've been out of town for a couple of days.

Going through the replies:

Furthermore, in your Dialog Create trigger, why do you have the "wait 10 secs" and "Run Difficulty Safety" actions inside the loop? Shouldn't these be outside? I know that if you use waits inside a loop, it can screw things up.

Oops. I never moved it back out. Thanks for catching that.

Edit: Upon looking at my triggers, they aren't in the loop. I must have posted an older version...

ramove Trigger - Run Difficulty Safety <gen> (ignoring conditions) from dialog create and add it to difficulty dialog red to be last action

I can't. I have one of those Difficulty Dialog triggers for each player (since I couldn't actually figure out a way to do all the actions for each player in one trigger).

  • also in dialog red do:
  • Events
  • Dialog - A dialog button is clicked for difficultyDialog[0]
  • Actions:
  • if (Clicked dialog button) Equal to (==) buttonNormal[0] then do
  • set playerDifficulty[0] = 1
  • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: (|cffaeea8aYou set have your difficulty to |r + (|cffdab8c7 + (Normal + |r|cffaeea8a.|r)))
  • Multiboard - Set the text for (Last created multiboard) item in column 3, row boardRow[0] to |cffdeb887Normal|r
  • else do - if dialog hard is selected do bla bla bla and so on until all options are covered.

Isn't that what I'm doing?

  • Dialog - Clear difficultyDialog
  • Dialog - Change title of difficultyDialog to (What ever)
  • -------- Add the 2 actions above, it might help a bit --------

Why? I don't think clearing it would do anything due to the array.

Im being really off-topic here, but please, Use Trigger Tags! It is really annoying to read text that should be a trigger!

I hope that wasn't directed to me.

Well, i dont know much about dialogs, but making one for every player is quite useless (i think)

Could someone please confirm this?

Thanks, folks.
 
Level 11
Joined
Nov 15, 2007
Messages
800
If you want every player to have a dialogue, you have to create a dialogue for every player, so ignore that. Other than that I don't really know what's wrong.

Edit: I should clarify that dialogue is English for dialog. :p
 
Status
Not open for further replies.
Top