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

[Solved] Deleting Dialog buttons one by one

Status
Not open for further replies.
Level 3
Joined
Jul 21, 2010
Messages
31
Hi, I am currently attempting to make a dialog with 4 buttons, as each button is pressed, it is removed from the dialog that reappears after the text.

While I could do it in a long way of clearing the dialog and recreating it, it is messy and easily leads to a loop where buttons are removed and re-added.

Is there a way of removing a button from the dialog (and the variable) without having to clear and recreate the dialog?


Currently it is set out as this, which creates the dialog and some other additional things - however, it seems that from this point there isn't a way of removing the buttons:
  • Interacting
    • Events
      • Unit - Marhand 0000 <gen> Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Interact
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Targeted unit) Equal to Kevin 0039 <gen>
        • Then - Actions
          • Unit - Make Kevin 0039 <gen> face Marhand 0000 <gen> over 0.00 seconds
          • Camera - Apply KevinTalk <gen> for Player 1 (Red) over 0.00 seconds
          • Cinematic - Disable user control for (All players)
          • Floating Text - Create floating text that reads Huh? Whada you want? above Kevin 0039 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Dialog - Clear myDialog[1]
          • Dialog - Change the title of myDialog[1] to Talk to Kevin:
          • Dialog - Create a dialog button for myDialog[1] labelled How are you?
          • Set myButton[1] = (Last created dialog Button)
          • Dialog - Create a dialog button for myDialog[1] labelled Where are the Train...
          • Set myButton[2] = (Last created dialog Button)
          • Dialog - Create a dialog button for myDialog[1] labelled Why do you work for...
          • Set myButton[3] = (Last created dialog Button)
          • Dialog - Create a dialog button for myDialog[1] labelled Leave
          • Set myButton[4] = (Last created dialog Button)
          • Dialog - Show myDialog[1] for Player 1 (Red)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Targeted unit) Equal to Gex (Male 2) 0040 <gen>
            • Then - Actions
              • Dialog - Clear myDialog[1]
              • Dialog - Change the title of myDialog[1] to Talk to Gex:
              • Dialog - Create a dialog button for myDialog[1] labelled How are you?
              • Set myButton[5] = (Last created dialog Button)
              • Dialog - Create a dialog button for myDialog[1] labelled Who is my first opp...
              • Set myButton[6] = (Last created dialog Button)
              • Dialog - Create a dialog button for myDialog[1] labelled What is my reward?
              • Set myButton[7] = (Last created dialog Button)
              • Dialog - Create a dialog button for myDialog[1] labelled Leave
              • Set myButton[4] = (Last created dialog Button)
              • Dialog - Show myDialog[1] for Player 1 (Red)
            • Else - Actions
              • Do nothing
 
Last edited:
Level 8
Joined
May 21, 2019
Messages
435
I don't know of a way to do this without recreating the dialog. However, you could easily modify your current dialog creation trigger to detect which buttons have been used before, by making a boolean array matching your button array, and then checking this boolean array every time you recreate the a dialog button, you can effectively boil this whole system down to 2 triggers, one for the dialog creation, and one for button clicks. You can also refactor the whole dialog system a lot better, if you store the current dialog in a variable, and then set the strings in your if statement instead of pasting the entire dialog creation code every time.
 
Level 3
Joined
Jul 21, 2010
Messages
31
Yes, it was actually that and was sorted in another thread. Using boolean to check whether a button has been clicked.

Thanks for the info tho.
 
Status
Not open for further replies.
Top