I am trying to build a multiple player FPS game by editing the template FPS game given by Unreal Engine. But now, only server character can make damage to client character. And these are the related blueprint:
This is the projectile blueprint. Interface is used to determine whether the bullet hits another shooter. I have used Print String to find that the DealDamage function is run successfully.
Here is the function DealDamage.
The value of damage is larger than 0 after CalculateDamage.
Here is the event graph of the shooter when shooter is damaged. It works only when the shooter is controlled by server.
The Replication of Health is set to be RepNotify.
I have spent some days on watching some videos in YouTube. A video suggests to build a weapon blueprint and change the weapon owner of each character to the server. Is there some other ways to solve it?
The projectile is spawned by the character. Actually this part is done by the templete already so I do nothing more than saving the number buff of the character.
Who spawns the projectile though? Since the Client needs to ask the Server to spawn the projectile for him when he shoots does not really have anything to do with the weapon
Yup that is the problem then, the Client spawns the Projectile and the server has no idea it exists, as such no client can shoot the server or another client.
Thank Mopperl! I can now damage the server character by client character now!
However, I find another problem which is not directly related to it.
I use PrintString to ensure that the HP of server character is decreasing when I keep shooting to him using client character. But the HP Bar showed above the character does not update.