Help with line trace and player controller

In my game all the players that join are using 1 player Blueprint (Player1) , Im having trouble using linetrace and using it to differentiate between multiple players for example lets say 4 players have joined the server. I want the linetrace to see if it hit a player add a point to the player that shot it and deal damage or prevent to player from moving the player it was shot at. I’m assuming this involves doing things with the player controller but I am quite new to UE4 and not very understanding of the player controller so try your best to use simple terms when explaining to me how to do it, explaining how it works too would be very helpful.

Sorry if how i worded it was hard to under stand . Thanks in advance :smiley:

Hi,

Are you checking for the player index when you run the linetrace? Can you show me your blueprint setup so I can better understand what you are seeing?

Very sorry for the late response. Here is what i have a basic line trace ,IsHit variable and beneath that something that will make the player jump when IsHit is true so i can know.

99357-bandicam+2016-07-20+21-10-45-061.png

I will be leaving around 7:00 am (EDT) tomorrow and I don’t know how long i will be I’m guessing 3-4 days, so I won’t be able to test things until then. I will still try to keep in touch during that time though.

At this point, you will need to use a cast node off of “Hit Actor” in the “Break Hit Result” pin. Cast to a specific character class, if it is true, use “As _C” node to set your boolean inside the hit actor. Please let me know if this works for you.

I am back home now and I will try this

I am a bit confused could you send a photo of what you are saying so I can better understand.

If you mean something like in this photo it doesn’t work.

That is what I mean. Please use a print string to check if the cast is failing or succeeding. This is the proper method to set variables in a hit actor, which means it may not be associating the hit actor with the cast to actor type.

Its saying the cast is succeeding

I have also tried this but its not working either

What are you trying to have happen once the boolean has been switched? While the bool is altered, if you don’t have anything checking for the bool or happening after the bool has been flipped you will need to run the function the boolean is called in.

I have it make the player jump repeatedly for 5 seconds just so i can see its working, I have tested that it does work so its a problem with switching it on

Run the function that forces the player to jump from the cast node. From the way it sounds, you are not calling the function after setting the boolean value, as stated above. Try running the function from the cast node to see if it works.

This? If so it doesn’t work either

I tested this on my end and it worked as intended. You are using the proper method. Try this. Create a custom event in your player character and have it run a print string. After you cast, make a call to the custom event. Do you see the event occur when called?

Thanks for your help, I figured it out using damage. I also hope to catch one of your streams and maybe learn something.