Theres a way to made projectiles slowdown enemies on impact?

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!)
Post Reply
Vamvilodon
Posts: 2
Joined: Tue Jul 29, 2025 6:02 pm

Theres a way to made projectiles slowdown enemies on impact?

Post by Vamvilodon »

I have the idea for a projectile that, upon impact, causes the victim to lose movement speed. Is there a way to do this? I tried to do it with a powerup, but they don't work if the actor isn't the player.
Kan3x
Posts: 67
Joined: Tue Nov 08, 2022 4:19 pm

Re: Theres a way to made projectiles slowdown enemies on impact?

Post by Kan3x »

Yes, you can, you just to define a new speed powerup that can affect monsters speed and use that.

I made this simple powerup that can affects both monsters and players:

Code: Select all

Class PowerGlobalSpeed : Powerup
{
	override double GetSpeedFactor()
	{ 
		return Speed;
	}
	
	override void InitEffect()
	{
		Super.InitEffect();
		if(owner)
		{
			owner.Speed *= GetSpeedFactor(); //directly modify monster/player speed by multiplying it for the speed property of the poweup itself
			if(owner.Player)
				Colormap = ((BlendColor & 0xFFFF0000) == SPECIALCOLORMAP_MASK)? BlendColor & 0xffff : PlayerInfo.NOFIXEDCOLORMAP;
		}
	}
	
	override void EndEffect()
	{
		Super.EndEffect();
		if(owner)
		{
			owner.Speed /= GetSpeedFactor(); //return to the previous speed
			if(owner.Player)
				Owner.player.fixedcolormap = PlayerInfo.NOFIXEDCOLORMAP;
		}
	}
}
Post Reply

Return to “Scripting”