• 🏆 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!

Help with dialoge triggers!

Status
Not open for further replies.
Level 11
Joined
Nov 1, 2008
Messages
828
Hey,
I've started my first dialoge mode setting. Dialoges are easy but i'm trying to make it so when you click Dialoge[1] it changes the dialoge button to this, example. Game Income [Low] (once clicked) Game Income [Medium] Game Income [High] etc etc. This is what i have so far, atm it is not working.



  • Diolog Option Modes trigger
    • Events
      • Dialog - A dialog button is clicked for OptionalModes
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButton[1]
        • Then - Actions
          • Dialog - Show OptionalModes for Player 2 (Blue)
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Income Greater than 3
            • Then - Actions
              • Set Income = 1
            • Else - Actions
              • Do nothing
          • Wait 0.10 seconds
          • Set Income = (Income + 1)
          • If (Income Equal to 1) then do (Dialog - Create a dialog button for OptionalModes labelled Income [Low]) else do (Do nothing)
          • Set DialogButton[1] = (Last created dialog Button)
          • If (Income Equal to 2) then do (Dialog - Create a dialog button for OptionalModes labelled Income [Normal]) else do (Do nothing)
          • Set DialogButton[1] = (Last created dialog Button)
          • If (Income Equal to 3) then do (Dialog - Create a dialog button for OptionalModes labelled Income [High]) else do (Do nothing)
          • Set DialogButton[1] = (Last created dialog Button)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to DialogButton[2]
            • Then - Actions
              • Dialog - Show OptionalModes for Player 2 (Blue)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • GladiatorMode Greater than 2
                • Then - Actions
                  • Set GladiatorMode = 1
                • Else - Actions
                  • Do nothing
              • Wait 0.10 seconds
              • Set GladiatorMode = (GladiatorMode + 1)
              • If (GladiatorMode Equal to 1) then do (Dialog - Create a dialog button for OptionalModes labelled Gladiator [On]) else do (Do nothing)
              • Set DialogButton[2] = (Last created dialog Button)
              • If (GladiatorMode Equal to 2) then do (Dialog - Create a dialog button for OptionalModes labelled Gladiator [Off]) else do (Do nothing)
              • Set DialogButton[2] = (Last created dialog Button)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Clicked dialog button) Equal to DialogButton[10]
                • Then - Actions
                  • Dialog - Show OptionalModes for Player 2 (Blue)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Speed Greater than 3
                    • Then - Actions
                      • Set Speed = 1
                    • Else - Actions
                      • Do nothing
                  • Wait 0.10 seconds
                  • Set Speed = (Speed + 1)
                  • If (Speed Equal to 1) then do (Dialog - Create a dialog button for OptionalModes labelled Game Speed [Low]) else do (Do nothing)
                  • Set DialogButton[3] = (Last created dialog Button)
                  • If (Speed Equal to 2) then do (Dialog - Create a dialog button for OptionalModes labelled Game Speed [Normal]) else do (Do nothing)
                  • Set DialogButton[3] = (Last created dialog Button)
                  • If (Speed Equal to 3) then do (Dialog - Create a dialog button for OptionalModes labelled Game Speed [High]) else do (Do nothing)
                  • Set DialogButton[3] = (Last created dialog Button)
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Clicked dialog button) Equal to DialogButton[11]
                    • Then - Actions
                      • Trigger - Turn off Untitled Trigger 012 <gen>
                      • Dialog - Hide OptionalModes for Player 2 (Blue)
                      • Trigger - Run Citromatic Copy 2 <gen> (ignoring conditions)
                    • Else - Actions
Any help?
Thanks in advanced.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Remove the "Do nothing"s.
Waits also ruin such a system...
You create buttons AFTER showing the dialog.
And you only add buttons, you never remove any.


I'd do something like this:

Init
Events
Time - Elapsed game time is 0.10 seconds
Conditions
Actions
-------- Base Values --------
Set ButtonSuffix[0] = [Low]
Set ButtonSuffix[1] = [On]
Set ButtonSuffix[2] = [Low]
-------- Other Options --------
Set ButtonSuffix[3] = [Low]
Set ButtonSuffix[4] = [Normal]
Set ButtonSuffix[5] = [High]
Set ButtonSuffix[6] = [On]
Set ButtonSuffix[7] = [Off]
-------- Setup and show Dialog --------
Trigger - Run Setup Dialog <gen> (ignoring conditions)
[/trigger]

