Line trace - Actor variable
Firstly sorry for the lack of a picture on this question, I'm on my laptop so I can't get one.
This is something I've been trying to work on for a little bit and am getting slightly confused for the results.
The way I currently have my test set up is a laser beam is fired by the player, it then detects what actor it has hit, this is working as it should. Each player in the level has a custom name saved as a variable on their load in.
What I would like to happen is when the laser hits another player, it gets that username and displays it on screen via print (Placeholder).
What is currently happening is when the laser hits the other player, it shows the players custom name, not the target.
Could someone let me know what I am doing wrong here? When I get to my PC I will post a picture of my current setup.
asked Jan 05 '15 at 12:46 PM in Blueprint Scripting
In order to get information from the target that was hit by the laser, you should be using the "Hit Actor" output from the trace node.
Drag a wire from the "Hit Actor" output, and search for "Cast to" followed by the name of your target's Blueprint. For example, "Cast to BP_Enemy".
The "Cast to" node has an output pin which you can use to access any public functions/variables if the cast was successful. So you can drag a wire from the "Cast to" node's output, and get the variable you want, like "Username" or "CustomName".
Then use the Print node to display it.
Follow this question
Once you sign in you will be able to subscribe for any updates here