You are actually right. I was mistaken.
I used the Multiplayer object in many games, but never encountered this issue...
Anyways, let's solve this with the host then.
If you want to message a peer, you will need to add his ID to the message you are sending to let the host know who has to receive the message.
There are multiple ways to do this:
Option 1 | Adding the ID to the message:
Add the ID after the message and separate them with escaping character.
The host would then need to parse that message (e.g. with Regex) and send the appropriate message to the peer.
This could look like this:
Peer who wants to PM:
Send message "pm": [message] & "//" & [recipientID] (to host)[/code:16mfd0o6]
[b]Host:[/b]
The host needs to parse the message.
[code:16mfd0o6]On peer message "pm":
--- Send message {
----------- Peer ID: RegexMatchAt(Multiplayer.Message, "\d+\D+\/{2}(\d+\D+)","",0)
----------- Message: RegexMatchAt(Multiplayer.Message, "(\d+\D+)\/{2}\d+\D+","",0)
--- }[/code:16mfd0o6]
(I won't explain Regex to you, there are many tutorials out there, if you want to learn it. If you don't want to learn it or dislike Regex in general, see Option 2)
[u]Option 2, using a Dictionary[/u]
This option uses a simple 2-key dictionary that contains the recipient's ID and the message in two separate keys.
The peer will send this dictionary as JSON to the host who will then load the JSON into his own dictionary to easily parse its contents to send the PM.
This could look like this:
[b]Peer who wants to PM:[/b]
[code:16mfd0o6]Dictionary "pm": Clear
Dictionary "pm" : Add key "ID" with value "[recipientID]"
Dictionary "pm": Add key "msg" with value "[message]"
Send message tag "pm" with content [Dictionary]pm.AsJSON (to host)[/code:16mfd0o6]
[b]Host:[/b]
[code:16mfd0o6]On message "pm":
-- Dictionary "pm": Load from JSON [Multiplayer.Message]
-- Send message {
-------- ID: [Dictionary]pm.Get("ID")
-------- Message: [Dictionary]pm.Get("msg")
-- }[/code:16mfd0o6]
___________________________________
I'm not 100% sure about the Regex method, it [i]should[/i] work though.
The dictionary method will definitely work, if executed correctly.