End Cam (POC)

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

End Cam (POC)

Post by Hey Doomer »

I'm a Quake fan (who isn't, right?) and I've seen a few posts here that attempt to script an end camera intermission screen similar to Quake. It seems to me what's needed is at least one security camera attached to a ChangeCamera linedef special (#237). All that's needed to intercept this is to change a 243 (Exit_Normal) to 237, and the rest can be done with ZScript. I haven't done that yet, but an initial POC is attached for my new mod called End Cam.

Code: Select all

class Cam_Point : SecurityCamera
{
	Default
	{
		CameraHeight 60;
	}
}

class End_Level : ProgLevelEnder
{
	Default
	{
		+Inventory.Autoactivate;
	}
}

// endcam event handler
class endcam_EventHandler : EventHandler
{
	PlayerInfo player;
	Actor cam;
	int playertid;
	int camtid;
	int counter;

	override void WorldTick()
	{
// if the return = cameratid we are at the end

		int tid = ACS_NamedExecuteWithResult("getcameratid", 0);
		if (tid == camtid)
		{
			if (counter-- == 0)
			{
				player.mo.GiveInventory("End_Level", 1);
			}
		}
	}

	override void WorldLoaded(WorldEvent e)
	{
		for(int i = 0; i < Level.Sectors.Size(); i++)
		{
			for (int ii = 0; ii < Level.Sectors[i].Lines.Size(); ii++)
			{
				int special = Level.Sectors[i].Lines[ii].Special;
				if (special == 243)
				{
					Level.Sectors[i].Lines[ii].Special = 237;
					Level.Sectors[i].Lines[ii].Args[0] = camtid;
					Level.Sectors[i].Lines[ii].Args[1] = 1;
					Level.Sectors[i].Lines[ii].Args[2] = 1;
				}
			}
		}
	}
	override void WorldUnloaded(WorldEvent e)
	{
	}
	override void PlayerSpawned(PlayerEvent e)
	{
		player = players[e.PlayerNumber];
		counter = 35 * 5;
		
		cam = Actor.Spawn("Cam_Point", player.mo.pos);
		cam.args[1] = 180;
		cam.args[2] = 200;

		camtid = ACS_NamedExecuteWithResult("gettid");
		cam.ChangeTid(camtid);

		int i =  ACS_NamedExecuteWithResult("gettid");
		playertid = ACS_NamedExecuteWithResult("gettid");
		player.mo.ChangeTid(playertid);
	}
}
How this works is simple. A camera is spawned at the player location (although these can and should be spawned at several places e.g. large outdoor sectors, areas with a lot of monsters, etc.) and given a unique tid. I haven't started working out the camera placement algorithm, so for now it's the player start position. In WorldLoaded a 243 line special is changed to a 237 with appropriate arguments. 244 (Exit_Secret) can also be done, of course. When the player comes to an exit and activates the line, the view switches to the spawned, at which point anything can be done.

Currently this is programmed to return to the player when the player moves, but that doesn't have to happen. The player will have to be morphed somewhere until the next level starts, of course, to avoid getting killed.
Similar solutions exist, I'm sure, but this should be universal for all other cases.

WIP.

Update
Spoiler:
Last edited by Hey Doomer on Mon Dec 27, 2021 6:50 am, edited 1 time in total.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: End Cam (Quake-Style Intermission Camera)

Post by Hey Doomer »

FYI beta posted in Gameplay. I have this at a point where it works pretty well.

viewtopic.php?f=43&t=74264
User avatar
BROS_ETT_311
Posts: 219
Joined: Fri Nov 03, 2017 6:05 pm

Re: End Cam (POC)

Post by BROS_ETT_311 »

Very nice! Now...Universal ResE style camera when??

Return to “Script Library”