Announcement

Collapse
No announcement yet.

[Tutorial] Adding Music to a Scaleform Menu

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Tutorial] Adding Music to a Scaleform Menu

    For a while I've been digging through the code and searching the forum for an answer on how to fix the muted sound or music on a Scaleform menu system.

    Here's how I got it working.

    So let's begin.

    First add the following lines as global variables into your GFXFrontend class:
    Code:
    var const SoundCue BackgroundMusic;
    var transient AudioComponent AC_Background;
    Then in your Start or Init function, add these lines:
    Code:
    local PlayerController PC;
    
    PC = GetPC();
    
    if (PC != none && (MovieInfo != none))
        {
            if (BackgroundMusic != none)
            {
                AC_Background = PC.CreateAudioComponent(BackgroundMusic, false, true);
    
                if(AC_Background != none)
                {
                    AC_Background.bIsUISound = true;
                    AC_Background.Play();
                }
            }
        }
    Now anywhere within your GFXFrontend menu class; add this function or add the following code of the function to the existing function if you already have it.
    Code:
    event OnClose()
    {
        if(AC_Background != none)
        {
            AC_Background.FadeOut(1.00, 0.00);
            AC_Background = none;
        }
    }
    And finally... In the defaultproperties, add your soundcue:
    Code:
    BackgroundMusic=SoundCue'A_Music_GoDown.MusicMix.A_Music_GoDownMixCue'
    Recompile and the chosen soundcue will automatically play whilst the menu is open, and stop when you exit the menu.

    At the moment with the way I have currently setup my menu, for some reason the soundcue starts to play again for each menu page that is opened.

    #2
    Hmmm, interesting, does this happen (the muted music) if the game is paused?

    Comment


      #3
      I cannot say as I have not got that far yet with the code to create a pause menu.

      Comment

      Working...
      X