Mui problem

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Why are these triggers not functioning properly? Works fine with 1 player but gets buggy with more players.

Thank you very much in advance.

  • Event Installization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet PlayerNumber = (Player number of (Triggering player))
      • For each (Integer DialogLoop) from 1 to 4, do (Actions)
        • Loop - Actions
          • Custom script: set udg_Dialog[udg_DialogLoop] = DialogCreate()
          • Trigger - Add to Level Buttons <gen> the event (Dialog - A dialog button is clicked for Dialog[DialogLoop])
  • Level Dialog
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Attribute Points
    • Actions
      • Set VariableSet Hero[PlayerNumber] = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AttributePoints[PlayerNumber] Not equal to 0
        • Then - Actions
          • Set VariableSet State[PlayerNumber] = 0
          • Dialog - Clear Dialog[PlayerNumber]
          • Dialog - Change the title of Dialog[PlayerNumber] to Choose your attribu...
          • Dialog - Create a dialog button for Dialog[PlayerNumber] labelled |cffff0000Strength ...
          • Set VariableSet Dialog_Str[PlayerNumber] = (Last created dialog Button)
          • Dialog - Create a dialog button for Dialog[PlayerNumber] labelled |cff00ff00Agility |...
          • Set VariableSet Dialog_Agi[PlayerNumber] = (Last created dialog Button)
          • Dialog - Create a dialog button for Dialog[PlayerNumber] labelled |cff8080ffIntellige...
          • Set VariableSet Dialog_Int[PlayerNumber] = (Last created dialog Button)
          • Dialog - Show Dialog[PlayerNumber] for (Owner of Hero[PlayerNumber])
          • Set VariableSet AttributePoints[PlayerNumber] = (AttributePoints[PlayerNumber] - 1)
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) for 5.00 seconds the text: You do not have eno...
  • Level Buttons
    • Events
    • Conditions
    • Actions
      • -------- Strength --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Str[PlayerNumber]
        • Then - Actions
          • Hero - Modify Strength of Hero[PlayerNumber]: Add 1.
        • Else - Actions
      • -------- Agility --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Agi[PlayerNumber]
        • Then - Actions
          • Hero - Modify Agility of Hero[PlayerNumber]: Add 1.
        • Else - Actions
      • -------- Intelligence --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to Dialog_Int[PlayerNumber]
        • Then - Actions
          • Hero - Modify Intelligence of Hero[PlayerNumber]: Add 1.
        • Else - Actions
      • -------- New Dialog --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • State[PlayerNumber] Equal to 0
        • Then - Actions
          • Dialog - Clear Dialog[PlayerNumber]
          • Dialog - Change the title of Dialog[PlayerNumber] to Choose your attribu...
          • Dialog - Create a dialog button for Dialog[PlayerNumber] labelled |cffff0000Strength ...
          • Set VariableSet Dialog_Str[PlayerNumber] = (Last created dialog Button)
          • Dialog - Create a dialog button for Dialog[PlayerNumber] labelled |cff00ff00Agility |...
          • Set VariableSet Dialog_Agi[PlayerNumber] = (Last created dialog Button)
          • Dialog - Create a dialog button for Dialog[PlayerNumber] labelled |cff8080ffIntellige...
          • Set VariableSet Dialog_Int[PlayerNumber] = (Last created dialog Button)
          • Dialog - Show Dialog[PlayerNumber] for (Owner of Hero[PlayerNumber])
          • Set VariableSet State[PlayerNumber] = 1
        • Else - Actions
          • Set VariableSet State[PlayerNumber] = 0
 
Level 7
Joined
Feb 23, 2020
Messages
253
Not sure if this is the only problem but you're never setting PlayerNumber in the Level Dialog trigger.
  • Set VariableSet PlayerNumber = (Player number of (Triggering player))
this line doesnt make sense with an initialization event, because there is no player or unit that fires the trigger

Oh yeah you're right guys. So how am i supposed to fix this?
 
Level 7
Joined
Feb 23, 2020
Messages
253
Cut "Set VariableSet PlayerNumber = (Player number of (Triggering player))" from the Initialization trigger and paste it at the top of the Actions in the Level Dialog trigger.
Tried that, it doesnt work that way because then the "add event Dialog[PlayerNumber]" wont work properly. The whole issue with this, is that it's not MUI i guess, but cant seem to figure it out how to fix it.
 

Uncle

Warcraft Moderator
Level 69
Joined
Aug 10, 2018
Messages
7,166
Do what I said but also add this to the top of Level Buttons. This will get the PlayerNumber of the player that clicked the dialog button.
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Clicked dialog button) Equal to Dialog_Str[(Integer A)]
              • (Clicked dialog button) Equal to Dialog_Int[(Integer A)]
              • (Clicked dialog button) Equal to Dialog_Agi[(Integer A)]
        • Then - Actions
          • Set VariableSet PlayerNumber = (Integer A)
        • Else - Actions
I often see people recommend against using Integer A so here's the same thing but using an Integer variable:
  • Actions
    • For each (Integer Dialog_Loop) from 1 to 4, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Or - Any (Conditions) are true
              • Conditions
                • (Clicked dialog button) Equal to Dialog_Str[Dialog_Loop]
                • (Clicked dialog button) Equal to Dialog_Int[Dialog_Loop]
                • (Clicked dialog button) Equal to Dialog_Agi[Dialog_Loop]
          • Then - Actions
            • Set VariableSet PlayerNumber = Dialog_Loop
          • Else - Actions
 
Level 7
Joined
Feb 23, 2020
Messages
253
Do what I said but also add this to the top of Level Buttons. This will get the PlayerNumber of the player that clicked the dialog button.
  • For each (Integer A) from 1 to 4, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Clicked dialog button) Equal to Dialog_Str[(Integer A)]
              • (Clicked dialog button) Equal to Dialog_Int[(Integer A)]
              • (Clicked dialog button) Equal to Dialog_Agi[(Integer A)]
        • Then - Actions
          • Set VariableSet PlayerNumber = (Integer A)
        • Else - Actions
I often see people recommend against using Integer A so here's the same thing but using an Integer variable:
  • Actions
    • For each (Integer Dialog_Loop) from 1 to 4, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Or - Any (Conditions) are true
              • Conditions
                • (Clicked dialog button) Equal to Dialog_Str[Dialog_Loop]
                • (Clicked dialog button) Equal to Dialog_Int[Dialog_Loop]
                • (Clicked dialog button) Equal to Dialog_Agi[Dialog_Loop]
          • Then - Actions
            • Set VariableSet PlayerNumber = Dialog_Loop
          • Else - Actions
Wow. You're a damn god at this. Thank you very much! :)
 
Status
Not open for further replies.
Top