Download

How to change player movement speed inside a trigger box.

Hello! :slight_smile:

I want to achieve that when the player enters a trigger box, in that case his movement speed changes. How could I do this? Thank you very much for the answers! :slight_smile:

easiest approach would be call an event to set max walk speed, then replicate the change to server.

Hello! :slight_smile:

Thanks for your answer, but I’m working on a singleplayer game, and I’m pretty much at a beginner level, so I don’t know how to do this on a server. :frowning:
I want to make sure that as long as my player moves in that trigger box, his speed will decrease, and after leaving this trigger box, his speed will return to its original state.

For single player you are the server, so no extra steps needed.

On Begin Overlap (trigger box) -> Other actor -> cast to player class -> as player class -> get character movement component -> set Max walk speed.
On End Overlap (trigger box) -> same exact thing.

If the player can crouch then you’ll want to set crouched walk speed as well.

1 Like

Oh, it worked! Thank you very much for your help! :smiley:

Better approach would be not to replicate it, instead doing it on its own on client and server as client can just choose not to send it, or end it, allowing for speedhax, and potential dropped packet/some delay in network breaking something

If the client doesn’t replicate the change to the server, then server will correct via prediction error. This will rubberband the player to the correct location. There’s also speed hack reconciliation built into the engine.