Fastprojectiles w/ damage falloff

Discuss all aspects of editing for ZDoom.
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.

Fastprojectiles w/ damage falloff

Postby Se7eNytes » Wed Nov 16, 2011 3:24 pm

Is it possible for an fastprojectile's damage to reduce in games like Wolfenstein 3D or most modern games' hitscan weapons?
User avatar
Se7eNytes
that's nice, wow
 
Joined: 02 Mar 2010
Location: Las Vegas, NV

Re: Fastprojectiles w/ damage falloff

Postby Gez » Wed Nov 16, 2011 3:34 pm

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 allExpand view
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.
Gez
 
Joined: 06 Jul 2007

Re: Fastprojectiles w/ damage falloff

Postby NeuralStunner » Wed Nov 16, 2011 3:55 pm

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 FORCERADIUSDMG 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 PUFFGETSOWNER flag a large number of A_JumpIfCloser calls to determine how far it is from the shooter.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies

Re: Fastprojectiles w/ damage falloff

Postby Se7eNytes » Wed Nov 16, 2011 4:10 pm

I'll give these methods a try soon, thanks!
User avatar
Se7eNytes
that's nice, wow
 
Joined: 02 Mar 2010
Location: Las Vegas, NV

Re: Fastprojectiles w/ damage falloff

Postby Se7eNytes » Sat Nov 19, 2011 12:11 am

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
Se7eNytes
that's nice, wow
 
Joined: 02 Mar 2010
Location: Las Vegas, NV

Re: Fastprojectiles w/ damage falloff

Postby NeuralStunner » Sat Nov 19, 2011 12:24 am

Se7eNytes wrote:
  • Is there a way to make the damage not fall below a minimum value?
A_JumpIf

Se7eNytes wrote:
  • I should have asked this earlier, but how do I use an Arg?
A_SetArg, Args[] Decorate Expression.
User avatar
NeuralStunner
O'Neill with it.
 
Joined: 21 Jul 2009
Location: The Colonies


Return to Editing

Who is online

Users browsing this forum: Hellstorm Archon and 1 guest