End Cam (POC)

Post your example zscripts/ACS scripts/etc here.

End Cam (POC)

Postby Hey Doomer » Sat Dec 25, 2021 8:28 am

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 allExpand view
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
 
Joined: 25 Sep 2021

Re: End Cam (Quake-Style Intermission Camera)

Postby Hey Doomer » Mon Dec 27, 2021 4:01 am

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

https://forum.zdoom.org/viewtopic.php?f=43&t=74264
Hey Doomer
 
Joined: 25 Sep 2021

Re: End Cam (POC)

Postby BROS_ETT_311 » Sat Jan 01, 2022 5:38 pm

Very nice! Now...Universal ResE style camera when??
User avatar
BROS_ETT_311
I've got somethin' and it goes thumpin' like this
 
Joined: 03 Nov 2017


Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests