Deathcam

Post your example zscripts/ACS scripts/etc here.

Deathcam

Postby Hey Doomer » Sat Nov 06, 2021 3:04 am

My take on https://forum.zdoom.org/viewtopic.php?f=3&t=29235&p=555792&hilit=killcam#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:

Code: Select allExpand view
    #library "deathcam"
    #include "zcommon.acs"

    script "deathcam" (int tid)
    {
        ChangeCamera(tid, 0, 0);
        Delay(35 * 6);
        ChangeCamera(0, 0, 0);
    }


ZScript:

Code: Select allExpand view
    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);
          }
       }
    }


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!
You do not have the required permissions to view the files attached to this post.
Hey Doomer
 
Joined: 25 Sep 2021
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support

Re: Deathcam

Postby Enjay » Sat Nov 06, 2021 7:16 am

That's pretty neat. Personally, I tend to use the built-in death camera so, for me, it would perhaps be better if there was a delay so that I could see my death from the GZDoom deathcam, then it switch to the perspective of my killer (then back again). Definitely a fun effect though.
User avatar
Enjay
Everyone is a moon, and has a dark side which he never shows to anybody. Twain
 
 
 
Joined: 15 Jul 2003
Location: Scotland

Re: Deathcam

Postby Hey Doomer » Sat Nov 06, 2021 12:04 pm

Good suggestion!
Hey Doomer
 
Joined: 25 Sep 2021
Operating System: Windows 11
OS Test Version: No (Using Stable Public Version)
Graphics Processor: ATI/AMD with Vulkan Support


Return to Script Library

Who is online

Users browsing this forum: No registered users and 0 guests