Page 1 of 1

The Gray Death

PostPosted: Fri Oct 22, 2021 2:55 am
by Hey Doomer
This is a minimal implementation of "fade to black." It's interesting how effective a small amount of code can be. This inventory item, which changes the screen to grayscale, is given at death:

Code: Select allExpand view
Actor GoGray : PowerUpGiver
{
   +Inventory.AlwaysPickup
   +Inventory.AutoActivate
   Inventory.MaxAmount 0

   Powerup.Duration 0x7FFFFFFF
   Powerup.Colormap 1.0, 1.0, 1.0
   Powerup.Type "LightAmp"

   States
   {
   }
}


Here's the ZScript event handler:

Code: Select allExpand view
class gd_EventHandler : EventHandler
{
  override
  void PlayerDied(PlayerEvent e) {
   PlayerInfo player = players[e.PlayerNumber];
   player.mo.GiveInventory("GoGray", 1);
  }
}


and finally here's the ACS that fades to black and tilts the player to one side.

Code: Select allExpand view
script 9999 DEATH
{
    FadeTo (0, 0, 0, 1.0, 5.0);
    ChangeActorRoll(0, 0.25, true);
}


This doesn't work with R667's DAMAGEFX mod. Hard to tell why without seeing that ACS source. (Is there any event debugging?)

Changelog
Spoiler:

Re: The Gray Death

PostPosted: Fri Oct 22, 2021 3:13 am
by Enjay
I can't check this right now but it's a neat little idea. You may be interested to know that GZDoom supports scripts with names. Using a named script means your code is far less likely to conflict with other mods.

Code: Select allExpand view
script "HeyDoomerGrayDeath" DEATH
{Blah...}

Re: The Gray Death

PostPosted: Wed Oct 27, 2021 7:00 am
by Ac!d
It is possible to remove the "Gray Death" when you resurrect ?

Code: Select allExpand view
Class gd_EventHandler : EventHandler
{
    Override Void PlayerSpawned(PlayerEvent e)
    {
        PlayerInfo player = players[e.PlayerNumber];
        player.mo.A_SetBlend("0 0 0",1.0,105);
    }
    Override Void PlayerDied(PlayerEvent e)
    {
        PlayerInfo player = players[e.PlayerNumber];
        player.mo.GiveInventory("GoGray ",1);
    }

    // This is my try, but it doesn't seems to work.
    Override Void PlayerRespawned(PlayerEvent e)
    {
        PlayerInfo player = players[e.PlayerNumber];
        player.mo.TakeInventory("GoGray ",1);
    }
}

Re: The Gray Death

PostPosted: Thu Oct 28, 2021 2:55 am
by Hey Doomer
Interesting. I tried different DECORATE flags on the inventory item to no avail.

Finally I added this to the ACS code, which seems to work:

Code: Select allExpand view
script "GrayRespawn" RESPAWN
{
    TakeInventory("PowerLightAmp", 1);
    FadeRange (0, 0, 0, 0.0, 0, 0, 0, 0.0, 0.0);
    ChangeActorRoll(0, 1.0, true);
}


I haven't extensively tested this with the resurrect cheat. I'm not sure what happens if the player also dies with another LightAmp powerup, for example.

Re: The Gray Death

PostPosted: Fri Oct 29, 2021 2:54 am
by Ac!d
Ac!d wrote:It is possible to remove the "Gray Death" when you resurrect ?


Problem solved.

Code: Select allExpand view
    Override Void PlayerRespawned(PlayerEvent e)
    {
        PlayerInfo player = players[e.PlayerNumber];
        player.mo.TakeInventory("PowerLightAmp",1);