Download

Slow down a character inside of swamp water

I am trying to make it so that when a player enters swamp water they slow down, my only problem is in my character blueprint (Same as ThirdPersonBP) I can’t add an event for when the trigger box is overlapped or exited which I can in level blueprint but can’t change max walkspeed. If there is any other way to slow down the character please let me know

Create a blueprint for your water and maybe call it “WaterBP” or whatever works for you.

Add a box collision and make it the scene root.

Drag it into the level and make the collision perfectly encapsulate your swamp area.

Create a boolean variable such as “IsInSwamp” in your character blueprint and make it instance editable and expose on spawn.

Inside the “WaterBP” blueprint with the box collision selected, go over to the right scroll down and select the green EventBeginOverlap of that collision. It will bring up that node in the blueprint.

Off of that node cast to your character blueprint and pull off the “As Your Character” and set the variable “IsInSwamp?” to true

Click on the green EventEndOverlap and off that node cast to your character again and set “IsInSwamp?” to false in the same manner.

Lastly go to the end of your movement logic in your character blueprint that is running off an input axis like “MoveForward” and make a branch. Get the “IsInSwamp” variable and connect it to the branch and off true set your max walk speed to your desired speed and off of false set it back to where you want it normally.

I might have missed a couple little steps because I’d have to pull up the editor and run through it, but I know this definitely works for me. Let me know if that gives you any trouble or if you want to try that.

When I compile in the WaterBP something needs to be connected to the object node in the cast to ThirdPersonBP

Also after I add the walkspeed and branch to my movment blueprint it gets stuck at 90 walkspeed

The component overlaps should look something like this.

You have to make sure that you set your walk speed back to normal after the boolean is set to false. This is how I have mine working. Its probably a bit different than what you have. You can ignore the “CurrentSpeed” variables I have and just go with the walk speed ones. The branches are just seeing what the character might be doing and adjusting the speed accordingly and if nothing else(false) it just reverts back to your desired speed.

“IsSprinting” in your case would be “IsInSwamp”…