playMaker

Author Topic: [PUN 2] Sync the health info on joined  (Read 1279 times)

Bipolar

  • Junior Playmaker
  • **
  • Posts: 68
[PUN 2] Sync the health info on joined
« on: February 23, 2020, 09:58:59 AM »
Hi.

I'm using PUN 2 recently.

I've made a health system. The problem is when another player joins the room after somebody inflicted/received damage: for the latest player joined, the other players' health will result as 0.

I need then to "download" an set the health info from the new player's point of view.

But perhaps... I'm on the wrong road because I'm not using RPC events to set health, but 'IsMine' check.

The fact is I tried to set health with RPCs but in the case of mine the changes are global: if I shoot the opponent, also the sender's life will be modified.

I tried with Other Buffered but It doesn't work anyway.

Here the screen of players' health modifiers.
I presume here misses something or it is not the best method...

Any idea?





jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [PUN 2] Sync the health info on joined
« Reply #1 on: February 24, 2020, 03:24:39 AM »
Hi,

 where do you set the health value for it to be synched over the network? you should have a variable set to network sync and then set that variable if "isMine" is true or get that variable if "isMine" is false

Bye,

 Jean

Bipolar

  • Junior Playmaker
  • **
  • Posts: 68
Re: [PUN 2] Sync the health info on joined (SOLVED)
« Reply #2 on: February 24, 2020, 11:35:01 AM »
Hi,

 where do you set the health value for it to be synched over the network? you should have a variable set to network sync and then set that variable if "isMine" is true or get that variable if "isMine" is false

Bye,

 Jean

Hi.
The problem was solved just yesterday after 3 days of trial-and-errors.
I posted here on the forum because after 3 days I was giving up, but now everything was solved and I learned how to do it. Thank you. :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [PUN 2] Sync the health info on joined
« Reply #3 on: February 24, 2020, 12:10:04 PM »
Hi,

 what was it then?

Never give up :) there is always a solution!

Bye,

 Jean