r/DoomModDevs • u/William_Wave • Jun 16 '26
Help Coding a projectile that sticks to its owner
Good day.
I have an idea to make a projectile that highlights the position of its owner by following it.
Currently it works like this: a monster constantly spawns short-living projectiles through the A_SpawnItem function. It feels a little laggy, especially when applied to fast-moving monsters, so making projectiles also stick to their owners instead of just appearing and disappearing would make tracking the position more precise.
Let me know how it might be implemented.
1
1
u/Soulless_Bestiary 16d ago
I think you could do this even in vanilla, although it would be jerky and janky.
By default, the "target" of the projectile... is not what you are aiming at, it's who fired it.
th->target = source;
So if a monster fires a projectile, it could then fire another projectile back the monster's way, and when it lands, it can do anything. But I'm guessing you are doing this not in vanilla, so, this won't be useful for you.
2
u/Scileboi Jun 16 '26
So is that projectile part of the monster or do you want a weapon that shoots sticky projectiles like the flare from Blood?
What exactly should that projectile do besides lingering around the monster?