• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

[Solved] Dialog button issue

Status
Not open for further replies.
Level 17
Joined
Jun 2, 2009
Messages
1,193
  • 1
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Yetenek seçimi
    • Actions
      • Dialog - Clear DiyalogOrman
      • Dialog - Change the title of DiyalogOrman to Kalici yetenegini s...
      • Dialog - Create a dialog button for DiyalogOrman labelled |cffffff00Sprint:|r
      • Set DiyalogBoku[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for DiyalogOrman labelled |cffff0000Slow:|r
      • Set DiyalogBoku[2] = (Last created dialog Button)
      • Dialog - Show DiyalogOrman for (Owner of (Triggering unit))
  • 2
    • Events
      • Dialog - A dialog button is clicked for DiyalogOrman
      • Dialog - A dialog button is clicked for DiyalogOrman2
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DiyalogBoku[1]
        • Then - Actions
          • Set DestekSecti[(Player number of (Triggering player))] = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DiyalogBoku[2]
        • Then - Actions
          • Set DestekSecti[(Player number of (Triggering player))] = True
        • Else - Actions
The problem is, if another player uses this item and first one still on the selection screen, texts removes from the first player and options shows to second player.
How can i make it multiplayer usable or whatever it is?
And i belive there are few unused/useless things available in my trigger. You can remove them if you want.
 
Level 17
Joined
Jun 2, 2009
Messages
1,193
Either use GetLocalPlayer() to modify the Dialog for a single player (might desync) or create a unique Dialog for each Player.
Uhm. You mean you will not advise it for multiplayer?
A little detail about the system. This trigger only works for twice. Both teams have a Jungler role. Only 1 jungle player available for both teams.
Update: Ok i get it but not sure. I will copy this trigger and create unique variables for the second trigger should work.
 

Uncle

Warcraft Moderator
Level 66
Joined
Aug 10, 2018
Messages
6,863
 
Level 13
Joined
Jan 10, 2023
Messages
211
I think a simple solution would be:
  1. Don't clear the dialog every time a player uses an item
  2. Initialize the dialog once at the start of the map (if you don't use the same dialog for multiple things)
  3. Get the triggering player as an event response
As far as being MUI, it technically cannot be because Dialog Windows disable the player from being able to select/ interact with another unit, so this could be MPI (used by any number of players) at best. But it will work for multiple units of the same player at different times if you store the unit in a variable array and let the array index equal the player number, depending on what you plan to do to this unit.

Not sure if you meant to do this, but the way you have it, either button does the same thing (sets DestekSecti to true for that player).

Anyway, here's an example of what I mean:

  • Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Dialog - Change the title of DiyalogOrman to Kalıcı yetenek se...
      • Dialog - Create a dialog button for DiyalogOrman labelled |cffffff00Sprint|r
      • Set VariableSet DiyalogBoku[0] = (Last created dialog Button)
      • Dialog - Create a dialog button for DiyalogOrman labelled |cffffff00Slow|r
      • Set VariableSet DiyalogBoku[1] = (Last created dialog Button)
  • ItemUsed
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Yetenek seçimi
    • Actions
      • Set VariableSet YetenekSecimiUnit[(Player number of (Triggering player))] = (Triggering unit)
      • Dialog - Show DiyalogOrman for (Owner of (Triggering unit))
  • ButtonClicked
    • Events
      • Dialog - A dialog button is clicked for DiyalogOrman
    • Conditions
    • Actions
      • -------- Did you want to hide the dialog? --------
      • Dialog - Hide DiyalogOrman for (Triggering player)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DiyalogBoku[0]
        • Then - Actions
          • Set VariableSet DestekSecti[(Player number of (Triggering player))] = True
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DiyalogBoku[1]
        • Then - Actions
          • Set VariableSet DestekSecti[(Player number of (Triggering player))] = False
        • Else - Actions
  • I didn't know anything about DiyalogOrman2 so I left it out of the example.
  • I added a Set Variable action to the ItemUsed trigger that logs the unit for which the current window is made. It does not null the variable at the end and I figure you might as well not and you'll be able to consider YetenekSecimiUnit[playerNumber] to be the last unit (per player) to have used this dialog

I don't think GetLocalPlayer() is the way to go because dialogs can already only be shown/hidden per player, edit *I just realized that there is no native for show/hide dialog for all players, only individually.
You also don't need to do it per player, both for the above reason and because when the button's are clicked, you can just get the triggering player and you'll be able to distinguish who clicked the button, and like you mention @Uncle, messing with GetLocalPlayer() without a strong understanding might desync. Heck, I even like to think I understand GetLocalPlayer() and desync more often than I know why... not that I am by any means an expert
 
Last edited:
Status
Not open for further replies.
Top