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

Dialog Problem

Status
Not open for further replies.
Level 37
Joined
Aug 14, 2006
Messages
7,601
Hey.

I'm trying to make a dialog system that shows hints for the player at the beginning of game. However, the system doesn't work correctly and it bugs like hell. So could you please look at the system and make it work?

The idea is that there are 9 pages with these buttons:

1) Next Page => Goes to next page to see more hints
2) Previous Page => Goes to previous page to see more hints
3) Hint 1 => Shows hint 1
4) Hint 2 => Shows hint 2
5) Hint 3 => Shows hint 3
6) Hint 4 => Shows hint 4
7) Hint 5 => Shows hint 5
8) Hint 6 => Shows hint 6
9) Cancel => Leaves this dialog(in test map victory)

Rep + credits will be given to the one who helps me a little bit. Test map is attached to this post.
 

Attachments

  • HINTS.w3x
    20.5 KB · Views: 38
Level 37
Joined
Mar 6, 2006
Messages
9,240
And here it is. Press ESC to bring up the dialog. I detect the clicked button with a hastable value, no need to loop through 1-9.

The displayed hint is read from an array, I use the clicked dialog button index and clicked dialog index, and combine them into an index, then load the string from the array using that index. The actual hint display trigger becomes super simple. And this way you only need four triggers for the whole system, where initialization trigger is one of them. The triggers are all very simple.



  • INIT
    • Events
      • Time - Elapsed game time is 0.00 seconds
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Dialog_Hash = (Last created hashtable)
      • Set Dialog_Page = 1
      • Set Dialog_Pages = 2
      • -------- ------------------------------ --------
      • For each (Integer A) from 1 to 9, do (Actions)
        • Loop - Actions
          • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(udg_Dialogs[bj_forLoopAIndex]) , StringHash("index") , bj_forLoopAIndex )
          • Trigger - Add to CLICK NEXT <gen> the event (Dialog - A dialog button is clicked for Dialogs[(Integer A)])
          • Dialog - Change the title of Dialogs[(Integer A)] to (Page + (String((Integer A))))
      • -------- ------------------------------ --------
      • Set i1 = 1
      • Set i2 = 1
      • -------- ------------------------------ --------
      • Dialog - Create a dialog button for Dialogs[i1] labelled Next Page
      • Set Dialog_Buttons_1[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Previous Page
      • Set Dialog_Buttons_2[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Eat
      • Set Dialog_Buttons_3[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Shit
      • Set Dialog_Buttons_4[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Fuck
      • Set Dialog_Buttons_5[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Die
      • Set Dialog_Buttons_6[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Sleep
      • Set Dialog_Buttons_7[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled ???
      • Set Dialog_Buttons_8[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Exit
      • Set Dialog_Buttons_9[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • -------- ------------------------------ --------
      • Set i1 = (i1 + 1)
      • Set i2 = 1
      • -------- ------------------------------ --------
      • Dialog - Create a dialog button for Dialogs[i1] labelled Next Page
      • Set Dialog_Buttons_1[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Previous Page
      • Set Dialog_Buttons_2[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled One
      • Set Dialog_Buttons_3[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Two
      • Set Dialog_Buttons_4[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Three
      • Set Dialog_Buttons_5[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Four
      • Set Dialog_Buttons_6[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Five
      • Set Dialog_Buttons_7[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Six
      • Set Dialog_Buttons_8[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • Dialog - Create a dialog button for Dialogs[i1] labelled Exit
      • Set Dialog_Buttons_9[i2] = (Last created dialog Button)
      • Custom script: call SaveInteger( udg_Dialog_Hash , GetHandleId(bj_lastCreatedButton) , StringHash("index") , udg_i2 )
      • Set i2 = (i2 + 1)
      • -------- ------------------------------ --------
      • -------- Page 1 hint texts --------
      • -------- ------------------------------ --------
      • Set Dialog_Hints[13] = You must eat
      • Set Dialog_Hints[14] = You must shit
      • Set Dialog_Hints[15] = You must fuck
      • Set Dialog_Hints[16] = You must die
      • Set Dialog_Hints[17] = You must sleep
      • Set Dialog_Hints[18] = You must ???
      • -------- ------------------------------ --------
      • -------- Page 2 hint texts --------
      • -------- ------------------------------ --------
      • Set Dialog_Hints[23] = 1
      • Set Dialog_Hints[24] = 2
      • Set Dialog_Hints[25] = 3
      • Set Dialog_Hints[26] = 4
      • Set Dialog_Hints[27] = 5
      • Set Dialog_Hints[28] = 6



  • SHOW
    • Events
      • Player - Player 1 (Red) skips a cinematic sequence
    • Conditions
    • Actions
      • Dialog - Change the title of Dialogs[Dialog_Page] to (Page + (String(Dialog_Page)))
      • Dialog - Show Dialogs[Dialog_Page] for Player 1 (Red)



  • CLICK NEXT
    • Events
    • Conditions
    • Actions
      • Custom script: set udg_i1 = LoadInteger( udg_Dialog_Hash , GetHandleId(GetClickedDialog()) , StringHash("index") )
      • Custom script: set udg_i2 = LoadInteger( udg_Dialog_Hash , GetHandleId(GetClickedButton()) , StringHash("index") )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • i2 Equal to 9
        • Then - Actions
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • i2 Equal to 1
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • i1 Equal to Dialog_Pages
                • Then - Actions
                  • Set Dialog_Page = 1
                  • Dialog - Change the title of Dialogs[Dialog_Page] to (Page + (String(Dialog_Page)))
                  • Dialog - Show Dialogs[1] for Player 1 (Red)
                • Else - Actions
                  • Set Dialog_Page = (i1 + 1)
                  • Dialog - Change the title of Dialogs[Dialog_Page] to (Page + (String(Dialog_Page)))
                  • Dialog - Show Dialogs[Dialog_Page] for Player 1 (Red)
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • i2 Equal to 2
                • Then - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • i1 Equal to 1
                    • Then - Actions
                      • Set Dialog_Page = Dialog_Pages
                      • Dialog - Change the title of Dialogs[Dialog_Page] to (Page + (String(Dialog_Page)))
                      • Dialog - Show Dialogs[Dialog_Page] for Player 1 (Red)
                    • Else - Actions
                      • Set Dialog_Page = (i1 - 1)
                      • Dialog - Change the title of Dialogs[Dialog_Page] to (Page + (String(Dialog_Page)))
                      • Dialog - Show Dialogs[Dialog_Page] for Player 1 (Red)
                • Else - Actions
                  • Set Dialog_Hint = Dialog_Hints[(Integer(((String(i1)) + (String(i2)))))]
                  • Trigger - Run Hints READ <gen> (checking conditions)



  • Hints READ
    • Events
    • Conditions
    • Actions
      • Cinematic - Turn cinematic mode On for (All players)
      • -------- ---------------------------------------------- --------
      • Cinematic - Send transmission to (All players) from No unit named Skipping Cinematics: Play No sound and display Dialog_Hint. Modify duration: Set to 2.00 seconds and Wait
      • -------- ---------------------------------------------- --------
      • Cinematic - Turn cinematic mode Off for (All players)
      • Trigger - Run SHOW <gen> (checking conditions)



 

Attachments

  • HINTS.w3x
    20.1 KB · Views: 59
Level 37
Joined
Aug 14, 2006
Messages
7,601
Seems to a great system. However, if there's more text than "Cinematic - Send transmission" allows to have, doesn't this system bug then?

Like:

"You will later in the campaign have all three characters under your control. Once you do, you will have to decide what role each character plays. Who will be the one absorbing damage? Who will be the main damage dealer? Who will be the healer and who will be the esper user?

There are unlimited amount of different strategies. Some people only uses just one or two characters. Is that a good strategy? Try it!"
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
There seems to be a quite low character limit for what you can store into a string variable. It's somewhere between 256 and 300.

You will later in the campaign have all three characters under your control. Once you do, you will have to decide what role each character plays. Who will be the one absorbing damage? Who will be the main damage dealer? Who will be the healer and who will be the

That's about as much as can fit in there. I'll think of some system that knows to check another array slot for the string, and then concatenate them. I'll propably use a check character for the last char. Shouldn't be difficult.
 
Level 37
Joined
Aug 14, 2006
Messages
7,601
Well that was just an example I don't know if it fits or not. But usually I have 1 to 4 "Cinematic transmissions". I also like to separate text. For example if I have a long text I more likely like to use two "Cinematic transmissions" than one. That way it's easier to read text. Also I usually try to not use long string variables because they sometimes crash the whole world editor.

But I'm okay doing your way, the most important thing is that it works.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
New improved system. You can now use upto three array slots for your hint string. The system then shows upto three consecutive cinematic transmissions if the hint is long enough.

I also adjust the duration of the cinematic transmission based on the string legth. So shorter messages are displayed for shorter time.

All messages have 2 seconds base duration, plus 0.01 seconds per character. You can freely adjust the values.

Test the messages on page 2.
 

Attachments

  • HINTS.w3x
    22 KB · Views: 38
Status
Not open for further replies.
Top