I don’t know how to fix that specific error.
I suggest you undo everything you wrote in reply #4 because it doesn’t make any sense.
I’m not sure where to start, but let’s start with calling functions.
Lets say you have a ball class which has a function (or event) called Bounce. You set it up so that when ball A collides with ball B, you want to call the bounce function of ball B.
(note that in your setup, it’s kind of the reverse, ball B - the hit ball, calling ball A, but let’s forget about that for a bit).
This is where the Target node comes in. It is there to determine what instance the function is called on.
As Ball A collides with ball B, ball A gets the reference to ball B and can then call the Bounce function on ball B. In order to do that, you would connect the ball B reference to the bounce function. It would now execute on ball B.
If you did not connect ball B to the bounce function, the bounce function would execute on ball A, because the target is self.
But there is a step I am leaving out. Let’s say that we use this “event any damage” event to call the Bounce function. Well, the event provides the damage causer, but it is an actor. We can not drag the actor pin to the Bounce function because the Actor class does not have a bounce function. In order for us to get the ball B reference, which is currently being treated as an Actor, and access any functions or variables inside the ball class, we must cast the reference as that class, Ball.
Exactly what goes on under the hood I don’t know, I’m not a programmer. It’s something called polyphormism.
So we grab the “damage causer” node, and cast it to ball. Now we can call the Bounce function.
That is what casting is for, to access variables or functions inside that specific class… But there are a couple of problems.
First of all, maybe there are other classes out there in the game that can do damage to the ball. In those cases, we then cast to ball, it will fail. Maybe we can add a query, asking, well is it a football player? then cast to football player. but then maybe there are more classes and it becomes a mess.
In these cases, you would use an interface.
So whenever a ball takes damage, send a message (which is something the interface does) and execute the bounce function. If there is a bounce function, execute it. If not, then fail silently without any errors. For more information on interfaces, go to the docs because I’d be typing all night if I were to go into interfaces.
Still, there are two more important point I want to give. Say you have a character that shoots a bullet, that hits a character thus triggering the event any damage. The Damage Causer is the bullet. The instigator is the controller that shot - assuming you passed that controller reference into the instigator when you spawned the bullet.
If you want to give the killer +1 to kills and a lootbox, then you want to use the instigator.
So, let’s look at what you’re doing here. You’re taking what I assume is the instigator, and… call the death function? that does not make sense. You would want to run the death function on the actor that was hit, ie this actor that has the event any damage. So the target should remain empty. Unless I’m missing something from your setup.
Now, about adding these pins to the event. Why? what are you doing with them? I mean, it works to pass a reference into a function, so you can do stuff with that reference. But it’s just sitting there empty, right? Just undo the actions done in that reply. As for the cast node, you’d have to show the full setup, I have no idea where that input is supposed to lead. Did you just add that cast node or was it there before?
Well, don’t wait for a reply from me for at least 9 hours.