Creating new player classes

From ZDoom Wiki
Jump to: navigation, search

Choosing player classes in-game

Choosing a player class through the game's GUI can occur in two instances:

-When starting a new game (a class menu will popup inbetween choosing 'new game' and 'skill level')

-When changing the (Multi-)Player Setup in the Options menu


Defining player classes in your PWADs

First thing you have to do is to create new actor in DECORATE inheriting from PlayerPawn or any of its subclasses. It is recommended to inherit from the subclass the closest to what you want to do, for example a replacement of the Doom marine should inherit from the Doom player.

actor MyPlayer : DoomPlayer
{
  ...
}

Contrarily to simple actor replacement, you cannot use the "replaces" keyword here, because player pawns are not spawned like other actors. Instead, you must define access to this class in MAPINFO, with a GameInfo section:

GameInfo
{
   PlayerClasses = "MyPlayer"
}

If you have several classes, you can list them all, separated by commas. You can also keep the original classes as well. If there are at least two classes, the player will have a class selection screen when starting a new game.

GameInfo
{
   PlayerClasses = "MyPlayer", "DoomPlayer"
}

With older versions of ZDoom, the GameInfo method is not available. Instead, KEYCONF can be used: (deprecated)

// This command clears the player classes' list.
clearplayerclasses

// Add your player class to the list
addplayerclass MyPlayer

// Add standard Doom player to the list, but make it accessible only via player setup menu (i.e. hide from 'New Game' choice)
addplayerclass DoomPlayer nomenu