That's easy: it sets up the suffixes and runs the next trigger, which is...

  • Setup Dialog
    • Events
    • Conditions
    • Actions
      • Dialog - Clear OptionalModes
      • Dialog - Create a dialog button for OptionalModes labelled (Income + ButtonSuffix[0])
      • Set DialogButton[0] = (Last created dialog Button)
      • Dialog - Create a dialog button for OptionalModes labelled (Gladiator Mode + ButtonSuffix[1])
      • Set DialogButton[1] = (Last created dialog Button)
      • Dialog - Create a dialog button for OptionalModes labelled (Speed + ButtonSuffix[2])
      • Set DialogButton[2] = (Last created dialog Button)
      • Dialog - Create a dialog button for OptionalModes labelled Start Game
      • Set DialogButton[3] = (Last created dialog Button)
      • -------- Show Dialog --------
      • Dialog - Show OptionalModes for Player 1 (Red)
No event, because we will only call this trigger when needed.
It's best if this remains a separate trigger.
Clearing the dialog first is important!

The actual button clicking will happen here:
  • Click Button
    • Events
      • Dialog - A dialog button is clicked for OptionalModes
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Clicked dialog button) Equal to DialogButton[0]
        • Then - Actions
          • Set ButtonSuffixC[0] = (ButtonSuffixC[0] + 1)
          • -------- Check to restart the value from start --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ButtonSuffixC[0] Greater than or equal to 3
            • Then - Actions
              • Set ButtonSuffixC[0] = 0
            • Else - Actions
          • -------- Set the correct suffix --------
          • Set ButtonSuffix[0] = ButtonSuffix[(3 + ButtonSuffixC[0])]
          • -------- Setup and show the dialog --------
          • Trigger - Run Setup Dialog <gen> (ignoring conditions)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Clicked dialog button) Equal to DialogButton[1]
            • Then - Actions
              • Set ButtonSuffixC[1] = (ButtonSuffixC[1] + 1)
              • -------- Check to restart the value from start --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ButtonSuffixC[1] Greater than or equal to 2
                • Then - Actions
                  • Set ButtonSuffixC[1] = 0
                • Else - Actions
              • -------- Set the correct suffix --------
              • Set ButtonSuffix[1] = ButtonSuffix[(6 + ButtonSuffixC[1])]
              • -------- Setup and show the dialog --------
              • Trigger - Run Setup Dialog <gen> (ignoring conditions)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Clicked dialog button) Equal to DialogButton[2]
                • Then - Actions
                  • Set ButtonSuffixC[2] = (ButtonSuffixC[2] + 1)
                  • -------- Check to restart the value from start --------
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ButtonSuffixC[2] Greater than or equal to 3
                    • Then - Actions
                      • Set ButtonSuffixC[2] = 0
                    • Else - Actions
                  • -------- Set the correct suffix --------
                  • Set ButtonSuffix[2] = ButtonSuffix[(3 + ButtonSuffixC[2])]
                  • -------- Setup and show the dialog --------
                  • Trigger - Run Setup Dialog <gen> (ignoring conditions)
                • Else - Actions
You only need to look at one of these ITE's, as they're basically all the same:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Clicked dialog button) Equal to DialogButton[0]
    • Then - Actions
      • Set ButtonSuffixC[0] = (ButtonSuffixC[0] + 1)
      • -------- Check to restart the value from start --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ButtonSuffixC[0] Greater than or equal to 3
        • Then - Actions
          • Set ButtonSuffixC[0] = 0
        • Else - Actions
      • -------- Set the correct suffix --------
      • Set ButtonSuffix[0] = ButtonSuffix[(3 + ButtonSuffixC[0])]
      • -------- Setup and show the dialog --------
      • Trigger - Run Setup Dialog <gen> (ignoring conditions)
    • Else - Actions
Arrays start at 0, we make use of that like this (I know it's actually not good to use arrays like this, you should use separate variables unless you loop them, but whatever).

It increases the correct button count by 1, then checks if it reached is maximum value yet, if it did: set it to 0 (basically what you did, but all values -1).

Then it sets the suffix to "3 + count" (check the first trigger I posted). This will return the correct suffix.
Once we set the suffix, we can run our setup-trigger again to show the updated dialog.
 
Status
Not open for further replies.
Top