I work on a Tower defense game in which the “Box Overlap Actors” node of the Towers gives them the array of enemys around them. The Output Actors are generic “Actor object Reference” from which i can not find specific Variables from my BP_Enemys (obviously). Is there a Way to Work around that? For Example i need the Health Variable, so the tower can For each loop every Actor reference to find the one with the most HP and set them as current target.
I use the “Box overlap actor” node after an Event tick, because sometime enemys spawn inside the Collsion. On Overlap wont work in that Case.
I tried is with Interfaces, but if i set an Output Variable, i cant call the Interface as an Event in my Enemy BP, just as a function, but maybe i do something wrong here
Excuse my dumbness, but how do i “call” the “Get Stats” interface in my BP_Enemy, if it only appear as a function in that Blueprint? Since it always appear with an incoming execution pin, i have to attach that to an event, right?
For casts to work well, you need inheritance which is, arguably, more complex. And you can still combine it with interfaces, ofc for the ultimate mind****.
If you use inheritance, you can cast to base class.
Oh wow, in case of the Interface solution, i somehow had in mind that after calling the “Get Stats” message in the Tower BP, you also have to make an Event inside the Enemy itself to set the Variable Health to the current HP of the Enemy. But the function itself sets the value (After you hook the Health Variable from the enemy to the Outputnode of the function, like you have shown in the picture), without having an extra event.
The cast to node might also be a good solution, thank you for that, too!