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? How to get variable from different blueprint?

Hi, I have a character with an raycast, also I have an X amount of objects from different kinds. I know the method to communicate for example with an chest, by getting the variable chest and getting it's components. But I want to get a variable or start a function from any of all these objects (X) tree, chest, pen, gold, ......and so on, when the 500 unit ray hits an object and the player presses F without declaring each object in the FPC BP.

Hope I used the right terms and described it well... understandable? :)

Thanks in advance, T-low

Product Version: UE 4.8
Tags:
more ▼

asked Jul 02 '15 at 10:48 AM in Blueprint Scripting

avatar image

T-low
78 4 11

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

1 answer: sort voted first

If you have lots of different blueprints and you want them to all share some sort of interaction then your going to need to either implement a BlueprintInterface in each of them then override one of the interface functions per blueprint or create a custom ActorComponent blueprint that you can check for and call functions on.

The interface will allow you to call the function on any blueprint that implements it but there is no default functionality. Each blueprint must override the interface function and handle it. You would do your line trace, get the returned HitActor then check if it has your interface with the DoesImplementInterface node. If it does then call the interface function. This allows for very specific effects on individual blueprints but a good bit of work and copy paste usually.

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

The ActorComponent blueprint route allows you to predefined generic functionality and add that to any blueprint just like adding a light or mesh component. In this example your would line trace to your object, use the returned hit actor by doing a GetComponentsByClass on it and then check if that returns any valid components. If it does then you can call your functions on the returned component. This allows for generic effects on all blueprints with little work.

Aaaaanyway, hopefully this helps, let me know if you want more info

more ▼

answered Jul 02 '15 at 07:04 PM

avatar image

RimmyD
2.6k 98 16 97

avatar image T-low Jul 17 '15 at 09:15 AM

Thx for the help :)

I now have a trigger box around all my Interceptable blueprints, which starts/ends a event in my FirstPersonCharacter BP. These save/delete the displayName and the Name I gave them in an array. Now I know which Items are in reach and if the ray hits one I can get the name and interact with the vieved BP.alt text

Is this method ok (in wirting clean code)?

bpcommunication.png (115.8 kB)
avatar image RimmyD Jul 17 '15 at 04:42 PM

Seems fine to me

(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