Hi, I’m using event any damage, and I am getting the “Instigated By” and then I “Get Controlled Pawn” and then I “Cast to (My Character)”. I’m trying to run something on the player who shot me, hence the casts. But when I do this, it only ever runs the code for the other character on the server, no matter who is shooting. What should I do?
show code? I don’t think you need to cast to my character (controller?). you can store and send Player ID, but id like to see what youre working with?
What do you mean store and send player Id?
Hi, “Event Any Damage” runs on the server only. If you want it to run something from that on a client you could use either a “Multicast” (runs on all clients) or “Run On Owning Client” Custom Event.
But wouldn’t multicast run that code on all of the clients then? I’m trying to do death hitmarkers, so fit I take damage, I run my death script, and then give them a red hitmarker, if i do multicast wouldn’t that give all of the clients hitmarkers?
“Multicast” runs on the damaged character on all clients (and server). So if you use a “Multicast” all clients (and server of course) would execute the code on the character that has been hit (so every client would see the death hitmarker). “Run On Owning Client” would execute the code only on the client that “owns” the actor (so only the client that has taken the damage would see the hitmarker all the other clients would not see it).
If for example you would have client_1, client_2, client_3 they control char_1, char_2, char_3, and the server calls a multicast from char_1, then all the clients would execute the code in char_1 (so if you would use something like “get actor location” for all clients that will be the position of char_1).