0 Favourites

Multiplayer object, HOST issue

  • I have an event set to destroy an object on the layout if not the host.

    My problem is, the game never thinks I am the host.

    I dont know if others have had this issue before or not. but I am stuck here.

    As the code is, the player gets destroyed when this should not be happening.

  • I think your problem is that max peers must be above 0

  • I have an event set to destroy an object on the layout if not the host.

    My problem is, the game never thinks I am the host.

    I dont know if others have had this issue before or not. but I am stuck here.

    As the code is, the player gets destroyed when this should not be happening.

    You are calling the multiplayer.host check before multiplayer can connect.

    So even before it can join the room, its realising its not the host because its not connected, so it destroys the player.

    You need to have,

    on.multiplayer.joined.room

    is host : Associate player with multiplayer.peerid

    Else

    <invert>is host</invert> player.destroy

    Hope this helps,

    Tom

  • > I have an event set to destroy an object on the layout if not the host.

    >

    > My problem is, the game never thinks I am the host.

    > I dont know if others have had this issue before or not. but I am stuck here.

    >

    > As the code is, the player gets destroyed when this should not be happening.

    >

    You are calling the multiplayer.host check before multiplayer can connect.

    So even before it can join the room, its realising its not the host because its not connected, so it destroys the player.

    You need to have,

    on.multiplayer.joined.room

    is host : Associate player with multiplayer.peerid

    Else

    <invert>is host</invert> player.destroy

    Hope this helps,

    Tom

    That fixed it! thank you.

    I didnt think I needed that because I had it below the code that actually joins a room.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • But that's a Trigger, which only gets called when the state occurs, it is not executed in event-order.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
300 118,415
blackhornet's avatar
blackhornet
Unread hot topic
224 49,503
ThePhotons's avatar
ThePhotons
Unread hot topic
0 Favourites
Spam issue
201 16,831
Tom's avatar
Tom Construct Team Founder