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!)

How to make projectiles & hitscans bounce off when…

Postby argv » Fri Nov 10, 2017 8:52 pm

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?
argv
 
Joined: 30 Aug 2016

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

Postby Amuscaria » Thu Nov 16, 2017 12:02 pm

Why not just spawn a number of small invisible actors in front of the weapon user, that does the reflecting and blocking, every tic?
User avatar
Amuscaria
The Sentient Mushroom
 
Joined: 26 Jul 2004
Location: Growing from mycelium near you.

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

Postby argv » Thu Nov 16, 2017 2:32 pm

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.
argv
 
Joined: 30 Aug 2016


Return to Scripting

Who is online

Users browsing this forum: Solid-Head and 2 guests