Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: Not Selected
more ▼

asked Jan 05 '15 at 12:46 PM in Blueprint Scripting

avatar image

163 15 19 25

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.

more ▼

answered Jan 26 '15 at 02:09 AM

avatar image

405 11 18 36

avatar image redhatdragon Jan 26 '15 at 03:59 AM

Also don't forget that you can use arrays to represent a group of players. That should make your blueprint smaller. Not sure if it's something everyone knows but i was surprised when i found that out.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question