Physics based fighting game, trying to make you unable to attack if you're blocking

Hello! I am very new to UE4 or game development in general so keep that in mind. (:

I am working on a small project where basicly the torso, head and arms are ragdolls and you have to run and spin to get the hands flapping to hit the other player. I am also trying to make you able to block with an input button. However as it works so far as if Player 1 blocks, player 2 cannot harm player 1, but player 1 can harm player 2 even when player 1 is blocking, which I want to make you unable to do

Here’s an image of the blueprint I use for attacking and blocking. Anyone have any idea of what is wrong?

I see something that brings up a question: The part near the end where it kills the player always does it to the first player character it finds, regardless of who has zero health left. That seems strange to me.

The other thing which is probably causing the problem is in your InputAction Block event. You have a reference coming out of your Cast node that you try to use after a Delay node. references that were accessed before a Delay node are no longer there after the delay node fires, which means that it’s either setting the isBlocking to false on self or fails to because the reference is null.
Maybe that’s not really the problem. That depends on where you are setting that P2Ref 2 variable. What is it and when/where do you set it?

Hey! Thanks for your reply!
I am not sure that’s an issue in the death as it is referencing player one and is in the player one blueprint. P2 is another asset alltogether.

I am going to try to add the Cast node again after the delay. And the P2Ref2 is currently just a variable created as a reference to the player2 blueprint/asset. Do I need to set it? And in that case do you know how? ^^

Well if you don’t set a variable then it will refer to nothing and not work on other nodes as a target. So if it hasn’t been set to something by the time this code runs, then the code either won’t get past the first branch or it will always evaluate to false.

Hmm, I tried to instead of creating a refrence, I promoted the As third person character in the cast nodes to variables and put them throught one branch each where block is the condition so I got it to work! Thank you very much for your help MightyEnigma! :smiley: <3

Cool i am glad you got it to work!