From ZDoom Wiki
Jump to navigation Jump to search

237:ChangeCamera (tid, who, revert)

  • tid: Thing ID of the camera to use (0 for normal player's view)
  • who: Set to 1 if the view change should affect all players
  • revert: Set to 1 if movement should cancel the special


Causes a player's view to move to a camera. If tid is 0, then the player's view is restored to a spot inside his head. If who is 0, only the player who activated the special has his view changed, otherwise, everyone's view changes.

If revert is 1, then if a player moves, his view will be returned to his body automatically. This behavior makes this special more suitable for such things as security cameras.

What can be viewed

Or just about any other object in the game. The results will vary, though.


There are different uses for cameras. Other than security cameras, they can be used very effectively for short cutscenes in games. See the second example of Thing_Hate.

To make a set of security cameras, a script like this can be used:

int cam = 0;
script 5 (int min, int max)
	if (cam < min || cam >= max)
		cam = min;
	ChangeCamera(cam, FALSE, TRUE);

This will implement a set of different views which can be switched through. They will exit once the player moves. The script has two parameters, the minimum TID and the maximum TID of the sequence of cameras. It scrolls through all the TID's in between. This script can be used on many places in a map, with many different sequences of cameras. It can only be used for one player maps. An updated script which can store screen numbers for multiplayer would look like this:

int cam[8]; // Maximum number of players
script 5 (int min, int max)
	if (cam[PlayerNumber()] < min || cam[PlayerNumber()]>= max)
		cam[PlayerNumber()] = min;
	ChangeCamera(cam[PlayerNumber()], FALSE, TRUE);

This assumes a maximum number of 8 players, but is trivial to extend.