How can I apply damage to my player character? And sync value across players
The whole answer can be found below.
Try Our
Documentation
Please check if you can find an answer in our extensive documentation on PUN.
Join Us
on Discord
Meet and talk to our staff and the entire Photon-Community via Discord.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
How can I apply damage to my player character? And sync value across players
Supran
2020-07-28 13:27:03
I am trying to develop a small multiplayer game. I have a bomb script and every time player hits the bomb button, a bomb is instantiated and exploded after the timer is up. I applied a overlapping sphear to get players in effecting area.. And the players in the area are getting the bombs explosion effect as in getting force from explosion. All works fine expect my damage script. Once a player is damaged all players get that damage. I tried making health an observable component. But all coming up with errors.
How would you approach this problem
Comments
Judgecrome
2021-01-01 10:28:08
PhotonView pht = collision.gameObject.getComponent
pht.RPC("TakeDamage",RpcTarget.AllBuffered,25);
[PunRPC]
void TakeDamage(int damage)
{
health-=damage;
}
you can do this like that
Take a look at this Example.
https://github.com/SradnickDev/Photon-Misc#basic-health--shooting