How to get an interface to print a string?

So I made an interface called “TPC_Attacking”. Inside I made a function called “TPC_Attack”

In the enemy bp I added the interface and chose to implement it and hooked it into a Print String.

In the TPC bp, I added the interface and called it after the punch input.

I’m not getting that print string, what am I doing wrong? thanks

Hey there @usa423!

So you’re not sending a message to your enemy to activate the Function. You need to use "TPC Attack (Message) and pass in your target as the object. This will tell the interface to send a message to “Target” and run that function if it utilizes that interface. :slight_smile:

image

image

3 Likes

Ahh yes that was it thank you! Ok dumb question, what if I have more than one class of enemy in a scene? Just keep adding these nodes ad-nausem back to back in sequence? Is that the best way / most efficient way to add many enemies to this? Thanks

Not a dumb question at all!

You would gather them into an array, then use a “ForEach” node with that array as the input, and then run this with the output of the ForEach node being the target! If something does not implement the interface, it just moves on, it doesn’t throw an error. :slight_smile:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.