SetCamera

From ZDoom Wiki
Jump to navigation Jump to search

Action Void SetCamera (Actor cam, bool revert = false)

Usage

Sets the players' camera to the actor specified on the cam parameter. Does nothing if not called from a player.

Parameters

  • Cam - An actor pointer to the actor to set the calling players' view to.
  • Revert - False by default, when set to true. The player will be able to revert back to their original view by moving. This is the same as in the ChangeCamera ACS function.

Examples

This special pistol has an altfire that changes the players' camera to that of their attacker, if any. But the player can get out of their attackers' view by simply moving.

Class AttackerCamPistol : Pistol
{
	States
	{
		AltFire:
			PISG A 4
			{
				//Ensure the pistol has an owner, and that owner is a player.
				If (Invoker.Owner && Invoker.Owner.Player)
				{
					Invoker.Owner.SetCamera (Invoker.Owner.Player.Attacker,True); //Sets the camera of the player to their attacker, if any. With the ability to revert back to their view by moving.
				}
			}
			Goto Ready;
	}
}