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"

[4.8.2] Get list of components in actor

Hey guys, I've been building a health system that works off an actor component, so I can attach it to anything in the world and handle it's health, as well as add a shield and armour. The problem I'm having is I simply want to check if an actor hit by a line trace has this component.

I can't have had this set up as a interface because I wanted the health to be an isolated thing that could be implemented into anything and keep the same functionality. If someone could help me with this that would be great.

Thanks, James.

Product Version: UE 4.8
more ▼

asked Jul 25 '15 at 01:16 PM in Blueprint Scripting

avatar image

78 6 11 18

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

1 answer: sort voted first

Hello @_Simian,

I think I may have a solution for you. I will first post my code and then explain it below.

alt text

My code performs a line trace and then checks whether or not the actor who has been hit has a certain component. If it does have the specified component then it will print out a simple string to the screen.

The main part of this code that I think you will be most interested in is the "Get Component by Class" node. This node takes in an actor and returns any components that match the component class that you specify. It will then return an array of those components. This will work nicely if you know the actor only has one of a specific component.

Hope this answer helps,


hittestcomp 1.png (131.2 kB)
more ▼

answered Jul 25 '15 at 05:28 PM

avatar image

493 53 38 57

(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