GameType (ZScript)

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


static Int GameType(); (deprecated)

GameInfo.GameType

The current, non-deprecated method for checking the game type is checking the value of GameInfo.GameType, which is a static field. GameType() is simply a wrapper that returns said variable.

Usage

Stores a value corresponding to the current game.

Values

Below are the values GameInfo.GameType returns for each game or combination of games.

  • GAME_Any: Returned if the game type is anything else besides the other Doom engine games.
  • GAME_Doom: Returned if the current game is any of the Doom games.
  • GAME_Heretic: Returned if the current game is Heretic.
  • GAME_Hexen: Returned if the current game is Hexen.
  • GAME_Strife: Returned if the current game is Strife.
  • GAME_Chex: Returned if the current game is any of the Chex Quest games.
  • GAME_Raven: Returned if the current game is either Heretic or Hexen.
  • GAME_DoomChex: Returned if the current game is any of the Chex Quest or Doom games.
  • GAME_DoomChexStrife: Ditto, but is also returned if the game is Strife.

Examples

This actor will spawn a different basic enemy in front of itself depending on the Doom engine game it is spawned in. Then be destroyed.

Class GameSpecificEnemy : Actor
{
	Override Void PostBeginPlay()
	{
		Super.PostBeginPlay();
		
		If (GameInfo.GameType & GAME_Any)
			A_Log ("I don't know what game this is, so I can't spawn anything.");
		Else If (GameInfo.GameType & GAME_Doom)
			A_SpawnItemEx ("DoomImp",128);
		Else If (GameInfo.GameType & GAME_Heretic)
			A_SpawnItemEx ("Mummy",128);
		Else If (GameInfo.GameType & GAME_Hexen)
			A_SpawnItemEx ("Ettin",128);
		Else If (GameInfo.GameType & GAME_Strife)
			A_SpawnItemEx ("Acolyte",128);
		Else If (GameInfo.GameType & GAME_Chex)
			A_SpawnItemEx ("ArmoredFlemoidusBipedicus",128);
		Else
			A_Log ("I don't know what game this is, so I can't spawn anything.");
			
		Destroy();
	}
}