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 reference to Actor


I'm trying to communicated with Blueprints which are not in the level by default, nor spawned at the moment of interaction. I have searched for hours, but just can't figure this out.

In my particular case I have 10.000 bananas which inherit their variables from a parent (fruits) actor blueprint and are spawned dynamically at runtime. Those bananas may be picked up, and stored in my inventory. From my inventory I may select a specific banana and use it. On use I want

  • A: The character controller to trigger a event related to that specific banana.

  • B: The character controller to be able to send events back to the specified banana.

I think the proper function for this are event dispatchers, however my problem is to reference the specified banana. The only option I see is to use "get all actors of class" but getting 10.000 actors and checking if they just were used can't be right. There must be a way to reference the "dispatching banana" or any other more valuable method.

I really need some help with this.

Product Version: Not Selected
more ▼

asked Feb 25 '15 at 10:07 AM in Blueprint Scripting

avatar image

20 2 4 6

avatar image Dan.OConnor STAFF Feb 25 '15 at 07:03 PM

Have you tried a custom event? You can add references to the actors you're interested in as parameters in the event.

avatar image Cmiller28 Feb 25 '15 at 08:46 PM

I tried it now. As far as I understand custom events (at the moment not to much), they would be a valuable option. However just like with the event dispatchers I don't know how I actually would add the reference to the triggering banana and set it as target when I call the function within the character controller (or any other bp).

My pathetic attempt as attachment (door=banana) alt text

ue4.png (135.2 kB)
avatar image Dan.OConnor STAFF Feb 25 '15 at 11:19 PM

Ah - in this case you could just drop down a cast node and call a function.

avatar image Cmiller28 Feb 26 '15 at 06:50 PM

Alright, thank you! With your hints I actually managed to fiddle things together. I'm not certain yet about various things, but I could solve the Issues behind this Question.

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

1 answer: sort voted first

I would make all pickupable actors either be children of some pickup actor class or implement a pickup interface. Then you can implement the "onUse" function you will have declared in your interface/parent. This approach is quite generic as you could then "use" any item you wanted.

If you can safely assume all inventory items are of type fruit then you can just cast the inventory item to a fruit and call use.

The dispatchers main use would be if you wanted to be notified every time the banana was used, but it seems you sort of want the opposite. I am assuming that you have some pointer to the banana at the time you want to use it

more ▼

answered Feb 26 '15 at 02:36 AM

avatar image

2.6k 98 16 97

avatar image Cmiller28 Feb 26 '15 at 07:02 PM

Thank you for this outline, it answered a question that yet had to come to my mind. However, 2 things:

1: Whenever I place a cast to child node, or call a child function in the parent, the BP won't compile correct (it does compile and function correctly ingame, but draws warnings and "dirty, needs to recompile". After closing and opening the Project, this is gone, until I click the Compile Button again, as it becomes dirty again. Is there something specific to casting to childs or call child functions?

2: As seen in the Screenshot I'm using a very basic setup, which will work for only a few types of fruits (bananas, apples, oranges). Could you give me some advise, how to setup this for like 1000 types of fruits?

alt text

argh.png (176.7 kB)
(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