Fastprojectiles w/ damage falloff

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
rollingcrow
Posts: 733
Joined: Tue Mar 02, 2010 8:30 pm
Graphics Processor: nVidia with Vulkan support

Fastprojectiles w/ damage falloff

Post by rollingcrow »

Is it possible for an fastprojectile's damage to reduce in games like Wolfenstein 3D or most modern games' hitscan weapons?
Gez
 
 
Posts: 17943
Joined: Fri Jul 06, 2007 3:22 pm

Re: Fastprojectiles w/ damage falloff

Post by Gez »

Hacky method: send several projectiles, without any spread. Make them of different types, all derived from each other through inheritance.

Use code this form:

Code: Select all

Actor BulletThatGoesABitFarther : BulletThatStopsAfterAWhile
{
    States
    {
    Spawn:
        BULL AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA 1
        Goto Super::Spawn
    }
}
The number of A in the spawn state determines how long it exists, and therefore, how long it travels. The first class should be the one that travels the least, then you can just copy/paste the exact same code, changing only the name of the bullet actor and its parent, to get even increments in this way.

Shoot all of these projectiles at once and without any sort of variance (you can use args[] or user variables if you do want random spread, compute it once and use the same values for each projectile) so that they'll overlap and just disappear when they run out of their range. There will be gradually less bullets, and therefore gradually less damage.
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Fastprojectiles w/ damage falloff

Post by NeuralStunner »

Alternate method:
  • Fire a single projectile.
  • Give it Damage (0).
  • Include an arg or user var that decreases each tic.
  • If the variable drops to zero, have the missile terminate itself.
  • On impact, pass the variable to A_Explode, give it a radius/fulldamageradius slighly larger than the projectile's size, and make it not hurt the shooter.
  • Make sure it has the [wiki=Actor_flags#FORCERADIUSDMG]FORCERADIUSDMG[/wiki] flag, so it can actually hurt explosive-immune bosses and such.
(Incidentally, this method also foils species projectile immunity, so it would more closely resemble a hitscan.)

A hitscan can also use the A_Explode method, but would need the [wiki=Actor_flags#PUFFGETSOWNER]PUFFGETSOWNER[/wiki] flag a large number of [wiki]A_JumpIfCloser[/wiki] calls to determine how far it is from the shooter.
User avatar
rollingcrow
Posts: 733
Joined: Tue Mar 02, 2010 8:30 pm
Graphics Processor: nVidia with Vulkan support

Re: Fastprojectiles w/ damage falloff

Post by rollingcrow »

I'll give these methods a try soon, thanks!
User avatar
rollingcrow
Posts: 733
Joined: Tue Mar 02, 2010 8:30 pm
Graphics Processor: nVidia with Vulkan support

Re: Fastprojectiles w/ damage falloff

Post by rollingcrow »

NeuralStunner wrote:Alternate method
I have two questions:
  • Is there a way to make the damage not fall below a minimum value?
  • I should have asked this earlier, but how do I use an Arg?
User avatar
NeuralStunner
 
 
Posts: 12328
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: No Preference
Operating System Version (Optional): Windows 11
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Fastprojectiles w/ damage falloff

Post by NeuralStunner »

Se7eNytes wrote:
  • Is there a way to make the damage not fall below a minimum value?
[wiki]A_JumpIf[/wiki]
Se7eNytes wrote:
  • I should have asked this earlier, but how do I use an Arg?
[wiki]A_SetArg[/wiki], Args[] [wiki=DECORATE_expressions]Decorate Expression[/wiki].
Locked

Return to “Editing (Archive)”