Replication conditions per client

I find it very frustrating that the replication condition block is unable to consider which client we’re replicating for when deciding if variables should be replicated.

Example: I’m implementing a overhead interactive map. I want to replicate the location of all players that are on the same team as client I’m replicating to.

We essentially have to set the same flat rules for all clients (even if they’re not on the same team, or they are very far from the player).

What I want to be able to do is something like this:



replication
{
    if (bNetDirty && WithinRangeFromClient(10000))
        Location, Rotation;
}


But as far as I can tell there is no way to access a reference to the player I’m replicating to in the replication block.

Any ideas if there is a way?

Well it’s going to replicate as long as the variable it’s set to a different value so, the condition goes into another block… no?

when the var changes have it set a var on each player on that team. Then when that Var replicates it will be only for the ones on that team. In the replicationEvent function try something like this. This is just an example but that would play for just team 0. it would not replicate to any one on team 1.
So team 1 would not run the function.


 simulated event ReplicatedEvent(name VarName)
{    
  if(VarName == 'PlayersTeamIndex')
  {      
    if(PlayersTeamIndex == 0)      
    {        
      SetTheTeam(PlayersTeamIndex);      
    }    
  }        
  Super.ReplicatedEvent(VarName);  
} 

Hope this helps