Need help with custom melee ideas <solved>
Posted: Sun Nov 17, 2019 10:18 pm
I am having some trouble thinking of an approach to creating a custom melee attack for the player that allows for the weapon to hit multiple enemies in one strike, as well as having a wide sweeping arc to it's attack.
The most obvious approach is to use a projectile with RIPPER flag and that despawn after 1 tic. The issue with this is that they don't leave a lot of choices for the shape of the attack. As far as I can tell, we're limited to circle collision masks for projectiles, based on the radius and height properties. To counter that limitation, I could spawn multiple projectiles that form an arc. This could work but has one major flaw.
Multiple projectiles could cause an enemy to receive damage from 2 or more projectiles at once, which isn't the intended effect and would lead to inconsistent results.
The only other approach I can think of is a zscript function that replaces the standard player melee attack. However, I can't think of a solution there either because melee attacks require a target to deal damage and since this attack should be able to hit multiple enemies, potentially enemies you aren't directly facing, you can't rely on a single target variable to deal out the damage.
Perhaps there is an approach utilizing how projectiles deal damage to enemies that can be used to create a custom melee script, but I just don't know enough about zscript to know how possible that is. I've tried digging around in the attacks.zs file but there are few examples in there. RadiusDamage? Not sure how it works but maybe that's a possibility.
If anyone can offer some advice or ideas, I'd greatly appreciate it.
Edit: there are a handful of possible solutions found below.
The most obvious approach is to use a projectile with RIPPER flag and that despawn after 1 tic. The issue with this is that they don't leave a lot of choices for the shape of the attack. As far as I can tell, we're limited to circle collision masks for projectiles, based on the radius and height properties. To counter that limitation, I could spawn multiple projectiles that form an arc. This could work but has one major flaw.
Multiple projectiles could cause an enemy to receive damage from 2 or more projectiles at once, which isn't the intended effect and would lead to inconsistent results.
The only other approach I can think of is a zscript function that replaces the standard player melee attack. However, I can't think of a solution there either because melee attacks require a target to deal damage and since this attack should be able to hit multiple enemies, potentially enemies you aren't directly facing, you can't rely on a single target variable to deal out the damage.
Perhaps there is an approach utilizing how projectiles deal damage to enemies that can be used to create a custom melee script, but I just don't know enough about zscript to know how possible that is. I've tried digging around in the attacks.zs file but there are few examples in there. RadiusDamage? Not sure how it works but maybe that's a possibility.
If anyone can offer some advice or ideas, I'd greatly appreciate it.
Edit: there are a handful of possible solutions found below.