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. 

Set MyCharacter Variable in Level Blueprint?

Hi all:

I have an int variable set up in my MyCharacter blueprint, for a limited resource I want the player to have access to. I want the amount of the int to be different for different stages, so I'm trying to set it in the level blueprint. So I set up a variable for my character blueprint in the level blueprint using the method shown in the Direct Blueprint Communication documentation. But when played nothing happens, and I receive an error message (shown below). Any help on how to resolve this would be greatly appreciated.

alt text

alt text

Product Version: Not Selected
levelblueprint.png (36.8 kB)
errormessage.png (22.6 kB)
more ▼

asked Sep 02 '14 at 02:44 AM in Blueprint Scripting

avatar image

Chroma Chris
86 20 20 28

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

2 answers: sort voted first

You need in your level blueprint:

Begin Play >> Get All Actors of Class (MyCharacter) >>Get >>Cast To MyCharacter >> Promote to Variable (sets a newvar of type MyCharacter, then name it MyCharacterVar).

And get and hook up MyCharacterVar as the target for your set Jumps.

more ▼

answered Sep 02 '14 at 03:55 AM

avatar image

1.1k 46 47 88

avatar image Chroma Chris Sep 04 '14 at 07:08 PM

Is the Get node I should be using after Get All Actors of Class the one listed under Utilities-Arrays? Because that is the only one named simply 'Get' I can find (none appear in the context-sensitive list I get from dragging the pin out from Get All Actors of Class). When I do use this Get node, I'm unable to find Cast to MyCharacter from its context-sensitive list to link to next.

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

You should probably be using an interface for this as directly accessing blueprints like that you need to cast them and its not great practice.

Create a new blueprint interface called 'MyCharInterface' or some such.

Add a function to it, lets says 'SetJumps' and have an input of 'int' jumps and a bool return.

Then on your character blueprint properties add the interface of 'MyCharInterface' and you should see a function prototype SetJumps appear. Now open that up and setup the function to take the input and assign it to the blueprints jump variable.

You can now access this from anywhere by doing:

Get All Actors of Class 'MyChar' -> 'SetJumps'

more ▼

answered Sep 02 '14 at 09:28 AM

avatar image

123 3 3 5

avatar image Chroma Chris Sep 04 '14 at 07:03 PM

How do I add the MyCharInterface blueprint as an interface? It is not giving me that as an option under MyCharacter's blueprint properties.

alt text

addinterface.png (36.0 kB)
avatar image Hyperloop Sep 05 '14 at 08:47 PM

Useful info. Could you elaborate on why casting to a blueprint is not good practice? I'd really like to learn more about that.

(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