Variable instead of float for Timelime?

I’m using a Timeline to manage acceleration of a player. It’s easy enough to say at 0 seconds start at 300 and finish at 600 by 2 seconds.

But what if I want 300 to be a variable such as Max Walk Speed?

Just normalize your timeline to be 0…1 or similar in value, and then either add a base and multiply by a scale, or use the Remap Range node to do the same thing (it lets you say Input ranges from A to B, and it should be remapped to be from Output A’ to Output B’).

Cheers,
Michael Noland

I’m really new to UE4 so I’m not 100% certain on what you mean. I have intentions of looking into your suggestion but before I do I’d like to clarify more as to why I need what I do.

My pawn has a normal walk speed of 300, with a sprinting speed of 600. My pawn also has a small range teleport/blink ability.

After using the blink ability I would like to lower speed to let’s say 100, and scale up to 300 or 600 depending if they are sprinting or not. I’d like the speed reduction to be noticeable for a good second or two.

What Michael meant was first, you make the values range from ‘min speed’ to ‘max speed’ inside your timeline graph however you need them, but instead of putting values of like 300 or 600 for ‘min’ and ‘max’ you use 0 for min and 1 for max.

Then after the Update pin, you know the output values will always range from 0 to 1, so you can multiply by your 100, 300, or 600 depending on your specifications you mentioned above. He suggested you look into the “MapRange” node that will even do all the scaling math for you in one step.

https://docs.unrealengine.com/latest/INT/BlueprintAPI/Math/Float/MapRange/index.html

The value from the timeline output goes into Value, In Range A is 0, In Range B is 1, Out Range A is 0, and Out Range B is your 100/300/600.

If the timeline is itself your ‘blink penalty timeline’, then what you’d probably do is set two key frames at 0.33 (one at 0, and one at say 1 second), and then another keyframe or two to bring it back up to 1.0. Take that output and multiply it by a SelectFloat node(IsSprinting, NormalSpeed, SprintSpeed). If you want to prevent them from sprinting after a blink, you could also output a bool CanSprint, etc…

There are lots of different ways to accomplish the same goal, but it’s useful to remember that you can do arbitrary math on the output of a timeline, it doesn’t have to contain the exact value you want, it’s just another term in your math expression.

Cheers,
Michael Noland

I would, in fact, argue that with rare exception the BEST way to use a Timeline for stuff like this is from 0:1 feeding a Lerp node; it makes it much easier to adjust or tweak what the Timeline is activating while still disconnecting those start/end values from the curve itself.

Even for simple float stuff I’ll do it this way; just because I only want to lerp from 400 to 85 now doesn’t mean those values won’t become dynamic later on (as happened to me when I had to adapt my shoulder-tight aiming cam to user-set follow distances). It’s not like the cost is really meaningful having that one extra node and it makes the actual work of the Timeline more visible and easier to edit anyway.

Thank you all for the insight. I understand now and I should be able to work something out :slight_smile: