Temporarily make the player slow, yet keep momentum?

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Locked
User avatar
Spaceman333
Posts: 622
Joined: Thu Oct 13, 2016 8:40 pm

Temporarily make the player slow, yet keep momentum?

Post by Spaceman333 »

Is there a way to make the player's movement become slow temporarily, yet keep the momentum and the smoothness the same?

I want the player to be able to jump as high as they could normally and do all directional movement as they normally would, but be reduced by a factor of... say 20%, like they're slowed down in time or as if they're going through mud. As soon as this temporary slowdown is turned off, I want the player to immidiately continue moving as if everything was normal again.

I have no idea how to do that math/code wise or if its even possible.
Any help, clues or hints would be greatly appreciated.


Context:
The context for this question is the Slomo mod. I want to have an option to make the player's movement be slowed down while the slomo is on, but remain smooth. Currently its choppy as heck with the "freeze momentum" player momentum that was never intended to be used with regular slomo.

I'd like to have an option where the player can set the slowness factor of movement (between 0% to 100%), so they can choose how slowly they want to move.
User avatar
silentzora
Posts: 450
Joined: Sun Jan 04, 2004 6:24 pm
Contact:

Re: Temporarily make the player slow, yet keep momentum?

Post by silentzora »

Not sure about allowing the player to select a slowness factor themselves, but you could make a powerup that inherits from PowerSpeed, and set the Speed property to a decimal value less than 1. Just make sure you have the PlayerPawn class set with +NOTIMEFREEZE to eliminate the choppy movement.

Also bear in mind that this will not affect gravity. You'll need to manually set that via ACS with SetGravity().

Hope that helps.
User avatar
Spaceman333
Posts: 622
Joined: Thu Oct 13, 2016 8:40 pm

Re: Temporarily make the player slow, yet keep momentum?

Post by Spaceman333 »

silentzora wrote:Not sure about allowing the player to select a slowness factor themselves, but you could make a powerup that inherits from PowerSpeed, and set the Speed property to a decimal value less than 1. Just make sure you have the PlayerPawn class set with +NOTIMEFREEZE to eliminate the choppy movement.

Also bear in mind that this will not affect gravity. You'll need to manually set that via ACS with SetGravity().

Hope that helps.
Thank you! This very much does help, I didn't consider that the PowerSpeed could be used like that. Combined with the player actor's gravity property, this might be enough to make this work. The main trick here is to make the movement consistent that the player will be able to do the same jumps and leaps over gaps despite going slow. I'll have to experiment a bit, but I think this has a lot of promise. :D
Locked

Return to “Editing (Archive)”