How to make projectiles & hitscans bounce off when…

Ask about ACS, DECORATE, ZScript, or any other scripting questions here!

Moderator: GZDoom Developers

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.

Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
argv
Posts: 184
Joined: Tue Aug 30, 2016 4:47 pm

How to make projectiles & hitscans bounce off when…

Post by argv »

I'm trying to ZScriptify part of a mod. It has a weapon that, while active, is supposed to reflect all missiles and block all hitscans that hit the user's front side. It does this by spraying tons of invisible actors in front of the user, which block incoming fire. This mostly works, but it's extremely complex, and only some projectiles get reflected (as opposed to exploding).

Is there a better way? Some way for a PlayerPawn or Weapon to make projectiles within a certain angle bounce off instead of hitting, and make hitscans within said angle puff harmlessly instead of generating blood?

I had initially thought to use a modified Disc of Repulsion effect, but this won't work on hitscans, nor on projectiles fast enough to get through the effect's range in one tic.

Any ideas?
User avatar
Amuscaria
Posts: 6634
Joined: Mon Jul 26, 2004 12:59 pm
Location: Growing from mycelium near you.

Re: How to make projectiles & hitscans bounce off when…

Post by Amuscaria »

Why not just spawn a number of small invisible actors in front of the weapon user, that does the reflecting and blocking, every tic?
argv
Posts: 184
Joined: Tue Aug 30, 2016 4:47 pm

Re: How to make projectiles & hitscans bounce off when…

Post by argv »

Then the user's own attacks hit them, too.

The mod currently handles that with THRUSPECIES/MTHRUSPECIES, but then players using that weapon are not protected from each other's attacks.

Return to “Scripting”