text: 11-08-2014, 02:53 AM
  I have a Blueprint setup that is not dealing damage to the player when client is shooting the server. Obviously...Server can deal damage to client. What i have right now is Character Blueprint that calls a Run On Server Event on my Weapon_Master class. That event calls another event which does a line trace to check for player and deal damage. Here is the setup:
  Last edited by ryanjon2040; 11-27-2014, 02:37 AM. Reason: Big Thanks to Omar007! See post #14
  I think your "Weapon_Master (Fire Weapon event)" should be run on the server only - the client cannot be trusted to perform hit calculations. I would also just call the "Apply Damage" function if a target is hit rather than just subtracting from health.
  I think your "Weapon_Master (Fire Weapon event)" should be run on the server only - the client cannot be trusted to perform hit calculations.
  I would also just call the "Apply Damage" function if a target is hit rather than just subtracting from health.
  And see this. You can see the TakeDamage event is called with proper damage value. But still...server doesnt get any damage.
  EDIT: I've posted this on Answerhub too.
  Last edited by ryanjon2040; 11-13-2014, 05:57 AM. Reason: Added answerhub link
  The built-in "Any Damage" event is authority only, so it will never run on the client. This is OK though, generally the server should be the only one that actually applies damage to characters, and the clients can find out about the health change if the health value is replicated. If you'd like clients to react to the health change, perhaps to play an animation or sound, one option is to set the health variable's replication to RepNotify. This will create a corresponding On Rep function that will be called automatically when the server changes the value.
  As you said the Any Damage is authority function only. So shouldn't this workflow work:
  Yes, that should work. However if the "Base damage" value passed in to Apply Damage is 0, Any Damage will be skipped. Also double check that "Can be damaged" is set to true for your character.
  The Server replicated event only executes on the server if the client that calls the function is the Owner. In my case, the weapon owner was NULL (I spawned the weapon in my pawn's Begin Play event) and thus the event never executed on the server.
  To solve this I had to wrap the SetOwner() function in a blueprint callable function as the SetOwner() function is not exposed to blueprints.. But even before that, I would expect SpawnActor to set the value of Owner to the same value as Instigator tbh. Or at least supply an optional Owner parameter.
  Last edited by Omar007; 11-21-2014, 08:48 AM.
  Well it doesnt work unfortunately. As i showed in the picture "Base Damage" value is not 0 (I've even set the variable to replicated) and made sure with print strings the value is not 0 and its not. I am sure its something bad on my side but still cant figure out why.
  In this function check if I'm the server and if I am, I spawn the weapon actor (this actor replicates) and store it in the character's Weapon variable (variable replicates).
  I then set the owner of the weapon to the character (as I call the weapon's firing/reload functions from my character). Lastly I attach it to the weapon attachment point.