Bullet Tracer Spawning

Moderator: GZDoom Developers

User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Bullet Tracer Spawning

Post by Major Cooke »

Pull Request

A_CustomBulletAttack(...,missile,Spawnheight,Spawnofs_xy)
A_FireBullets(...,missile,Spawnheight,Spawnofs_xy)
  • missile - The actor to spawn and aim at the bullet.
  • Spawnheight - Adjusts the z spawning position of missile.
  • Spawnofs_xy - Positive numbers spawn the projectile to the right of the actor, and vice versa.
What does it do?
Missile will be spawned at the calling actor and ALWAYS aimed at the puff. You do not need the puff to actually spawn for it to work, but there must be a valid actor used at the least.
Last edited by Major Cooke on Sat Jul 16, 2016 10:06 am, edited 4 times in total.
User avatar
Arctangent
Posts: 1235
Joined: Thu Nov 06, 2014 1:53 pm
Contact:

Re: Bullet Tracer Spawning

Post by Arctangent »

... So will the missile automatically die when it reaches the puff, or will it end up going through the actor the hitscan hit if the hitscan kills it?
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

The projectile is the modder's responsibility, much like any projectile any modder has ever made. So is any decorate actor for that matter. The only thing this does is basically call a combination of A_FireCustomMissile with A_FireBullets with the trajectory aligned, or A_CustomBulletAttack with A_CustomMissile in that scenario.

I did add some option to toggle setting the puff to target/master/tracer however.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Bullet Tracer Spawning

Post by Xaser »

I presume the main use for this is going to be for visual effects (i.e. a short-lived streak of light for rule-of-cool). Either way, I super-approve. :)
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Precisely that. Yes. I very much am going to be reliant on this and soon.
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: Bullet Tracer Spawning

Post by NeuralStunner »

It's actually much cooler than that: If your custom puffs are invisble/no-damage/etc., you could use this function to fire a shotgun-like spread of whatever projectile you choose, all in one go. So it'd be subject to correct single-shot autoaim behavior.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: Bullet Tracer Spawning

Post by Ed the Bat »

I don't suppose there's any interest in a variant of this using a railgun effect instead of projectiles? It would certainly help streamline having to work around A_RailAttack not honoring autoaim (as far as non-piercing rails go, that is)...
User avatar
wildweasel
Posts: 21706
Joined: Tue Jul 15, 2003 7:33 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): A lot of them
Graphics Processor: Not Listed
Contact:

Re: Bullet Tracer Spawning

Post by wildweasel »

This would help immensely with my (rather old) plans for the Cyberdemon in ww-doomnukem. I'd planned for him to use a hitscan "lasersight" to aim and fire a fast-moving, non-homing missile, but realized there was no way to ensure that he'd actually fire where the laser is at.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

NeuralStunner wrote:It's actually much cooler than that: If your custom puffs are invisble/no-damage/etc., you could use this function to fire a shotgun-like spread of whatever projectile you choose, all in one go. So it'd be subject to correct single-shot autoaim behavior.
Along with hard coding one's own distance limitations too by setting the puff as a target/master/tracer then using GetDistance, etc.
Ed the Bat wrote:I don't suppose there's any interest in a variant of this using a railgun effect instead of projectiles? It would certainly help streamline having to work around A_RailAttack not honoring autoaim (as far as non-piercing rails go, that is)...
Less 'disinterested' and more 'fucking things up being a possibility'. However, you CAN spawn a projectile that in turns spawn the particles you need. I can show you how. It's just a matter of when this gets in.
wildweasel wrote:This would help immensely with my (rather old) plans for the Cyberdemon in ww-doomnukem. I'd planned for him to use a hitscan "lasersight" to aim and fire a fast-moving, non-homing missile, but realized there was no way to ensure that he'd actually fire where the laser is at.
I could assist you with that while waiting on the submission's review. That's doable without this. Even though it is old, with today's abilities in ZDoom, it's rather easy now.
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: Bullet Tracer Spawning

Post by Ed the Bat »

Major Cooke wrote:However, you CAN spawn a projectile that in turns spawn the particles you need.
Ah, hadn't thought of that. It wouldn't be exactly the same effect, as it wouldn't be instantaneous at all points, but for what I'm doing, it may actually work better. I'll try it out.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Code: Select all

    Break:
        TNT1 A 1 
        {
            if (user_count > 15 || A_CheckSight("Null")) 
            {    return state("Null");    } // Destroy it.
            
            A_SetUserVarFloat(user_dist,0);
            return state(0); //Play out the tic.
        }
    Looping:
        TNT1 A 0
        {
            //A_SetUserVar(user_rng,random(1,8));
            A_SpawnParticle(FFE99E,SPF_FULLBRIGHT|SPF_RELATIVE,100,random(3,6),0,
                cos(-pitch)*user_dist,0,sin(-pitch)*user_dist,
                frandom(1.0,2.0),0,0,
                -0.005,0,0.005,
                frandom(0.5,1.0),frandom(0.06,0.12));
            
            A_SetUserVarFloat(user_dist,user_dist + frandom(2.0,4.0));
            
            if (user_dist >= TravelTic)
            {
                A_SetUserVar(user_count, user_count+1);
                A_Warp(DefPtr,cos(-pitch)*TravelTic,0,sin(-pitch)*TravelTic,0,WARPF_NOCHECKPOSITION);
                return state("Break");
            }
            return state("Looping");
        }
        Loop
Something like that aught to help but it's not the full code.
User avatar
Xaser
 
 
Posts: 10772
Joined: Sun Jul 20, 2003 12:15 pm
Contact:

Re: Bullet Tracer Spawning

Post by Xaser »

NeuralStunner wrote:It's actually much cooler than that: If your custom puffs are invisble/no-damage/etc., you could use this function to fire a shotgun-like spread of whatever projectile you choose, all in one go. So it'd be subject to correct single-shot autoaim behavior.
Holy Clockenballs, this actually solves a particular longstanding issue I have in Hacx 2.0. o_O
User avatar
Ed the Bat
Posts: 3060
Joined: Thu May 03, 2012 1:18 pm
Graphics Processor: nVidia with Vulkan support
Location: Maryland, US
Contact:

Re: Bullet Tracer Spawning

Post by Ed the Bat »

You weren't the only one to immediately think of the Cryogun when he said this. Eager to see the resolution finally come to life.
User avatar
Major Cooke
Posts: 8175
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Location: QZDoom Maintenance Team

Re: Bullet Tracer Spawning

Post by Major Cooke »

Xaser wrote:Holy Clockenballs
I can't help but think that's something you might put into lost soulsphere. :lol: (Good times!)
Xaser wrote:this actually solves a particular longstanding issue I have in Hacx 2.0. o_O
I haven't played Hacx 2.0 yet, so this makes me somewhat curious what it is.

Oh~? This also serves as a bugfix? Neat!

Also I get the feeling that Graf's going to be quite incredibly swamped until... I dunno. The weekend? if not later, so don't expect an immediate resolution.
User avatar
Hellser
Global Moderator
Posts: 2706
Joined: Sun Jun 25, 2006 4:43 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 11
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Location: Citadel Station

Re: Bullet Tracer Spawning

Post by Hellser »

I suppose this will be like HL2's tracer method (the game internally uses hitscans, but spawns a 'projectile' tracer to go where the hitscan landed). Will this work if the puff itself wasn't spawned? Say, hitting a bloody target?
Post Reply

Return to “Closed Feature Suggestions [GZDoom]”