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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

How do I get a variable from a character blueprint in to my level blueprint?

Hi there,

I have a blueprint which checks if a character is in my pre-formed array of characters, and if it is it will cast to the character and affect the movement of it.

My question is, how do I get the 'Health' variable from one of these character blueprints, and alter it from within my level blueprint?

I ask because I'm using overlaps, which are in the level blueprint, but would like to change the health value of any player within the radius each second until they leave. I can't seem to figure out how to pull my 'Health' variable from one blueprint into another.

Thanks in advance!

Product Version: UE 4.18
more ▼

asked Feb 14 '18 at 10:13 PM in Blueprint Scripting

avatar image

1 1 4

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

1 answer: sort voted first

on actor overlap get the overlapping actor and you might have to cast to that character to get the variable you need.

more ▼

answered Feb 14 '18 at 10:16 PM

avatar image

379 1 5 8

avatar image KitLUL Feb 14 '18 at 10:20 PM

I'm not sure I follow. Here is what I have: https://i.imgur.com/hASXc3u.png

After the Cast_To_Character node I'd like to affect the variables of the Character BP- is there a simple way to do that? Apologies if I've just misunderstood your answer. :)

avatar image Exonfluxx Feb 14 '18 at 10:30 PM

Something like this

alt text

I looked at your picture i don't get what it is your trying to do .. why are you trying to call the class vs the character directly ?

cast-to-char.png (149.3 kB)
avatar image Exonfluxx Feb 14 '18 at 10:33 PM

Wait are you trying to effect the pawns ?

avatar image Exonfluxx Feb 14 '18 at 10:41 PM

From the image i see that your casting to a character .. not sure if its in general or are you trying to target a specific character in my image I am targeting specifically the third person character that interacted with the box. (I actually used it as a check but still) you should be able to get bp variables from the as character node without a problem.

avatar image KitLUL Feb 14 '18 at 10:41 PM

There are several different character blueprints all within my array, so I'm just checking that whatever has overlapped my TriggerBox is one of those before continuing.

I think I'm perhaps just a bit too tired to be trying to comprehend this or perhaps to get my idea across properly.

I have an array Character Pawns which contains Character blueprints. Each of these blueprints has a variable inside of them titled 'Health' which I want to be able to change from within this overlap sequence.

Unless I'm mistaken, by the time my script here reaches its end it knows that what it is dealing with is a character blueprint, which is why it can alter the Character Movement. What it doesn't know is which blueprint it is dealing with, so I cannot access blueprint-specific variables.

My question is, how do I do this?

Thanks for taking the time to answer this!

avatar image Exonfluxx Feb 14 '18 at 10:59 PM


got ya .

the overlap return should tell you witch one but i know there are occasions where it does not tell you which one.

I solved this for someone with a simple is valid check using castto that ran down the list of characters and would return which number the character was ..

basically the person named his characters character 1 character 2 etc .. anyway

Ill include the blueprint paste bin of that function in this post.

but you can use is Valid or cast to as a way to find out which one and cast to it.


in my case i couldn't use a for each loop but in your case you might be able too.

(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