Freezing character after overlap

Hi,

Can you post a picture of your blueprints for that overlap event?

Hey so I have a system where when one player overlaps another players box collision he makes that character “it”. What I am trying to do is make it so when the person tags the other person the person that has just been tagged becomes frozen for 5 seconds by adjusting the max walk speed to 0. When I try setting up a system like that it freezes both characters. What do I need to do?

Hey there, can you show me how are you doing the freezing part?

The images are on player 1’s blueprints. Player 2 and 3 have the same blueprints just adjusted for that player. The first image is Player 1 sending the tag. The second image is when Player 1 receives a tag.

I deleted my system because it was not working but what I did was in the receive after the second branch I would set speed to 0 and then delay 5 seconds before continuing.

Based on your blueprints, I think your approach to such problems is not a good one and you will end up in a situation with lots of duplicated code and repetition! First, let’s clarify the logic you’re trying to implement. As I understood, your player character has a collision box somewhere nearby or around it. I’m assuming this collision box was added as a component to your character blueprint. You want to check whether another player has entered this box, and if so, you want to freeze that other player who entered the box for some pre-specified time (I don’t see any delay node in your blueprints either). If this is what you’re trying to achieve, then the right way of approaching such problems is for you to consider using base classes and to take advantage of inheritance and polymorphism.

Understanding these concepts will not only make your life easier but also your blueprints setup much clearer and neater! Take a look at these two answers in [here][1] and [here][2] where I briefly explain what inheritance and polymorphism are and how to use them in the questioners’ problems (You can think of these questions as examples to better understand these concepts). Having understood these concepts, regardless of whether this is a multiplayer game or not, these would be steps that you need to follow:

  1. Create a BP class based on character and name it MyBaseCharacter. This will be the base class for all your characters.

  2. Let’s consider only one of your characters has a special freeze magic (that collision box) that whenever others approach it, they will freeze. Create another blueprint class but this time base it on MyBaseCharacter. Let’s name it MyMagicCharacter.

  3. Add a collision box to MyMagicCharacter.

  4. Implement the following logic inside MyMagicCharacter:

There you go. What you wanted but in a much neater and cleaner way. Now whenever a player that was created based on MyBaseCharacter enters this box, they will freeze (for 5 sec in here). No need for casting to different players or calling functions from different places! The logic for freezing sits in this BP alone and whenever yourself or someone else want it, you will not have to trace it to multiple places just to figure out how it works.

Hope this helps.

Best,

Ahmad Jamialahmadi