GameType

From ZDoom Wiki
Jump to navigation Jump to search

int GameType (void)

Usage

Returns the game type currently being played.

Return value

The game type currently being played. For readability there are definitions defined in zdefs.acs as follows:

  • GAME_SINGLE_PLAYER = 0
Solo play.
  • GAME_NET_COOPERATIVE = 1
Cooperative net game.
  • GAME_NET_DEATHMATCH = 2
Deathmatch net game.
  • GAME_TITLE_MAP = 3
Title map

Examples

With this command it is possible to do things such as give an explanation about the map to the player.

script 1 ENTER
{
    if (GameType() != GAME_NET_DEATHMATCH)
        Print (s:"This is a deathmatch only map!");
    else
        Print (s:"BobDM1\nBy Bob");
}

Another use could be to unlock extra areas in GAME_NET_COOPERATIVE mode like in the example below, where all doors with a sector tag of 666 are opened, the level music is changed, and a message is printed if playing in co-op.

Script "OpenCooperativeAreas" OPEN
{
	If (GameType() == GAME_NET_COOPERATIVE)
	{
		Door_Open (666,16,0);
		SetMusic ("COOPMUSIC");
		PrintBold (s:"New areas have been unlocked in CO-OP mode!");
	}
}