How to create a simple BP for an enemy to slow his movement speed down when he is going over a box collision which should trigger this ?

Hi guys.

I need to make a BP so an enemy when he crosses over a box collision he will get his movement speed slowed down for the time he is on it and walking over it. And after he passes it he then continue to move with his default movement speed. Any idea how i can set this up? thx

Try an interface. Create your BP with the trigger and check other component/actor if implements interface, choose your new interface - this will prevent anything without the interface (likely the player) triggering it.
Then get component by class from other actor and try get their movement component. Set the new max walk speed value and then for end overlap, put it back.

Hope this helps. I’m not at my PC to be thorough but ths should get you in the right direction at least.

1 Like

Instead of interface im using “actor has tag” which should work but yeah the logic behind is what i needed so i have to get access to the movement component of the actors ty i think this might work. i will try it out in a sec…

Hmm didnt work out im not sure how i can get the enemy movement component reference from the enemy in my BP which is an actor BP trap that should slow the enemys when walking over it. I made this so far but this movement component its not from the enemy as it seems

Here is a solution. Any actor can trigger this but with an interface or another method, you can have it so it’s only triggered by your Ai:

I tried this in a clean thirdperson project and got the results I belive you desire.

Hope this helps.

1 Like

i have the node “actor has tag” so all actors with the tag triggers my traps. WOW i just tested it and it works :smiley: FINALLY thx dude

so this node get component by class is what i was looking for awsome stuff ty!!!

Any idea how i can make this awso work on different actors with different movement speed so the trap itself lets say slow them all equal to 100 units slower and when they are out of it they should get they’re regular movement speed back. i have some fast ones and slower enemy’s with this they all get equal movement speed

P.S. I think i just solve it with this here

so on starting to overlap the box i can set a default value for all to get -100 to movment speed regardless of the enemy itself and on end of the overlap just in reverse adding back +100 movemntspeed to all. But something isnt right working some enemys sometime just stuck not moving at all for 1-2 sec then continue to move will have to figure this one out next…

Hmm there is something wierd when they transition from one trap to the next one just in in between those 2 traps in a row. It seems when i have 2 traps after another in sequence when they walk over the first trap and when they step to the next one they are still awso with 1 foot on the first one so for a split second they get another -100 to movement speed when walking over those. here is how it looks like

So this isn’t the best approch to make this to work then the movement speed need to stay constant all the time even if i put 3 or more rows of those after another it will look very wierd… Is just some wierd split second animation that they get even slower and then back to -100 one movement speed debuf instead of 2. Maybe i should decrease the collision box area and that may be working for the smaller guys if some bigger ones comes with feet as big as the trap they may step and trigger 3x -100 movment speed if they have 1 foot on lets say 2 traps and the next is on the third … hmm

Try this for saving your enemy’s initial Max walk speed upon entering the trigger and then using that saved value to plug in on end overlap.

I’m not at my PC but this logic seems to work

Maybe adding a short delay before setting the new speed will overcome the issue of overlapping boxes?

Hmm i just try it but for some reason it is not working or i am doing it wrong ?

I try the delay as well but with no success… When enemy steps on the exact middle where 4 traps meet then he stop moving at all ( his default max movement speed is set too 200 and the slowing debuff is set to -70 so when he is in the middle of 4 traps thats 4x70 which is then -210 to his speed so he go even below 0 and just stuck on this spot forever)

I don’t think you need the small equation on begin overlap. Plug in your BP’s variable for what the speed will be lowered to - is it SlowEnemyMovementSpeed?

Also you can add some print strings with the float values plugged in, will help you understand what’s goin on and where.

yes SlowEnemyMovementSpeed is the variable but is at positive 70 can i go on it like as default value in the variable -70 ? if yes then true i dont need that equation. will try again.

Edit: its not working without the equation if i set it to -70 they dont move at all and if i set it to 70 then ALL enemy get down to movement speed equal to 70 but i do not want to do that scince i have different enemys with very different movement speed i want to apply that they get -70 to the base of they’re movement speed so like faster enemy’s get only a little slowed and not all to just fall back to like 70 speed units and thats awmost like a slow mo

Ok I understand. I think you’re close then. Try the equation again but instead of getting max walk speed from the component use the stored speed variable you made?

Regarding overlapping multiple triggers. There is a way you can fix it I’m just not too sure myself how. Something along the lines of checking if the other actor is already overlapping that trigger. If so don’t apply any further speed reduction.
But I’m not sure how to go about that.

Some sweet R and D will get you through that part.

yeah the problem seems to be in the transition from 1 trap to the next so awso not sure how to make it work if i have only 1 trap its working perfectly fine its just adding more then one in a row. Thx for the help i awso think im close to solve it

It looks something like this topic here not sure how to make mine as well work

Good luck friend. I think you’ll get it soon.

As an alternative you could move all the logic to an actor component and apply it to the pawn or any other actor you wish affected by the trigger.

For example, the actor component:

The macro that checks if actor is still overlapping:



Interesting idea i will try it out later i hope i can make it working with it. Will post how it go later ty for this!

I just finished it but i dont think that im doing it right here is how it looks like

Who is this Owner variable reference to exactly ? So far with this logic something is wierd they speed up instead of slowing down but i screw something

Acctually it was the opposite the enemy was slowing down and i speed up when i go over it then i changed something and it reversed… anyway im missing last steps here

If you do this:

It will subtract on every instance overlap even when the actor has not exited all volumes. Try placing a print node after to see as the value changes.

Try storing the default value to make it a fixed number: