If you have not setup your Unrealscript environment yet, please go back and follow this tutorial first. |
Custom game modes can be used in many different ways. This includes for cinematic, play styles, or to simple override existing values. These values can be, and are not limited to, CheatManagers, PlayerController classes, trader archetypes and so on. Multiple custom game modes can be found on the Steam Workshop. In this case, we are going to make a simplistic game mode that sets all players to be the Berserker perk.
The GameInfo class in conjunction with the GameReplicationInfo class are what drive the game mode(s). The Survival mode and Versus Survival modes are both based on KFGameInfo.uc. In our case, we are going to base ours off KFGameInfo_Survival.uc.
We will come back to this class later.
class KFGameInfo_ExampleSurvival extends KFGameInfo_Survival; DefaultProperties { //defaults PlayerControllerClass=class'KFGame.KFPlayerController_Example' } |
A simple way to force all player perks to be Berserks is to simple remove the other choices and have the class validate the perk. We will be doing this in the PerkList that lives in the DefaultProperties of the KFPlayerController class.
class KFPlayerController_Example extends KFPlayerController; DefaultProperties { //defaults //PerkList.Add((PerkClass=class'KFPerk_Berserker')) PerkList.Remove((PerkClass=class'KFPerk_Commando') PerkList.Remove((PerkClass=class'KFPerk_Support') PerkList.Remove((PerkClass=class'KFPerk_FieldMedic')) PerkList.Remove((PerkClass=class'KFPerk_Demolitionist')) PerkList.Remove((PerkClass=class'KFPerk_Firebug')) PerkList.Remove((PerkClass=class'KFPerk_Gunslinger')) PerkList.Remove((PerkClass=class'KFPerk_Sharpshooter')) PerkList.Remove((PerkClass=class'KFPerk_Survivalist')) PerkList.Remove((PerkClass=class'KFPerk_SWAT')) } |
Figure 4.1