Dialog with all players

futeki

Active Member
Reaction score
4
How would create a dialog with buttons for all 9 players minus the player it's showing the dialog too?

Edit: Just to make sure I'm clear, I'm trying to get the names of each player on those buttons. Not show a dialog to all players.
 

Aniconic

I am the very model of a modern major general!
Reaction score
3
I tried doing it just now :] Seems to work just fine.

This is the dialog set up. I used 2 for loops and a 2d Array. Integer A represents the player number of the Dialog's owner, and Integer B represents the player number of the players that will be displayed on the Dialog. The If, Then, Else statement makes sure that the player that will be displayed the dialog will not be shown his own name.

Trigger:
  • Dialog
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Dialog - Clear Player_Dialog[(Integer A)]
          • Dialog - Change the title of Player_Dialog[(Integer A)] to (Player + ((String((Integer A))) + Dialog))
          • For each (Integer B) from 1 to 9, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Integer B) Not equal to (Integer A)
                • Then - Actions
                  • Dialog - Create a dialog button for Player_Dialog[(Integer A)] labelled (Player + (String((Integer B))))
                  • Set Player_Dialog_Button[((Integer B) + ((Integer A) x 8))] = (Last created dialog Button)
                • Else - Actions
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Dialog - Show Player_Dialog[(Integer A)] for (Player((Integer A)))


Here is the Dialog Clicked Trigger :D Basically, in the event that any one of the 9 players clicks a dialog button, the trigger will search for the clicked dialog button and catch the player numbers of the players involved.

The player number of the triggering player is List.

The selected player by the triggering player is Integer A :]

Trigger:
  • Clicked
    • Events
      • Dialog - A dialog button is clicked for Player_Dialog[1]
      • Dialog - A dialog button is clicked for Player_Dialog[2]
      • Dialog - A dialog button is clicked for Player_Dialog[3]
      • Dialog - A dialog button is clicked for Player_Dialog[4]
      • Dialog - A dialog button is clicked for Player_Dialog[5]
      • Dialog - A dialog button is clicked for Player_Dialog[6]
      • Dialog - A dialog button is clicked for Player_Dialog[7]
      • Dialog - A dialog button is clicked for Player_Dialog[8]
      • Dialog - A dialog button is clicked for Player_Dialog[9]
    • Conditions
    • Actions
      • Set List = (Player number of (Triggering player))
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to Player_Dialog_Button[((Integer A) + (List x 8))]
            • Then - Actions
              • Game - Display to (All players) the text: ((Name of (Player(List))) + ( has selected + (Name of (Player((Integer A))))))
            • Else - Actions


I put a DL of the trigger work at the bottom of the post. Feel free to DL it! :D

EDIT: if you have any more issues, feel free to drop me a private message
 

Attachments

  • Player_Dialogs.w3x
    17 KB · Views: 128

Aniconic

I am the very model of a modern major general!
Reaction score
3
Not a problem, man.

You might need to tweak it a bit later down the road if and when you decide to optimize your code, but at least the logic is there.
 

futeki

Active Member
Reaction score
4
Will do. My map is so nasty right now it's not even funny. But I can do cleanup and optimization later.

Just trying to get the content and overall functionality in there.
 

Sjaakje

New Member
Reaction score
9
Aniconic, since you seem to be loving saving time by using integers, you could even make it shorter by adding to the first trigger in the final loop the action
Trigger:
  • Trigger - Add to Clicked the event Dialog - A dialog button is clicked for Player_Dialog[(Integer A)]


saves you from having to make the same event nine times in the Clicked trigger.
 

futeki

Active Member
Reaction score
4
Aniconic, since you seem to be loving saving time by using integers, you could even make it shorter by adding to the first trigger in the final loop the action
Trigger:
  • Trigger - Add to Clicked the event Dialog - A dialog button is clicked for Player_Dialog[(Integer A)]


saves you from having to make the same event nine times in the Clicked trigger.

And what function does that use?
 

Aniconic

I am the very model of a modern major general!
Reaction score
3
Aniconic, since you seem to be loving saving time by using integers, you could even make it shorter by adding to the first trigger in the final loop the action
Trigger:
  • Trigger - Add to Clicked the event Dialog - A dialog button is clicked for Player_Dialog[(Integer A)]


saves you from having to make the same event nine times in the Clicked trigger.

True, you could replace it with a periodic event every 1 second that detected when 1 of the 9 dialogs was clicked by using a for loop and a If, Then, Else statement, but I preferred to try and make it as simplified as possible. Sometimes I am paranoid about my code being hard to read, esspecially when I am trying to help someone.


Besides, it still works, and I only have to type out the array names once. :p
 

Sjaakje

New Member
Reaction score
9
I find it hard to get how both you and futeki failed to understand what I typed in that post.

INSTEAD of having 9 events in the second trigger, you make that action in the first trigger at the end of it (inside the final loop) which CREATES the 9 events for the second trigger in ONE action instead of 9. So it saves time. All it does is save time, nothing else. It works the same.

No periodic event...
 

futeki

Active Member
Reaction score
4
I find it hard to get how both you and futeki failed to understand what I typed in that post.

INSTEAD of having 9 events in the second trigger, you make that action in the first trigger at the end of it (inside the final loop) which CREATES the 9 events for the second trigger in ONE action instead of 9. So it saves time. All it does is save time, nothing else. It works the same.

No periodic event...

Based on what you've typed, I still am not following you. Looking at your first reply by the words "Add to Clicked the event Dialog" stick out. Now you're saying add it to the first trigger, perhaps you can copy/paste the triggers and adjust them reflecting your change.
 

HeX.16

Isn't Trollin You Right Now
Reaction score
131
@Sjaakje I dont understand what your saying =/ If you mean by the event, you cannot have a for each integer (check/call/whatever you call it) in an event. If you wouldnt mind show us what you mean.
 

Aniconic

I am the very model of a modern major general!
Reaction score
3
In retrospect, any number of methods would have worked...


Its all based on preference/what you deem appropriate. I chose the method I posted because it was straightforward and it worked. If you have a better method, then by all means, explain it! I'm all eyes/ears/whatever. but whats important is that the question in this topic was answered lol.
 

futeki

Active Member
Reaction score
4
In retrospect, any number of methods would have worked...


Its all based on preference/what you deem appropriate. I chose the method I posted because it was straightforward and it worked. If you have a better method, then by all means, explain it! I'm all eyes/ears/whatever. but whats important is that the question in this topic was answered lol.

I just want him to explain it, I sometimes am not very attention detailed, but I've read his post 13 times and the words that are being used to compose the sentence don't match up with what is available as functions inside of the WE.

In fact "Add to Clicked the event Dialog" is what sticks out the most. The problem is when I try to add that function to the Clicked Event, I don't even see the function. Perhaps someone else can clarify?
 

Aniconic

I am the very model of a modern major general!
Reaction score
3
I see what he is saying now, He is talking about "Trigger - Add new event"

Yeah, that works, Took me awhile to sift through your choice of words, but that makes perfect sense now.
 

futeki

Active Member
Reaction score
4
I see what he is saying now, He is talking about "Trigger - Add new event"

Yeah, that works, Took me awhile to sift through your choice of words, but that makes perfect sense now.

Yea, I finally figured it out. Took a bit of testing.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top