Who /What is the Owner? [COND_OwnerOnly]

Hey,

I thought I had finally understood everything concerning replication but unfortunaley I came across some big ambiguities…

My question concerns the “owner”-principle. When I have a City class, spawned on the server in the player controller, this player controller should be the owner, right? But, now, what happens when I spawn inside the city class another actor, and now the city class is the owner. What do I get now when I use COND_OwnerOnly?

I will describe my actual problem:

I have a city class that is spawned in an city-manager class that only exists in the gameState and replicated to clients. Therefore I pass a PlayerController pointer to set this controller as the owner of the city.
Now, this city spawns a nobleman-council class inside BeginPlay, and setting the instance of the nobleman-council to COND_OwnerOnly. The variables in the council also are all COND_OwnerOnly. But who is now the owner of the council? I mean, actually the city. But it’s the same game-instance… It’s like replicate from server only to server?! So my “owning” client doesn’t get the data, but when I set replicate freely to all, everyone gets it. How can I get to just replicate to the original player-controller? I tried to make the controller itself the owner with spawnParams, but this didn’t change a thing… :frowning:

Okay, I just - after three months of doing just server-internal stuff - forgot that I have to set bReplicated = true. But the question still remais… What is the “owner?” Always the backtraced PlayerController? Or what would it mean If the owner is not a client-object and itself is spawned on the server.

Hey, while I think you are mostly interested in who is the default owner, have you experimented with changing the owner using AActor::SetOwner()? You can use that to set the owner to whichever player controller you want. I do this in a game with vehicles so that whichever player enters the vehicle becomes the owner of that vehicle, so that he can send server RPCs while he is in the vehicle.

Thanks, I will try that :slight_smile: