• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Fade In/Out for Dialogs

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2007
Messages
195
I noticed that there is a function for fading Dialog Items but I couldn't find one for fading the entire Dialog, so I made one.

It could be done using a proper indexing system but this works too. Things the user must remember with this are:

- Trying to fade the same dialog a second time before the first fade has completed will do nothing. In other words, if you Fade In a dialog, you must wait atleast for the time it takes to fade in before you attempt to Fade Out, otherwise nothing will happen. Also as timing is quite inaccurate you should give it a bit of extra time to finish fading.

- Unless you increase the FadeIndexMax, you can only have total of 100 dialogs Fading In or Out.

Link to Pastebin

EDIT: Sorry, I forgot that THW won't allow the uploading of .SC2Map files. I archived it into a .rar, so it should work now.

  • Fade Dialog In/Out
    • Options: Action, Create Thread
    • Return Type: (None)
    • Parameters
      • FadeOption = In <In/Out Option>
      • Dialog = No Dialog <Dialog>
      • FadeRate = 1.0 <Real>
      • FadeInterval = 0.0 <Real>
      • FadeValue = 100.0 <Real>
      • FadeValueEnd = 0.0 <Real>
    • Grammar Text: Fade FadeOption Dialog, from FadeValue% to FadeValueEnd% transparency with the change of FadeRate% every FadeInterval seconds.
    • Hint Text: (None)
    • Custom Script Code
    • Local Variables
      • X = 0 <Integer>
      • CurrentIndex = FadeDialogIndex <Integer>
    • Actions
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • Dialog == No Dialog
        • Then
          • General - Skip remaining actions
        • Else
          • General - For each integer X from 0 to FadeDialogIndexMax with increment 1, do (Actions)
            • Actions
              • General - If (Conditions) then do (Actions) else do (Actions)
                • If
                  • Dialog == (("FadeDialogIn/Out_" + (String(X))) from the Global data table)
                • Then
                  • General - Skip remaining actions
                • Else
          • Data Table - Save Dialog as ("FadeDialogIn/Out_" + (String(FadeDialogIndex))) in the Global data table
          • General - If (Conditions) then do (Actions) else do (Actions)
            • If
              • FadeDialogIndex > FadeDialogIndexMax
            • Then
              • Variable - Set FadeDialogIndex = 0
            • Else
              • Variable - Set FadeDialogIndex = (FadeDialogIndex + 1)
      • General - If (Conditions) then do (Actions) else do (Actions)
        • If
          • FadeOption == In
        • Then
          • Variable - Set FadeRate = (FadeRate * -1.0)
        • Else
      • General - While (Conditions) are true, do (Actions)
        • Conditions
          • Or
            • Conditions
              • And
                • Conditions
                  • FadeValue < 100.0
                  • FadeOption == Out
              • And
                • Conditions
                  • FadeValue > 0.0
                  • FadeOption == In
        • Actions
          • Variable - Set FadeValue = (FadeValue + FadeRate)
          • Dialog - Set transparency of Dialog to FadeValue
          • General - Wait FadeInterval Game Time seconds
      • Data Table - Save c_invalidDialogId as ("FadeDialogIn/Out_" + (String(CurrentIndex))) in the Global data table
 
Last edited:
Status
Not open for further replies.
Top