Deathcam
Posted: Sat Nov 06, 2021 3:04 am
My take on viewtopic.php?f=3&t=29235&p=555792&hili ... am#p555792. It shows a flash of a viewpoint from whatever killed the player before switching back. I'm not sure how satisfying this is.
It assigns a tid to all monsters as needed. When the player is killed it executes an ACS ChangeCamera to the viewpoint of the killer, waits a bit, and switches back. This works but breaks immersion (then again, this ain't Skyrim). I chose an arbitrary camera height of 50.
ACS:
ZScript:
I haven't tested this extensively, so I'm not sure what happens with flying critters, and the height of 50 will give an interesting perspective from a Cyberdemon that may or may not make sense depending. It is interesting how little code can do so much. Nice engine!
It assigns a tid to all monsters as needed. When the player is killed it executes an ACS ChangeCamera to the viewpoint of the killer, waits a bit, and switches back. This works but breaks immersion (then again, this ain't Skyrim). I chose an arbitrary camera height of 50.
ACS:
Code: Select all
#library "deathcam"
#include "zcommon.acs"
script "deathcam" (int tid)
{
ChangeCamera(tid, 0, 0);
Delay(35 * 6);
ChangeCamera(0, 0, 0);
}
Code: Select all
class deathcam_EventHandler : EventHandler
{
int tidCounter;
override
void WorldThingSpawned(WorldEvent e)
{
// give the monster a unique tid
if (tidCounter == 0)
{
tidCounter = 22000;
}
if (e.thing && e.thing.bIsMonster && !e.thing.tid)
{
e.thing.ChangeTid(tidCounter);
tidCounter++;
}
}
override
void WorldThingDied(WorldEvent e)
{
if (e.thing && e.thing is "PlayerPawn" && e.inflictor && e.thing.target.tid)
{
e.thing.target.CameraHeight = 50;
e.thing.ACS_NamedExecute("deathcam", 0, e.thing.target.tid, 0, 0);
}
}
}