Projectile not reflecting when it hits a player with a reflection powerup

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!)
User avatar
Baysha
Posts: 19
Joined: Sat Feb 24, 2018 5:57 pm

Projectile not reflecting when it hits a player with a reflection powerup

Post by Baysha »

Hi. I am coding a custom projectile in ZScript. However, when the projectile hits a player with a reflection powerup, it does not reflect as expected. Instead, it simply disappears as if it hit the player normally. The only way I was able to make this work as intended was to inherit from an existing projectile such as DoomImpBall. Is there any way to fix this without inheritance?

Code: Select all

Class HeadLaser : FastProjectile
{
	Default
	{
	Speed 25;
	Height 32;
	Radius 8;
	DamageFunction (40+Random(0,25));
	+ROLLSPRITE
	Projectile;
	DamageType "HeadLaserDMG";
	
	}
	
	States
	{
	Spawn:
		HLAS A 2 
		{
		A_SetRoll(roll+15);
		A_SpawnItemEX("HLtrail",-30,0,0,0,0,0,0,SXF_NOCHECKPOSITION);
		}
		Loop;
	Death:
		TNT1 A 0;
		Stop;
	}
}

Class HLtrail : Actor
{
	Default
	{
	Renderstyle "Translucent";
	+NOGRAVITY
	+ROLLSPRITE
	}
		
	States
	{
	Spawn:
		HLAS A 2
		{
		A_SetRoll(roll+15);
		A_Fadeout(0.05);
		}
	Loop;
	}
}
User avatar
ramon.dexter
Posts: 1341
Joined: Tue Oct 20, 2015 12:50 pm
Graphics Processor: nVidia with Vulkan support
Location: Kozolupy, Bohemia

Re: Projectile not reflecting when it hits a player with a reflection powerup

Post by ramon.dexter »

Everything looks okay. Show us how you applied the reflection on actors.
User avatar
Mikk-
Posts: 2272
Joined: Tue Jun 30, 2009 1:31 pm
Location: Somewhere off Kanagawa

Re: Projectile not reflecting when it hits a player with a reflection powerup

Post by Mikk- »

I don't think FastProjectiles can be reflected due to their quirks. They also can't bounce or be subject to gravity.
User avatar
Baysha
Posts: 19
Joined: Sat Feb 24, 2018 5:57 pm

Re: Projectile not reflecting when it hits a player with a reflection powerup

Post by Baysha »

Mikk- wrote: Thu Dec 01, 2022 12:31 pm I don't think FastProjectiles can be reflected due to their quirks. They also can't bounce or be subject to gravity.
That was the problem! Thank you so much!

Return to “Scripting”