Calling a Function

Hi all

I’m sure this is a simple fix but I’m not finding it. I’m trying to get this blueprint to call a function from an actor blueprint, but it is not working (screenshot below).

I think I need to use an alternative to ‘Get Owner’?

Cheers

Matt

but it is not working

Which part of the above is not working? Is the cast failing?

I think I need to use an alternative
to ‘Get Owner’?

Why do you think so? What’s the scenario?

It’s pretty much impossible to advise without knowing anything about the situation.

I’m trying to get this blueprint to
call a function from an actor
blueprint,

  • what is the relation between the two actors?
  • how does referencing is supposed to work here?
  • how / when / where does the interaction happen?

Why are we using Owner in the first place?

Yep, the cast is failing.

That makes sense. I have made a video here outlining the issue and what I am trying to achieve (it may take a while before the HD version has finished processing): Calling Function Help - YouTube

The cast is failing right at the start because the Cast node doesn’t understand the object being referenced. One way to handle this is to create a variable. Create a begin play event node, then cast to the actor you are trying to “talk to” drag off the “as” pin and promote to a new variable. The correct variable type reference with be created automactically.
Once created, delete the Cast to node and drag off the begin play node, drag out your new Variable, choose to “set” the refrence. Now you can add the Cast To node wherever you would like inside that blueprint and “get” the Variable you created and connect it to the Object pin of the cast to node. Let me know if this Helps!

Please let me know if further information is required.

Thanks for this! I tried it but it did not work - I think perhaps I have made a mistake. Here is a video of how I tried to follow your instructions: CallFunctionHelp2 - YouTube

The owner of that blueprint is the level. It’s not some other random object. There is no (performant) way to access that function with your current setup.

What you should do is use a combined base class for all your pickup objects. Then you can move any functions that they have in common into that base class so they are available to all of them.

Hey thanks for this.

I’m not well versed in Combined Base Classes but I’d be willing to learn.

I did a quick Google search but did not easily find anything that covers this topic.

Are you aware of any tutorials that touches on this, so I can implement a combined base class?

Here’s a video from Epic that explains inheritance a bunch.

Not sure if they mention it in the video, but you can actually reparent blueprints. So as you already have most of the variants you need you can reparent them to the new base class you are making instead of creating a new child and copying your existing settings over. Might save you some work.

Hey thanks, that’s working now! Here’s a screenshot of my base/parent Blueprint so far (in case you can see any opportunity for improvement):