[Multiplayer Plugin] - Peer Object Spawning.

Get help using Construct 2

Post » Sun Jan 29, 2017 5:17 pm

I'm pretty decent at the Multiplayer Plugin and what I'm trying to figure out if how do we have the host spawn an object on a peers behalf that holds three different values.

The peer needs to drag and drop an item from a list.

That item holds two values, ID and AMOUNT.

The peer needs to tell the host which peer is dropping the item because the item is spawning on top of that peer's character.

I know I can send a message to the host telling the host which item to spawn but how do I tell it to spawn an object with the values ID and AMOUNT as well as which peer is dropping the item?
B
23
S
8
Posts: 115
Reputation: 2,640

Post » Sun Jan 29, 2017 6:51 pm

With a proper authoritative host set up, the only thing a peer should be sending to the host is their inputs, and the host already has all the data values to begin with.

But since that isn't the approach you are using, the only things I can suggest is:

a. Send multiple messages with different tags containing different information.

b. Send a single message using a token to sperate different information, and on the host side parse it back out with the tokenat() expression. You can use the & operator to combine strings when building your message.

As for identifying who sent the message, that should have been covered in the multiplayer tutorials. In an event with the "on peer message" condition, you can get the peerid of the originator with the "fromID" expression.
Mistakes were made.
B
52
S
26
G
108
Posts: 1,606
Reputation: 61,133

Post » Mon Jan 30, 2017 2:49 am

oosyrag wrote:With a proper authoritative host set up, the only thing a peer should be sending to the host is their inputs, and the host already has all the data values to begin with.

But since that isn't the approach you are using, the only things I can suggest is:

a. Send multiple messages with different tags containing different information.

b. Send a single message using a token to sperate different information, and on the host side parse it back out with the tokenat() expression. You can use the & operator to combine strings when building your message.

As for identifying who sent the message, that should have been covered in the multiplayer tutorials. In an event with the "on peer message" condition, you can get the peerid of the originator with the "fromID" expression.

Really interesting stuff here thanks.
B
23
S
8
Posts: 115
Reputation: 2,640


Return to How do I....?

Who is online

Users browsing this forum: KTML5 and 25 guests