Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
Is there anyway to create a dialogue that once a button within it is pressed, that button is removed and does not appear in the dialogue when it is shown again?
Thanks, so there isnt a way of doing it more accurately?
For example if I am building a dialogue box with 4 buttons. 3 for which trigger short dialogue and a 4th button which allows the user to leave.
If I do it in the way of re-adding buttons I can go into a loop where I would be re-adding the button over and over again.
Say I press button 1 - and remove it by adding back 2,3,4.
But if I were to press 2, how could I make the editor know that 1 has already been pressed and only 3,4 need to be added?
Because there could be a scenario where 2 is pressed first and so I would re-add 1,3,4 but then if I press 1 again, I would be re-adding 2,3,4
You just have to make for example a boolean variable: Button1Pressed, Button2Pressed.. etc. Then when you click a button, turn that boolean true. Then when you create the dialog, check for each button IF (Button1Pressed == false) THEN (Create button).
I have gotten this working although my solution might not be as pretty / fluent as it should be.
Variables (I didn't spend a lot of time thinking of a good name for them lol)
ButtonsInteger - This is an integer variable with array size 4 (or however many buttons you will have)
Buttons - This is a dialog button variable with array size 4 (or however many buttons you will have)
Dialog - This is a dialog variable, no array
Untitled Trigger 001
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Dialog - Create a dialog button for Dialog labelled 1
Set Buttons[1] = (Last created dialog Button)
Dialog - Create a dialog button for Dialog labelled 2
Set Buttons[2] = (Last created dialog Button)
Dialog - Create a dialog button for Dialog labelled 3
Set Buttons[3] = (Last created dialog Button)
Dialog - Create a dialog button for Dialog labelled 4
Set Buttons[4] = (Last created dialog Button)
Dialog - Show Dialog for Player 1 (Red)
Untitled Trigger 002
Events
Dialog - A dialog button is clicked for Dialog
Conditions
Actions
If ((Clicked dialog button) Equal to Buttons[1]) then do (Set ButtonsInteger[1] = 1) else do (Do nothing)
If ((Clicked dialog button) Equal to Buttons[2]) then do (Set ButtonsInteger[2] = 1) else do (Do nothing)
If ((Clicked dialog button) Equal to Buttons[3]) then do (Set ButtonsInteger[3] = 1) else do (Do nothing)
If ((Clicked dialog button) Equal to Buttons[4]) then do (Set ButtonsInteger[4] = 1) else do (Do nothing)
Dialog - Clear Dialog
If (ButtonsInteger[1] Equal to 0) then do (Dialog - Create a dialog button for Dialog labelled 1) else do (Do nothing)
Set Buttons[1] = (Last created dialog Button)
If (ButtonsInteger[2] Equal to 0) then do (Dialog - Create a dialog button for Dialog labelled 2) else do (Do nothing)
Set Buttons[2] = (Last created dialog Button)
If (ButtonsInteger[3] Equal to 0) then do (Dialog - Create a dialog button for Dialog labelled 3) else do (Do nothing)
Set Buttons[3] = (Last created dialog Button)
If (ButtonsInteger[4] Equal to 0) then do (Dialog - Create a dialog button for Dialog labelled 4) else do (Do nothing)
Set Buttons[4] = (Last created dialog Button)
If ((ButtonsInteger[1] Equal to 0) or ((ButtonsInteger[2] Equal to 0) or ((ButtonsInteger[3] Equal to 0) or (ButtonsInteger[4] Equal to 0)))) then do (Dialog - Show Dialog for Player 1 (Red)) else do (Do nothing)
I have gotten this working although my solution might not be as pretty / fluent as it should be.
Variables (I didn't spend a lot of time thinking of a good name for them lol)
ButtonsInteger - This is an integer variable with array size 4 (or however many buttons you will have)
Buttons - This is a dialog button variable with array size 4 (or however many buttons you will have)
Dialog - This is a dialog variable, no array
Untitled Trigger 001
Events
Time - Elapsed game time is 1.00 seconds
Conditions
Actions
Dialog - Create a dialog button for Dialog labelled 1
Set Buttons[1] = (Last created dialog Button)
Dialog - Create a dialog button for Dialog labelled 2
Set Buttons[2] = (Last created dialog Button)
Dialog - Create a dialog button for Dialog labelled 3
Set Buttons[3] = (Last created dialog Button)
Dialog - Create a dialog button for Dialog labelled 4
Set Buttons[4] = (Last created dialog Button)
Dialog - Show Dialog for Player 1 (Red)
Untitled Trigger 002
Events
Dialog - A dialog button is clicked for Dialog
Conditions
Actions
If ((Clicked dialog button) Equal to Buttons[1]) then do (Set ButtonsInteger[1] = 1) else do (Do nothing)
If ((Clicked dialog button) Equal to Buttons[2]) then do (Set ButtonsInteger[2] = 1) else do (Do nothing)
If ((Clicked dialog button) Equal to Buttons[3]) then do (Set ButtonsInteger[3] = 1) else do (Do nothing)
If ((Clicked dialog button) Equal to Buttons[4]) then do (Set ButtonsInteger[4] = 1) else do (Do nothing)
Dialog - Clear Dialog
If (ButtonsInteger[1] Equal to 0) then do (Dialog - Create a dialog button for Dialog labelled 1) else do (Do nothing)
Set Buttons[1] = (Last created dialog Button)
If (ButtonsInteger[2] Equal to 0) then do (Dialog - Create a dialog button for Dialog labelled 2) else do (Do nothing)
Set Buttons[2] = (Last created dialog Button)
If (ButtonsInteger[3] Equal to 0) then do (Dialog - Create a dialog button for Dialog labelled 3) else do (Do nothing)
Set Buttons[3] = (Last created dialog Button)
If (ButtonsInteger[4] Equal to 0) then do (Dialog - Create a dialog button for Dialog labelled 4) else do (Do nothing)
Set Buttons[4] = (Last created dialog Button)
If ((ButtonsInteger[1] Equal to 0) or ((ButtonsInteger[2] Equal to 0) or ((ButtonsInteger[3] Equal to 0) or (ButtonsInteger[4] Equal to 0)))) then do (Dialog - Show Dialog for Player 1 (Red)) else do (Do nothing)
Actually, you have to use If - Then - Else - multiple actions and then move the Set Buttons[X] = (Last created dialog button) inside the if-statement, because now it may assign the variable to wrong button.
For example, if button 2 is already pressed, so it won't create button 2 again, it will then assign Buttons[2] to button 1, because that's the last created dialog button.
Also, the single line if-statements are just bad, in my opinion. They don't bring anything good to the table, and yet they are harder to read and complicated to modify if you decide to change the code at some point.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.