Universal ZScript Enemy Damage Flash [Hacky]

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.
Post Reply
User avatar
Smedis2
Posts: 16
Joined: Fri Jul 01, 2016 6:45 pm
Contact:

Universal ZScript Enemy Damage Flash [Hacky]

Post by Smedis2 »

I've always wanted the ability to have state-independent damage flashing in G/ZDoom. I've done several attempts at it, first originally a really, really garbage one using DECORATE and ACS, and now this much nicer (but jankily coded, not super amazingly great with ZScript at the moment) version that works with everything (god bless event handlers!) Be forewarned, it doesn't play super nicely with renderstyles (spectres only seem to work if set to Software fuzz).

https://youtu.be/DhtVmF2qqeA Exciting gameplay footage!!

If anyone's willing to make this less ass, I'd appreciate it.

**EDIT: Just fixed a bug involving it not working when enemies gain health**
Attachments
damageflash.wad
(13.82 KiB) Downloaded 581 times
Last edited by Smedis2 on Tue Jun 23, 2020 3:49 pm, edited 4 times in total.
User avatar
Carrotear
Posts: 165
Joined: Thu Sep 03, 2015 10:45 pm
Preferred Pronouns: No Preference
Graphics Processor: Intel (Modern GZDoom)

Re: Universal ZScript Enemy Damage Flash [Hacky]

Post by Carrotear »

Doesn't seem to work with damage numbers, war trophies and nashmove when it's loaded first. When it's loaded last with those mods, the enemies disappear after getting hit.
User avatar
Smedis2
Posts: 16
Joined: Fri Jul 01, 2016 6:45 pm
Contact:

Re: Universal ZScript Enemy Damage Flash [Hacky]

Post by Smedis2 »

Carrotear wrote:Doesn't seem to work with damage numbers, war trophies and nashmove when it's loaded first. When it's loaded last with those mods, the enemies disappear after getting hit.
Strange. I'm able to replicate the apparent conflicts when loading it in a certain order, but the other mods seem to work fine on my end. https://youtu.be/_nrCfYQWF3I

Could someone else check and see if they have the same issue?
User avatar
Carrotear
Posts: 165
Joined: Thu Sep 03, 2015 10:45 pm
Preferred Pronouns: No Preference
Graphics Processor: Intel (Modern GZDoom)

Re: Universal ZScript Enemy Damage Flash [Hacky]

Post by Carrotear »

I just did more testing. having universal entropy behind damage flash causes enemies to disappear. I'll do more testing.
User avatar
Carrotear
Posts: 165
Joined: Thu Sep 03, 2015 10:45 pm
Preferred Pronouns: No Preference
Graphics Processor: Intel (Modern GZDoom)

Re: Universal ZScript Enemy Damage Flash [Hacky]

Post by Carrotear »

Ok so far, when I have damage flash in front of the load order it disables most mods. I found a way around that and just put it behind everything and it's fine. Universal Entropy mainly to my knowledge doesn't work right in front of damage flash or behind it. Aside from bugs, this is great to run with the Omega Zero mod and Rampancy.

Edit: Nope it wasnt Entropy. It was the champions mod. I'm bad at identifying things.

2nd Edit: Other things I'm noticing is that in legendoom lite, the legendary glow effect is uhh...suppressed if that makes any sense. Lost Souls in general go invisble after a few hits.
User avatar
Smedis2
Posts: 16
Joined: Fri Jul 01, 2016 6:45 pm
Contact:

Re: Universal ZScript Enemy Damage Flash [Hacky]

Post by Smedis2 »

Wow! I just realized that the reason the conflicts were happening was probably because I made it "EventHandler" and not "AddEventHandler! Truly a moment of Smart Brain(tm). Fixed now.
User avatar
Smedis2
Posts: 16
Joined: Fri Jul 01, 2016 6:45 pm
Contact:

Re: Universal ZScript Enemy Damage Flash [Hacky]

Post by Smedis2 »

Finally fixed the Stinkiest(tm) bug by changing 3 letters. I realized I was passing the Alpha storage variable to an Int and not a Float. And it only took me a whole month to realize this!
User avatar
Bodhisattva
Posts: 54
Joined: Wed Mar 02, 2016 10:28 am
Graphics Processor: ATI/AMD (Modern GZDoom)

Re: Universal ZScript Enemy Damage Flash [Hacky]

Post by Bodhisattva »

There is a bug that can happen in some wads like Community Chest and Going Down, when the player starts flashing indefinitely after taking damage, making all the weapons completely white for the rest of the level. I've fixed it by adding a !enemy.bFriendly check, so the script doesn't target the player:

Code: Select all

  class FlashHandler: EventHandler
  {
     override void WorldThingSpawned(WorldEvent e)
     {
      let enemy = e.Thing;
      if(enemy.bShootable && !enemy.bFriendly)
       {
        enemy.GiveInventory("FlashItem",1);
       }
     }
  }
This is most likely not the perfect way to do it, but it works fine for me, so I figured I'd tell you.
Post Reply

Return to “Script Library”