• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Hide Dialog button for player. (Solved)

Level 7
Joined
Jun 1, 2009
Messages
104
Hi!
1. Is it possible to hide a dialog button for a specific player? GUI certainly can't do it, but perhaps it's possible with the Jass magic?
2. If not - is it possible to show each player his own dialog (all in the same time), using the same dialog buttons for everyone?

Thanks for help!

Upd: trying multiple dialogs with one button variable. 6 buttons for 8 players. Gonna use this formula to set a button number:

  • Set VariableSet BUTTON[(((N - 1) x 6) + V)] = (Last created dialog Button)
Where N = player number, and V = button variant.
(N-1)x6 gonna be a "player index".
To get a button variant from the different dialogs I'm gonna use:

  • Events
    • Dialog - A dialog button is clicked for Dialog_Settings[1]
    • Dialog - A dialog button is clicked for Dialog_Settings[2]
    • Dialog - A dialog button is clicked for Dialog_Settings[3]
    • Dialog - A dialog button is clicked for Dialog_Settings[4]
    • Dialog - A dialog button is clicked for Dialog_Settings[5]
    • Dialog - A dialog button is clicked for Dialog_Settings[6]
    • Dialog - A dialog button is clicked for Dialog_Settings[7]
    • Dialog - A dialog button is clicked for Dialog_Settings[8]
  • Conditions
  • Actions
  • For each (Integer M) from 0 to 48, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to BUTTON[M]
        • Then - Actions
          • Set VariableSet N = (Player number of (Triggering player))
          • Set VariableSet V = (M - ((N - 1) x 6))
          • Set VariableSet MODE = (MODE + (Real(V)))
          • Set VariableSet Votes_Count = (Votes_Count + 1)
          • Dialog - Hide Dialog_Settings[N] for (Triggering player)
          • -------- Stop Loop --------
          • Custom script: exitwhen true
        • Else - Actions
Will check this later...
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
If you use that trigger, I recommend doing something like this, I think it's a lot easier to comprehend:
  • Events
    • Dialog - A dialog button is clicked for Dialog_Settings[1]
    • Dialog - A dialog button is clicked for Dialog_Settings[2]
    • Dialog - A dialog button is clicked for Dialog_Settings[3]
    • Dialog - A dialog button is clicked for Dialog_Settings[4]
    • Dialog - A dialog button is clicked for Dialog_Settings[5]
    • Dialog - A dialog button is clicked for Dialog_Settings[6]
    • Dialog - A dialog button is clicked for Dialog_Settings[7]
    • Dialog - A dialog button is clicked for Dialog_Settings[8]
  • Conditions
  • Actions
    • Set Variable PN = (Player number of (Triggering player))
    • Set Variable Button_Count = 6
    • Set Variable Button_Offset = (Button_Count x (PN - 1))
    • For each (Integer M) from 1 to Button_Count, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Clicked dialog button) Equal to BUTTON[(M + Button_Offset)]
          • Then - Actions
            • // Add a vote to the chosen mode and track total votes (or whatever you were doing)
            • Set Variable MODE[M] = MODE[M] + 1
            • Set Variable Votes_Count = (Votes_Count + 1)
            • Dialog - Hide Dialog_Settings[PN] for (Triggering player)
          • Else - Actions
Then the buttons can be stored at the following indexes:
Player 1: 1 to 6
Player 2: 7 to 12
Player 3: 13 to 18
etc...
 
Level 7
Joined
Jun 1, 2009
Messages
104
If you use that trigger, I recommend doing something like this, I think it's a lot easier to comprehend
Thanks, this one is way more polished!
It works fine for a single-player, yet need to check it online.

Since the multi-dialog should work, and I still can't find a single mention of hiding buttons for a player by Jass, I think this question is solved.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,546
Sorry for glossing over your actual question. I imagine you can hide it using the BlzFrame natives added in patch 1.31+. I'm not sure though, since Dialogs are created by the user. It may make sense to rely on custom frames entirely since they were created for this exact purpose, in that case you'll have full control over everything.

 
Level 7
Joined
Jun 1, 2009
Messages
104
I imagine you can hide it using the BlzFrame natives added in patch 1.31+. I'm not sure though, since Dialogs are created by the user. It may make sense to rely on custom frames entirely since they were created for this exact purpose, in that case you'll have full control over everything.
This looks quite complicated at first, I'll need some time to figure out this guide. Since GUI multi-dialog works well for online too, I'll keep it for a while. But if I ever need this level of freedom by custom frames - it's always nice to know where to start with. Thank you!
 
Level 19
Joined
Jan 3, 2022
Messages
320
Sane solution #1: create dialogs per player, but only toggle visibility of dialog for the target player
Sane solution #2: Change the button text per-player. Only requires one dialog and custom logic to reopen menu if player clicked the wrong button
Insane solution #3: Doc - DialogAddButton somehow abuse this bug to hide the button once upon creation (remember player can press Escape). (technically vulnerable to client-side cheats)
If the menu is already open, you must refresh the menu with DialogDisplay to show new buttons.
 
Top