Resilient enemies

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.

Resilient enemies

Postby Korni27 » Wed Jun 02, 2021 8:54 am

Is there a way to make the enemy invincible or more resistant to specific attacks, like hitscan?
basically what i mean can you make an enemy take less damage or no damage to hitscan?
User avatar
Korni27
 
Joined: 31 Jan 2021
Location: Poland

Re: Resilient enemies

Postby Jarewill » Wed Jun 02, 2021 9:37 am

Make your hitscan attack fire a puff with a custom damage type.
Then use the DamageFactor property to make your monster more resistant or immune:
Code: Select allExpand view
ACTOR BulletPuff2 : BulletPuff replaces BulletPuff
{ //This puff has a special damage type
    DamageType "Ouch"
}
ACTOR DemonOuch : Demon replaces Demon
{ //That will deal no damage to this demon
    DamageFactor "Ouch", 0
}
Jarewill
 
 
 
Joined: 21 Jul 2019

Re: Resilient enemies

Postby Korni27 » Wed Jun 02, 2021 10:14 am

if I set DamageFactor "Ouch", 1 does it mean that the enemy will take 1 damage?
User avatar
Korni27
 
Joined: 31 Jan 2021
Location: Poland

Re: Resilient enemies

Postby wildweasel » Wed Jun 02, 2021 10:35 am

Korni27 wrote:if I set DamageFactor "Ouch", 1 does it mean that the enemy will take 1 damage?

DamageFactor is a multiplier. 1.0 is normal damage, 0 is no damage, 0.5 is half, etc etc.
User avatar
wildweasel
change o' pace.
Moderator Team Lead
 
Joined: 15 Jul 2003

Re: Resilient enemies

Postby Korni27 » Wed Jun 02, 2021 10:38 am

wildweasel wrote:
Korni27 wrote:if I set DamageFactor "Ouch", 1 does it mean that the enemy will take 1 damage?

DamageFactor is a multiplier. 1.0 is normal damage, 0 is no damage, 0.5 is half, etc etc.


What if I want to just decrease the damage of hitscan attacks?
User avatar
Korni27
 
Joined: 31 Jan 2021
Location: Poland

Re: Resilient enemies

Postby Jarewill » Wed Jun 02, 2021 1:33 pm

Korni27 wrote:What if I want to just decrease the damage of hitscan attacks?

Then you will have to use ZScript, as I don't think there's a way to do it purely in DECORATE.
Overriding DamageMobj can do that:
Code: Select allExpand view
Class ImpOuch : DoomImp replaces DoomImp
{
    Override int DamageMobj(Actor inflictor, Actor source, int damage, Name mod, int flags, double angle)
    {
        If(mod=="Ouch"){Return Super.DamageMobj(inflictor,source,1,mod,flags,angle);} //Deal only 1 damage when hit with an "Ouch" attack
        Else{Return Super.DamageMobj(inflictor,source,damage,mod,flags,angle);}
    }
}
Jarewill
 
 
 
Joined: 21 Jul 2019


Return to Scripting

Who is online

Users browsing this forum: TXTX and 0 guests