x

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"

Blueprint Communication with Custom Events

Hi there, Whenever I try to cast from one character blueprint to an actor blueprint to fire off a custom event, I run into a problem. I don't have an "Object" to cast to. I don't completely understand how the casting works. What am I supposed to put into the object section?

alt text

Thanks.

Product Version: UE 4.12
Tags:
prob.png (496.5 kB)
more ▼

asked Jul 15 '16 at 08:24 PM in Blueprint Scripting

avatar image

TalkingIsGreat
43 12 16 20

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

2 answers: sort voted first

Hi TalkingIsGreat,

What a cast does is check a specific object or actor reference to see if it is of a specific type. What are you attempting to do specifically? Have you tried reading through our blueprint communication documentation, there is a wealth of information available that may help to explain the concept of casting, event dispatchers, and interfaces there:

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/CastNodes/

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/UsingInterfaces/

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/EventDispatcher/

For a basic explanation of casting ->

Think of it as if you (an actor) are asking a specific object or actor what it is. You have approached the object and said "Are you this?" Now, without a reference, you are still asking "Are you this?", but you have nothing that you are specifically speaking to. In this case, you will need to find a way to pass a reference of the actor you want to ask, either through a trace, object to object interaction, overlaps, etc. Once you have that reference, you can perform the cast, then use the "as " pin to get specific variables and functions from within the casted object.

more ▼

answered Jul 15 '16 at 09:05 PM

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

OK, so casting only works with a reference to the actual instance of the object or class. Technically you can plug anything into there as its a wildcard, but it will only cast if its of the same class your casting too. If its not the correct class, the cast will fail.

In this case you'll want to add an instance of your GenerateEvenGraph to your game level, and then add a new variable based off that class in your BPCharacter class. You'll then need to somehow get the actual instance of the GenerateEventGraph class and plug it into that variable. This is quite tricky though and a lot of work, so we often do it a different way.

Instead of casting to GenerateEventGraph from inside your player blueprint, cast to your player from inside GenerateEventGraph and add to the LPoints variable. You can do this by casting to BPCharacter and for the object input, plugin the "Get Player Character" function. then as BPCharacter, just drag off to get the lpoints variable and do whatever you want with it. It is sometimes much easier to do this rather then the other way around.

more ▼

answered Jul 15 '16 at 09:11 PM

avatar image

Higuy8000
183 11 12 28

(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