• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Problem with camera

You need to override
Code:
//In KFPlayerController
function SetBossCamera(KFInterface_MonsterBoss Boss)
Thus, you need to create a class that extends KFPlayerController and make the game use that by setting
Code:
PlayerControllerClass=class'CustomPlayerController'
This can be done in your custom GameInfo's defaultproperties, or you can do
Code:
MyKFGI.PlayerControllerClass=class'CustomPlayerController';
in a function in your Mutator class that is called sufficiently early, such as InitMutator.

In your CustomPlayerController class (rename it whatever you want), you need
Code:
function SetBossCamera(KFInterface_MonsterBoss Boss)
{
    //Don't allow the camera to be fixed to the boss.
    //This prevents the camera lock 'bug' when a boss is killed.
}
That's all you need to do. There are some more details below if you're interested.

Note that we don't actually do anything in that function. In fact, it's what we're not doing that is important. In KFPlayerController, we have
Code:
function SetBossCamera( KFInterface_MonsterBoss Boss )
{
    // If our view target has been obliterated, the camera will default to view the player controller.
    // So, put the player controller where the view target was.
    if( Boss != none && Boss.GetMonsterPawn().HitFxInfo.bObliterated )
    {
        SetLocation( Boss.GetMonsterPawn().Location );
    }

    SetViewTarget( Boss.GetMonsterPawn() );

    if( Role == ROLE_Authority && !IsLocalPlayerController() )
    {
        PlayerCamera.CameraStyle = 'Boss';
    }
    else
    {
        ClientSetCameraMode( 'Boss' );
    }
}
By preventing this code from executing, we prevent the camera being locked to a boss when it is killed.

Notes on compatibility: many large mods use their own custom player controller. Thus, by setting your own player controller class, your mod will no longer be compatible with some of the popular mods. There is a way around this, but it requires more classes to be overridden. In KFPawn_Monster, we have
Code:
simulated function PlayDying(class<DamageType> DamageType, vector HitLoc)
{
    //...

    //Shared functionality for boss death
    if (IsABoss())
    {
        KFPC = KFPlayerController(GetALocalPlayerController());
        if(KFPC != none)
        {
            KFPC.SetBossCamera( self );
        }

        //...
    }

    //...
}
There are several different ways of preventing the call to SetBossCamera, but all of the approaches I can think of would require overriding all (three) boss classes. You can tell the game to use your custom boss classes using
Code:
//In your custom GameInfo class
DefaultProperties
{
    AIBossClassList(BAT_Hans)=class'CustomHans'
    AIBossClassList(BAT_Patriarch)=class'CustomPatriarch'
    AIBossClassList(BAT_KingFleshpound)=class'CustomFleshpoundKing'
}
Or you could use a mutator such as ZedManager (which can be found on the workshop) to swap out zed/boss classes as they spawn.

Hopefully TWI will make this 'feature' easier to override, seeing as there are several mods that spawn bosses in the middle of waves.
 
  • Like
Reactions: Delta69er
Upvote 0