Multiplayer object, HOST issue

Get help using Construct 2

Post » Fri Sep 26, 2014 1:07 am

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 do not have the required permissions to view the files attached to this post.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Fri Sep 26, 2014 1:52 am

I think your problem is that max peers must be above 0
B
8
S
2
Posts: 134
Reputation: 1,001

Post » Fri Sep 26, 2014 2:04 am

Tylermon wrote: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
B
10
S
2
G
1
Posts: 92
Reputation: 926

Post » Fri Sep 26, 2014 2:35 am

tomsstudio wrote:
Tylermon wrote: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.
B
28
S
8
G
1
Posts: 226
Reputation: 2,865

Post » Fri Sep 26, 2014 2:47 am

But that's a Trigger, which only gets called when the state occurs, it is not executed in event-order.
ImageImageImage
B
71
S
21
G
231
Posts: 3,688
Reputation: 129,352


Return to How do I....?

Who is online

Users browsing this forum: David181, namaewayukidesu and 12 guests