[No] Add floors that can also damage monsters

Moderator: GZDoom Developers

Add floors that can also damage monsters

Postby inkoalawetrust » Mon Nov 04, 2019 1:53 am

While it's possible to make floors hurt monsters too with one or a few simple ACS scripts that use SectorDamage i (And i'm sure a lot of other people) would prefer if the ability for damaging floors to also harm monsters was implemented in the engine natively since it's a pretty obvious thing to add to GZDoom/LZDoom.
inkoalawetrust
 
Joined: 26 Aug 2019
Discord: inkoalawetrust #9783
Operating System: Windows Vista/7 32-bit
Graphics Processor: Intel (Legacy GZDoom)

Re: Add floors that can also damage monsters

Postby Graf Zahl » Mon Nov 04, 2019 2:24 am

This was never implemented because it won't work without altering the monster AI. The ACS special at least requires the mapper to think about the scenario but with a sector special it'd be far too easy to use and end up in broken maps.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Add floors that can also damage monsters

Postby Kinsie » Mon Nov 04, 2019 7:52 am

This isn't a generic map feature, but my most recent mod has monsters that take floor damage. Here's the code I used, in a base actor that the monsters inherit from:

Code: Select allExpand view
int sectordmgtimer;

   override void Tick()
   {
      // These have all been broken into seperate functions so that individual
      // actors can disable or override them for whatever reason.
      
      // ...
      DoHurtFloorDamage();
      
      // ...
      
      Super.Tick();
   }

   virtual void DoHurtFloorDamage()
   {
      // If on a hurtfloor... get hurt by it.
      if (sectordmgtimer < self.CurSector.damageinterval)
      {
         sectordmgtimer++;
      } else {
         sectordmgtimer = 0;
      }
      
      // Handle things a little differently depending on whether the actor is
      // in water or not. If they're not, only damage them if they're actually
      // on the floor. If they are, assume they're swimming in toxic waste or
      // nukage or some shit and ding them at any time.
      if (self.CurSector.damageamount != 0 && sectordmgtimer >= self.CurSector.damageinterval)
      {
         if (waterlevel == 0 && pos.z == GetZAt(pos.x, pos.y))
         {
            sectordmgtimer = 0;
            DamageMobj(self, self, self.CurSector.damageamount, self.CurSector.damagetype, 0, 0);
         }
         
         if (waterlevel > 0)
         {
            sectordmgtimer = 0;
            DamageMobj(self, self, self.CurSector.damageamount, self.CurSector.damagetype, 0, 0);
         }
      }
   }


It isn't perfect - I still need to handle swimmable 3D floors - but as far as starts go it's pretty decent. I'm sure someone way cleverer than I am could universalise it.
User avatar
Kinsie
A Concept Utterly Obsolete
 
Joined: 22 Oct 2004
Location: MAP33
Discord: Find Me...
Twitch ID: thekinsie


Return to Closed Feature Suggestions

Who is online

Users browsing this forum: No registered users and 1 guest