Problem with RPC's

Right. So I have projectile shooting in my game and its always been working. Recently, whenever shoot a player it calls the method to take damage twice. I think the reason for this is because of there being physics on both ends, and so on the hosts computer, it takes damage to the hit player, then it does it again for the client. How can i fix this?

Answers

  • You need to define which client calculates and announces the damage. It could be the shooting player's client or the hit one. Only one has to network-send the damage.
  • > @Tobias said:
    > You need to define which client calculates and announces the damage. It could be the shooting player's client or the hit one. Only one has to network-send the damage.

    It's the hit player that does it
  • If that's the case, there should only be one execution of the RPC (I assume you use an RPC).
    If not: Debug. In doubt, just log who's sending an RPC and why. Everything else is vague guessing.