Doubt about Targets for Function Calls

Hey everyone, I’m a student trying to learn Unreal.

I’ve been trying to understand how to target certain class objects when you’re calling a function of theirs in another blueprint. For instance, if you’ve implemented a function in the game mode event graph (via a blueprint interface), you have to target the game mode when calling that function from another class blueprint.
What do I do if I’ve implemented a function in a character blueprint? I’ve made a BPI for that character and implemented the function, but I’m unable to get a reference to the object when I’m calling that function from another class.

There is many ways to get a reference.
You have to be more specific about your set up…
If you’re trying to get a reference of the player Character in a SinglePlayer context, just “GetAllActorOfClass”(PlayerClass) and “Get Copy”(0) should be good.
In a multiplayer context, you’d have to think more :slight_smile:

Hey again Silik. Thanks for stopping by to help. I currently have an Enemy class with a Damage function, which will reduce the enemy’s HP by whatever input is provided to it.
I’ve also got a Spell class, which has to call this function each time it collides with an Enemy. What would you recommend for this?

You got “EventHit” on the projectile side and “OnHit” in the receiving side, each provide a good bunch of references. :slight_smile:

Hey please check out my screenshot. I’m just trying to understand how this works.

I tested like that:

Projectile implementing the Interface with SphereCollision Blocking Pawn:

ThirdPersonCharacter Implementing same Interface:

Yeah I accidentally left out the Get Class node. My bad.
Also, I just realised one more thing. All my spells have different kinds of colliders, but I want my parent class to handle the damage dealing functions upon colliding with my enemies. How would it be possible for me to do that? My root component is just a scene, and if I add a collider to my parent class, the child classes will have it too, which I don’t want. I can’t think of any workarounds for that either. I’d have to have the collider in my parent class to handle collisions if I want my damage dealing functions invoked there, right?

Why do you want your spells to have different collider?

They all have different shapes and sizes, which is why I want them to have different colliders.

Why not make one master spell and change the size of the collider in the children spells?

Because I’ve also used different types of colliders in certain spells. Is there no way around my problem?