How to deal with "on peer connected"-conditions on more than one layout

  • I am using the "ghost shooter" multiplayer example and added a layout in between 2 existing layouts as a lobby.

    Layout 1: enter your name.
    Layout 2: lobby to chat
    Layout 3: play the game
    

    When I include layout 2 (chat lobby), some conditions on layout 3 (game) do not work anymore.

    For example "on peer connected" is not triggered on layout 3, because they already connected on layout 2. I think.

    Do you have advice, based on my explanation and attempts below?

    Here are 3 attempts at an example in the "Host Group" where I am trying to find the right condition to replace "on peer connected" with:

    Attempt 1 (My preferred way, but this condition is not triggered)

    on peer connected:

    create object player

    set peerid to multiplayer.peerid

    associate player with peer multiplayer.peerid

    Attempt 2 (this condition is triggered, but if a 3rd player joins it (obviously) does not trigger anymore)

    trigger once:

    create object player

    set peerid to multiplayer.peerid

    associate player with peer multiplayer.peerid

    Attempt 3 (this condition is triggered, but I think without the proper picking)

    trigger once

    Repeat Multiplayer.PeerCount-1 times:

    create object player

    set peerid to multiplayer.peerid

    associate player with peer multiplayer.peerid

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)