Hi, I’m having an issue understanding what I think is a very simple problem. I am trying to have an actor with an On Overlap event be able to manipulate the variables of another actor, but the actor may be dynamically spawned in.
To go more in-depth, this is for a side-scroller(ish) platformer game. I have my player character able to left-click to spawn a “hit zone” that is adjusted based on the player’s level and stat variables with some minor variance (not so important). So when the Spawn Actor node is used, it spawns a BP_AreaHit blueprint that pulses X amount of times doing Y things and applying Z status effect. The problem is, what I want to do is get a list of the overlapped actors (which I do with For Each Loop and Get Overlapping Actors), determine which are enemies (tag isEnemy), which are environmental objects by type (tags isWood, isStone, isMetal), and then I want to call events in that actor and pass variables onto them.
Currently, I have an Event Begin Play connected to a For Each Loop to go through the Get Overlapping Actors array and go off branching nodes to see if it contains the different tags, and if so at the moment it just does a Print saying what the tag it overlapped with is, then it repeats on a .15 second delay for X number of times before Destroying itself. This is working just fine, it’s printing the right tags, and even as actors move into or out of its Overlap (effective area) it prints the correct Tags for that moment, so I can differentiate that it is able to do different things for different Tagged actors.
The problem I have is that not all isWood or isMetal (and especially not all isEnemy) Actors will share the same Parent BP. So, going off of just the fact that an overlapped actor has a specific tag, how can I say, “call an event that I assume all actors that can be hit will have, and change these variables that I assume this hit actor will have to these other variables’ values of the player character’s stats?” I’ve seen people say “Cast To Actor,” but how can I cast a custom event and the variables to the overlapped actor?
I’m sorry if this isn’t very clear, but I need Actor A that spawns Actor B to be able to apply X Y and Z variables to any actor that B overlaps who has a specific tag. Any help or pointing me in the right direction is GREATLY appreciated, thank you!