Hey guys, I have a health and damage system set up where people can kill each other online. However, now im trying to implement a way to add scoring to it. I already know how to add a death point to the scoreboard when a player dies but I don’t know how to add a point or even make a score for a kill. I believe the reason is that I don’t know a way to find out “WHO” killed the person. Please help someone, and the killing is done via raycast> thanks
In a simple implementation, the player who did the kill (and raycast) could send a RPC “i killed X”, where X is a PhotonPlayer.ID. You only need to send who you killed, because you can add a parameter to your RPC method to find out who sent the RPC. This would be a PhotonMessageInfo. It’s described here:
http://doc-api.exitgames.com/en/pun/current/pun/doc/general.html#rpcManual
You can find a player by ID easily and you can keep track of scores per player with the IDs, too.
Take a look at the Demo “Pickup, Team, Scores” in the PUN package. The Scores part might be interesting. We store them per player in Custom Properties, if I recall correctly.