How do I Multiplayer Global variable sync

0 favourites
  • 3 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hi all,

    I need some help about multiplayer object.

    I would like to know the best way to make that each peer know his connected number: for exemple host is player: 1, the first peer logged is player: 2, the second peer is player: 3..., and put this value on a instance variable.

    I don't find an inbuild variable which cover this.

    So, I think create a global variable (integer) and send it from host to peer with "send message" function is a good way.

    What do you think?

    Is it possible to send an integer in "send message" fonction?

    What I've test:

    In the host block, On trigger "on peer connected", I use a multiplayer object with "send to peer" fonction (tag=toto), I send the int value of the global variable.

    In the peer block, On the trigger "on peer message "toto", I affect the instance variable with multiplayer.message. witch must contain global variable value.

    Then the instance variable receive a "nan" value... iven if I force the global variable with STR function before sending.

    Thanks for your help.

    Regards

  • Use the system expression int(Multiplayer.message)

    With int() you can convert a string to an int.

    And with str() you can convert an int to a string.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thx for your reply,

    So no "multiplayer" variable that coud be use to simplify that?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)