Download

Message to interface not working

Why it is so hard to do comunication with interfaces? :smiley: ahahahah, always run into to trouble while doing those.

My problem is this:

I want to send the world location from “decoyParent” blueprint to “CH_mutant” blueprint, and I even created a BPI just for this called “decoyBPI”, have applied the “decoyBPI” to the “CH_mutant” and createad a function with a vector input called “mutant chase decoy”, and in the “decoyParent” i send a message with the coordinates like this:

In the “CH_Mutant” i called the event like this:


In this end the print never happens and i dont know why.

What am I doing wrong?

You’re calling the actor itself (the decoy), not the mutant actor:

Let’s hope that reference is valid…

you mean the target should be the mutant? i tought if i wanted to send the decoy location the target should be the the decoy in this case “self”

Self is the Decoy, we want to send the Decoy’s location to the Mutant, right? The Mutant should be target then. Atm, the Decoy is sending its own component’s location to itself.

If you implement the function, you’ll see the Decoy receiving its own message and mutant is getting squat.


What if there are 10 mutants - which mutant are we sending the location to? That’s why we need to target a specific instance of the bad guy here.

also why are u using an interface if u already have a reference to the mutant class? just create custom event in mutant and call it from there.

1 Like

yes it was that, i was confused about the target, it worked thanks :slight_smile: . Just one more question:

How can I set this default value:

So i dont need to set one by one in here:

I wanted that these decoys always had that CH_mutant blueprint as default value

Is there always going to be 1 mutant only?

yes its the only enemy

It cannot be set by default - the blueprint is a template, it does not know what’s in the level. Only once you instantiate it, one can assign values to Instance Editable references.

But you can select multiple actors in the Outliner and assign the same thing in one go. Can be cumbersome, though.


If there’s only one then I wouldn’t even bother setting anything else up and:

image

And now all Decoy actors have a refence to The One mutant there is.

AND if there’s only one, you do not need an Interface as @bumbumgoesnuts suggests. You already have a reference of the one correct type.

But, of course, you may have other plans for later.

1 Like

I really dont know, im new to this and i dont know quite well when to use interfaces or just custom events, but i change it to a custom event and worked too

1 Like

interface are a replacement for casting, they r not a magical way of accessing whatever blueprint u want. as said above the get actor of class node works tho it will give u direct access to the blueprint and then u can call the event from there.