Stop damage to self in multiplayer
Hello, I've set up my blueprints to replicate shooting, damage, etc in multiplayer. The damage/hit detect is determined using Sphere Overlap Actor and Apply Damage functions. This is all in a Projectile blueprint separate from MyCharacter. These features work fine.
However, I don't want my bullets to hurt myself. Everything I've tried has led to one of the players being invincible or both. Sphere Overlap Actors has an Actor to Ignore option, but it doesn't seem to work, since Get Player Character returns a static index, not the actual current character.
How do I go about making my projectile ignore its shooter? Is there a way to know which player character is which, and compare to see if the shooter of a projectile is the same as the one being hit?
asked Apr 26 '15 at 04:46 AM in Blueprint Scripting
Set in bullet reference to your character, and when bullet damages someone, check if your reference equals damaged character (if true don't make any damage)
answered Mar 04 '18 at 09:29 AM
hello, you could add a tag to your character and then maybe in the bullet's blueprint, add an ActorAsTag node, if what hits does not have that tag then it can affect health, you can also use it to specify the characters not to hurt in a multiplayer
answered Mar 04 '18 at 07:14 PM
I have a really bad solution, but it works to some degree. Wish someone would present an actual solution to this issue, because I really don't know how to handle figuring out who spawned the projectile because technically it's always the server.
Anyway, here's what I have.
I have my Character Blueprint which Spawns Weapon into the character's hand, and I cast to the weapon to say "Fire" and the Weapon Blueprint spawns a Projectile Blueprint. So basically, Character > Weapon > Projectile.
What I did to prevent from shooting myself, but still being able to deal friendly fire damage, was this:
This is a really jank solution, but it's all I could come up with.
There are 2 major issues.
Follow this question
Once you sign in you will be able to subscribe for any updates here