Weapon slots

From ZDoom Wiki
Jump to: navigation, search

Weapon slots determine which weapons can be selected, what order they can be selected in and which numeric slot each weapon resides in. There are ten slots, numbered 0 through 9. By default, each slot corresponds to a number key on the keyboard and may contain any number of weapons.

Defining weapon slots

There are several different ways to define which slot a weapon should occupy:

In the weapon actor

Weapon slots can also be defined in the DECORATE definition for the weapon actor. The Weapon.SlotNumber property sets the default slot for a weapon. This allows modders to add new weapons without completely redoing the player's arsenal. This method is to be favored when creating "weapon resource" mods as they are the easiest to merge in a project.

In a custom player class

You can define weapon slots in a custom player class (an actor extending PlayerPawn) by using the Player.WeaponSlot property. Weapon slots set in this way will always be overridden by any slots set in KEYCONF, regardless of the order in which the wads are loaded. If you want your mod's weapons to work with older mods with slots set up in KEYCONF, don't use this method.

In a MAPINFO lump

Weapon slots can be defined in the gameinfo section of the MAPINFO lump. Here is an example of the syntax:

 gameinfo
 {
   weaponslot = 1, "Fist", "Chainsaw"
   weaponslot = 2, "Pistol"
   // add other slots here...
 }

In a KEYCONF lump

This is the original way to set weapon slots, but is now deprecated and should not be used in new projects. Slots defined in the KEYCONF lump will override any slots set in a custom player class and in GAMEINFO. For more information see adding weaponsections.

In the INI file

Weapon slots can be defined on a PlayerClass-basis in the zdoom-user.ini file under a [<Class>.Weapons] section. A slot declaration is of the form Slot[<number>]=<WeaponName> and unlisted slots are left at their default. The setslot console command without any parameter prints what can be copied and pasted into the ini so as to keep the current configuration. An example of this syntax follows:

[DoomPlayer.Weapons]
Slot[1]=Fist
Slot[3]=Shotgun
Slot[8]=SuperShotgun
Slot[9]=Chainsaw

This example gives a unique slot number to each standard Doom weapon, moving the SSG out of slot 3 and into slot 8, and the chainsaw out of slot 1 and into slot 9.