Scrolling End Credits

Put this code in your custom player class (click here to download this fragment):

// ----------------------------------------------------------------------
// ShowCredits()
// This is stuff for setting up custom end credits
// ----------------------------------------------------------------------

function ShowCredits(optional bool bLoadIntro)
{
    local DeusExRootWindow root;
    local MyCreditsWindow winCredits;

    root = DeusExRootWindow(rootWindow);

    if (root != None)
    {
        // Show the credits screen and force the game not to pause
        // if we're showing the credits after the endgame
        winCredits = MyCreditsWindow(root.InvokeMenuScreen(Class'MyCreditsWindow', bLoadIntro));
        winCredits.SetLoadIntro(bLoadIntro);
    }
}

 

Put this code in a file called MyCreditsWindow.uc:

//=============================================================================
// MyCreditsWindow
//=============================================================================
class MyCreditsWindow extends CreditsWindow;

var string textPackage;

// ----------------------------------------------------------------------
// ProcessText()
// ----------------------------------------------------------------------

function ProcessText()
{
    local DeusExTextParser parser;

    PrintPicture(CreditsBannerTextures, 2, 1, 505, 75);
    PrintLn();

    // First check to see if we have a name
    if (textName != '')
    {
        // Create the text parser
        parser = new(None) Class'DeusExTextParser';

        // Attempt to find the text object
        if (parser.OpenText(textName,textPackage))
        {
            while(parser.ProcessText())
                ProcessTextTag(parser);

            parser.CloseText();
        }

    CriticalDelete(parser);
    }

    ProcessFinished();
}


defaultproperties
{
    CreditsBannerTextures(0)=Texture'DeusExUI.UserInterface.CreditsBanner_1'
    CreditsBannerTextures(1)=Texture'DeusExUI.UserInterface.CreditsBanner_2'
    TeamPhotoTextures(0)=Texture'DeusExUI.UserInterface.TeamFront_1'
    TeamPhotoTextures(1)=Texture'DeusExUI.UserInterface.TeamFront_2'
    TeamPhotoTextures(2)=Texture'DeusExUI.UserInterface.TeamFront_3'
    creditsEndSoundLength=4.000000
    maxRandomPhrases=5
    ScrollMusicString="Credits_Music.Credits_Music"

    textName=MyCredits
    textPackage=MyPackage
}
 

You can set the CreditsBannerTextures values to a 2-image custom logo, the TeamPhotoTextures to a 3-image picture, the ScrollMusicString to specific what music to play, and the textPackage to the name of the package you will be building the credits text into.

To set up the credits, use a text file called MyCredits.txt (or whatever you want to put as the textName value) and build it into your package.  Follow the same procedure that you would use to build text for your own DataCubes, e-mail, etc, as described in How to add a personal computer.

To use this, do the following in the final mission script for your levels at the point where you want the credits to roll, where MyCustomPlayer is the name of your player class:

local MyCustomPlayer MyPlayer;
MyPlayer = MyCustomPlayer(GetPlayerPawn());
MyPlayer.ShowCredits(True);


Back to main page