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);
}
}
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.
- HUD messages and stats can be displayed (I assume)
- The level can actually end by activating or giving an inventory item (https://zdoom.org/wiki/Classes:ProgLevelEnder), for example.
WIP.
Update
Spoiler: