Created
June 13, 2019 04:37
-
-
Save caligari87/a735f182dff4973a03b9943e78b25dcc to your computer and use it in GitHub Desktop.
Simple death fader for GZDoom. Put both files into a .pk3 or .wad.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GameInfo { | |
AddEventHandlers = "DeathFadeBootstrap" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version "4.1" | |
class DeathFadeBootstrap : EventHandler { | |
override void PlayerDied(PlayerEvent e) { | |
PlayerInfo player = players[e.PlayerNumber]; | |
player.mo.GiveInventory("DeathFader", 1); | |
} | |
override void PlayerRespawned(PlayerEvent e) { | |
PlayerInfo player = players[e.PlayerNumber]; | |
player.mo.TakeInventory("DeathFader", 1); | |
} | |
} | |
class DeathFader : Inventory { | |
int counttoblack; | |
override void AttachToOwner(actor User) { | |
super.AttachToOwner(user); | |
counttoblack = (owner.health + random(5, 20)) * 35; | |
counttoblack = max(counttoblack, 10); | |
owner.A_SetBlend("black", 0.0, counttoblack, "black", 1.0); | |
} | |
override void DoEffect() { | |
if (counttoblack <= 2 && owner.health <= 0) { | |
owner.A_SetBlend("black", 1.0, 5, "black", 1.0); | |
} | |
counttoblack--; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment