[Photon iOS] Send (opRaiseEvent) to certain actors?
Options
Hello,
Just started using Photon realtime iOS platform. I have a quick question for sending events to certain (targeted) actors.
For Unity: (http://doc-api.exitgames.com/en/pun/cur ... a792146e50)
You can pass "TargetActors" (of int [] type) in RaiseEventOptions
For .NET: (http://doc-api.exitgames.com/en/chat/cu ... _peer.html)
Similarly, you can add in target actors in opRaiseEvent function.
However, for iOS: (http://doc-api.exitgames.com/en/onpremi ... t/cpp/doc/)
Only has these 3:
opRaiseEvent (bool reliable, Ftype parameters, nByte eventCode, nByte channelID=0, nByte eventCaching=Lite::EventCache::DO_NOT_CACHE, const int *targetPlayers=NULL, short numTargetPlayers=0, nByte receiverGroup=Lite::ReceiverGroup::OTHERS, nByte interestGroup=0, bool forwardToWebhook=false, int cacheSliceIndex=0)
opRaiseEvent (bool reliable, Ftype pParameterArray, typename Common::Helpers::ArrayLengthType< Ftype >::type arrSize, nByte eventCode, nByte channelID=0, nByte eventCaching=Lite::EventCache::DO_NOT_CACHE, const int *targetPlayers=NULL, short numTargetPlayers=0, nByte receiverGroup=Lite::ReceiverGroup::OTHERS, nByte interestGroup=0, bool forwardToWebhook=false, int cacheSliceIndex=0)
opRaiseEvent (bool reliable, Ftype pParameterArray, const short *pArrSizes, nByte eventCode, nByte channelID=0, nByte eventCaching=Lite::EventCache::DO_NOT_CACHE, const int *targetPlayers=NULL, short numTargetPlayers=0, nByte receiverGroup=Lite::ReceiverGroup::OTHERS, nByte interestGroup=0, bool forwardToWebhook=false, int cacheSliceIndex=0)
My question is, how do I add the target actors for custom events (opRaiseEvents)? Please advice.
Thanks.
Just started using Photon realtime iOS platform. I have a quick question for sending events to certain (targeted) actors.
For Unity: (http://doc-api.exitgames.com/en/pun/cur ... a792146e50)
You can pass "TargetActors" (of int [] type) in RaiseEventOptions
For .NET: (http://doc-api.exitgames.com/en/chat/cu ... _peer.html)
Similarly, you can add in target actors in opRaiseEvent function.
However, for iOS: (http://doc-api.exitgames.com/en/onpremi ... t/cpp/doc/)
Only has these 3:
opRaiseEvent (bool reliable, Ftype parameters, nByte eventCode, nByte channelID=0, nByte eventCaching=Lite::EventCache::DO_NOT_CACHE, const int *targetPlayers=NULL, short numTargetPlayers=0, nByte receiverGroup=Lite::ReceiverGroup::OTHERS, nByte interestGroup=0, bool forwardToWebhook=false, int cacheSliceIndex=0)
opRaiseEvent (bool reliable, Ftype pParameterArray, typename Common::Helpers::ArrayLengthType< Ftype >::type arrSize, nByte eventCode, nByte channelID=0, nByte eventCaching=Lite::EventCache::DO_NOT_CACHE, const int *targetPlayers=NULL, short numTargetPlayers=0, nByte receiverGroup=Lite::ReceiverGroup::OTHERS, nByte interestGroup=0, bool forwardToWebhook=false, int cacheSliceIndex=0)
opRaiseEvent (bool reliable, Ftype pParameterArray, const short *pArrSizes, nByte eventCode, nByte channelID=0, nByte eventCaching=Lite::EventCache::DO_NOT_CACHE, const int *targetPlayers=NULL, short numTargetPlayers=0, nByte receiverGroup=Lite::ReceiverGroup::OTHERS, nByte interestGroup=0, bool forwardToWebhook=false, int cacheSliceIndex=0)
My question is, how do I add the target actors for custom events (opRaiseEvents)? Please advice.
Thanks.
0
Comments
-
Hi ssrobin.
Just pass them as parameter targetPlayers, please.0 -
Hi Kaiserludi,
Thanks for the prompt responses. I must have overlooked the "targetPlayers".
Lets say, I want to send to player number 3. I just need to pass:
targetPlayers = 3
numTargetPlayers = 1
is that correct?
How about I want to send to 3 players, lets say player number 1,3,5. Must I call the opRaiseEvent 3 times?0 -
targetPlayers is an array. That's why numTargetPlayers exists, which would make very little sense, if one would always pass in 1 there.
If you want to send a message to just player no. 3 and no one else, while using the default values for every other option, then you would do it like this:
[code2=cpp]int targetPlayer = 3;
mLoadBalancingClient.opRaiseEvent(reliabilityFlag, message, 0, 0, ExitGames::Lite::EventCache::DO_NOT_CACHE, &targetPlayer, 1);[/code2]
For 3 players 1, 3 and 5 that code would look like this:
[code2=cpp]int targetPlayers[3];
targetPlayers[0] = 1;
targetPlayers[1] = 3;
targetPlayers[2] = 5;
mLoadBalancingClient.opRaiseEvent(reliabilityFlag, message, 0, 0, ExitGames::Lite::EventCache::DO_NOT_CACHE, targetPlayers, 3);[/code2]0 -
Thanks for the clarification.0