1. Find your way through the deepest dungeon in the 18th Mini Mapping Contest Poll.
    Dismiss Notice
  2. A brave new world lies beyond the seven seas. Join the 34th Modeling Contest today!
    Dismiss Notice
  3. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
Hive 3 Remoosed BETA - NOW LIVE. Go check it out at BETA Hive Workshop! Post your feedback in this new forum BETA Feedback.
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

Mui problem

Discussion in 'World Editor Help Zone' started by Xzere, Jun 21, 2020.

  1. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    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
     
  2. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,472
    Resources:
    0
    Resources:
    0
    Not sure if this is the only problem but you're never setting PlayerNumber in the Level Dialog trigger.
     
  3. GIMLI_2

    GIMLI_2

    Joined:
    Mar 21, 2011
    Messages:
    1,543
    Resources:
    2
    Maps:
    2
    Resources:
    2
    • 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
     
  4. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    Oh yeah you're right guys. So how am i supposed to fix this?
     
  5. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,472
    Resources:
    0
    Resources:
    0
    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.
     
  6. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    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.
     
  7. Uncle

    Uncle

    Joined:
    Aug 10, 2018
    Messages:
    2,472
    Resources:
    0
    Resources:
    0
    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
     
  8. Xzere

    Xzere

    Joined:
    Feb 23, 2020
    Messages:
    152
    Resources:
    0
    Resources:
    0
    Wow. You're a damn god at this. Thank you very much! :)