+Shootable Projectiles?

Wed Oct 27, 2021 3:32 pm

So I made an enemy that throws syringes at you, they do a high amount of damage. I came up with the concept of making the syringe projectiles shootable which would destroy them. If you've ever played those shooter arcade games where you have the physical gun and an enemy throws knives at you on screen for example, you can shoot them and it deflects them. Kind of the same idea. Problem is I don't know how I would execute this.

Projectile Actor
V V V
Spoiler:

Re: +Shootable Projectiles?

Wed Oct 27, 2021 3:51 pm

Try use a second actor as colision spawned in the first projectile frame. This second actor must be Warped as childrem and kill the master in his pain State. #ilovehacky

Re: +Shootable Projectiles?

Thu Oct 28, 2021 2:23 pm

Try giving it -NOBLOCKMAP and see what it does then.

EDIT: The death state might also do well to call some stuff to flag it as -MISSILE, change its direction of movement, etc. because IIRC something simply dying like a monster won't imply it'll stop acting like a projectile.

Re: +Shootable Projectiles?

Fri Nov 05, 2021 5:02 am

Projectiles can't be shootable. Spawning a hitbox is the only way to imitate that.
Moreover, it's actually better because most of the time it's a good idea to make a hitbox *larger* than the projectile physically is.

Here's a hitbox I use to make grenades shootable in Painslayer: https://github.com/jekyllgrim/Painslaye ... un.zs#L461
Note that I don't destroy anything in CanCollideWith because that would be very bad; instead I queue it for destruction by modifying pointers.

Re: +Shootable Projectiles?

Fri Nov 05, 2021 1:55 pm

Jekyll Grim Payne wrote:Projectiles can't be shootable. Spawning a hitbox is the only way to imitate that.
Moreover, it's actually better because most of the time it's a good idea to make a hitbox *larger* than the projectile physically is.

Here's a hitbox I use to make grenades shootable in Painslayer: https://github.com/jekyllgrim/Painslaye ... un.zs#L461
Note that I don't destroy anything in CanCollideWith because that would be very bad; instead I queue it for destruction by modifying pointers.

That's not true. Projectiles can very much be made shootable: the attached PK3 does exactly that, without any "hitbox" hacks or modifying things from CanCollideWith. (Modifying pointers is still breaking the function's contract!)
You do not have the required permissions to view the files attached to this post.

Re: +Shootable Projectiles?

Tue Nov 09, 2021 5:26 am

phantombeta wrote:That's not true. Projectiles can very much be made shootable: the attached PK3 does exactly that, without any "hitbox" hacks or modifying things from CanCollideWith. (Modifying pointers is still breaking the function's contract!)


I remember this not working in a few versions; perhaps it's been brought back.

Even if it's doable, I don't think it's a good idea both because using a hitbox of a difference size is better gameplay-wise, and because I'd rather not include the projectile in blockmap.

Re: +Shootable Projectiles?

Tue Nov 09, 2021 4:45 pm

Better to include the projectile in the blockmap than to spawn a whole separate actor that is then included in the blockmap.