Can't apply damage to players over a Network
I have a problem, I am trying to create a simple SMG type of gun. Using a Line Trace by Channel, I managed to hit a player and cast it to a MyCharacter. If the cast works, then I spawn aExplosion emitter, just to see visually if I am hitting the player. Then i use a Apply Damage Node.
The blueprint for the first paragraph.
Then, I do the following to apply the damage to a player. It checks if the current value is 0, if it is not, then it can apply the damage and change the Health variable I have created. Blueprint.
When I test this, it behaves wrong. For example, if I use the second player. And I hit the first dude. Nothing happens, the explosion happens, but the damage ain't applied.
But if I use the first dude, then it does the damage to itself!
Please, let me know how I can do this correctly! Thanks!
asked Dec 03 '14 at 04:51 PM in Blueprint Scripting
I got it working. Note! This might not be cheat proof.
The problem is that ApplyDamage works/runs only on the server. So I made a function the following changes. The client tells the server he hit a player!
The custom function replicates to Run on a server.
Then, the apply damage manages the hitting stuff
answered Dec 05 '14 at 05:17 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here