Can monster melee attacks poison the player?
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
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.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
-
- Posts: 72
- Joined: Wed Dec 15, 2021 8:38 pm
- Graphics Processor: nVidia (Modern GZDoom)
Can monster melee attacks poison the player?
I'm specifically looking for a way to use A_CustomComboAttack to poison a player, but only with melee. The projectile would not poison them. Since melee monster attacks don't use puffs, I'm not sure how to implement it.
-
-
- Posts: 1697
- Joined: Wed May 13, 2009 3:15 am
- Graphics Processor: nVidia with Vulkan support
Re: Can monster melee attacks poison the player?
If you can use ZScript, it is not that difficult a task to code a function that does exactly what you want:
In melee, this attack will play the meleeSound sound, do meleeDamage damage to the target, and also poison them according to the calling actor's poison damage properites. Otherwise, if the target is not in melee range, it will fire a projectile of type projType. If you want the melee attack to only do poison damage and not regular damage, simply remove the calls to DamageMobj and TraceBleed (you may then also remove the meleeDamage argument as it won't be needed for anything anymore).
Usage example:
Code: Select all
void A_CustomPoisonComboAttack(class<Actor> projType, int meleeDamage, sound meleeSound)
{
if (Target != null && CheckMeleeRange())
{
A_StartSound(meleeSound, CHAN_WEAPON);
int newdam = Target.DamageMobj(self, self, meleeDamage, 'Melee');
Target.TraceBleed(newdam > 0 ? newdam : damage, self);
Target.PoisonMobj(self, self, PoisonDamage, PoisonDuration, PoisonPeriod, PoisonDamageType);
}
else
{
A_SpawnProjectile(projType);
}
}
Usage example:
Code: Select all
class TestImp : DoomImp replaces DoomImp
{
Default
{
PoisonDamage 2;
}
States
{
Melee:
Missile:
TROO EF 8 A_FaceTarget;
TROO G 6 A_CustomPoisonComboAttack('DoomImpBall', random(1, 8) * 3, "imp/melee");
Goto See;
}
void A_CustomPoisonComboAttack(class<Actor> projType, int meleeDamage, sound meleeSound)
{
if (Target != null && CheckMeleeRange())
{
A_StartSound(MeleeSound, CHAN_WEAPON);
int newdam = Target.DamageMobj(self, self, meleeDamage, 'Melee');
Target.TraceBleed(newdam > 0 ? newdam : damage, self);
Target.PoisonMobj(self, self, PoisonDamage, PoisonDuration, PoisonPeriod, PoisonDamageType);
}
else
{
A_SpawnProjectile(projType);
}
}
}
-
- Posts: 72
- Joined: Wed Dec 15, 2021 8:38 pm
- Graphics Processor: nVidia (Modern GZDoom)
Re: Can monster melee attacks poison the player?
Fantastic, thank you!