The Gray Death

Post your example zscripts/ACS scripts/etc here.
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

The Gray Death

Post 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 all

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 all

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 all

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:
Last edited by Hey Doomer on Mon Dec 20, 2021 6:11 pm, edited 2 times in total.
User avatar
Enjay
 
 
Posts: 26494
Joined: Tue Jul 15, 2003 4:58 pm
Location: Scotland

Re: The Gray Death

Post 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 all

script "HeyDoomerGrayDeath" DEATH
{Blah...}
User avatar
Ac!d
Posts: 343
Joined: Tue Apr 02, 2019 5:13 am
Location: France

Re: The Gray Death

Post by Ac!d »

It is possible to remove the "Gray Death" when you resurrect ?

Code: Select all

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);
    }
}
Hey Doomer
Posts: 283
Joined: Sat Sep 25, 2021 3:38 am

Re: The Gray Death

Post 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 all

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.
User avatar
Ac!d
Posts: 343
Joined: Tue Apr 02, 2019 5:13 am
Location: France

Re: The Gray Death

Post by Ac!d »

Ac!d wrote:It is possible to remove the "Gray Death" when you resurrect ?
Problem solved.

Code: Select all

    Override Void PlayerRespawned(PlayerEvent e)
    {
        PlayerInfo player = players[e.PlayerNumber];
        player.mo.TakeInventory("PowerLightAmp",1);
    } 

Return to “Script Library”