Multiplayer object, HOST issue

0 favourites
  • 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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)