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"

Call function on undefined blueprint?

I am trying to make a system where, using a line tracer, I can make the player interact with objects, however, it seems that the only way to call a function on an object is by dragging in a reference to the exact object, therefore meaning it is impossible to call a function on an actor that is found via a line trace? If anyone has a method for this, it would be most useful :)

Product Version: Not Selected
more ▼

asked Mar 23 '14 at 12:33 PM in Blueprint Scripting

avatar image

Oscar Cooke-Abbott
542 54 59 71

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

4 answers: sort voted first

The easiest way to do this is with a 'cast' node. There is an example in this little tutorial I did: https://www.youtube.com/watch?v=q_9QKzLK-sU

You are basically finding out if a thing is of a particular type, so you can operate on it as that type if so.

A more advanced workflow is something called Blueprint Interfaces: https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/index.html

You could create a 'Interaction' interface and add a function to it called 'OnInteract'. Then add that interface to any Blueprint that you want to interact with (under Blueprint Props), and you will be able to add the OnInteract event node in its event graph. Then in your pawn, when you do your trace, try using the OnInteract 'message' node on the thing you hit. If it implements that interface, the event will fire in it. If it doesn't, nothing will happen. We will certainly have a tutorial for this soon, it's easier to see in practice, but for now casting will certainly get the job done!

more ▼

answered Mar 25 '14 at 10:32 PM

avatar image

1.3k 8 8 32

avatar image Pino of DFT Games Mar 25 '14 at 11:58 PM

Casting implies that you know to what to cast, so that is not really useful. The interface approach is indeed a good way to go, but implies a software design that is usually not there in garage studios or 1-man teams :) I've been playing with interfaces and looks promising, still digging on their performance side that isn't clear to me at this time (if you can give out info... I'd appreciate!)

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

The answer is interfaces.

Create a blueprint interface where you define the functions you need, then implement it in the actors you need to be able to call them on.

Then you can call the functions from other blueprints.

more ▼

answered Apr 06 '14 at 06:00 PM

avatar image

2.7k 161 274 254

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

The easiest way is to use game tags. Your blueprint can set a tag on the Hit Actor, so that in case that actor has a blueprint that checks if it's been tagged in a specific way it will perform some action accordingly.

more ▼

answered Mar 23 '14 at 01:20 PM

avatar image

Pino of DFT Games
121 1 4 16

avatar image Oscar Cooke-Abbott Mar 23 '14 at 09:55 PM

THANKYOU this sounds perfect! :D

(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