# Getting the owner of an actor \[multiplayer\]

**URL:** <https://forums.unrealengine.com/t/getting-the-owner-of-an-actor-multiplayer/317443>\
**Category:** Multiplayer & Networking\
**Tags:** authority, owner, box-trigger, unreal-engine, Multiplayer, question\
**Created:** [May 4, 2015, 10:07pm UTC](https://forums.unrealengine.com/t/getting-the-owner-of-an-actor-multiplayer/317443 "2015-05-04T22:07:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shgs\_sls\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shgs\_sls\_1](https://forums.unrealengine.com/u/shgs_sls_1)\
**Post date:** [May 4, 2015, 10:07pm UTC](https://forums.unrealengine.com/t/getting-the-owner-of-an-actor-multiplayer/317443/1 "2015-05-04T22:07:21Z")

</div>

I’ve got two players in multiplayer, one server, one client.

I’m trying to get the owner of the AActor parameter from the boxTrigger in the level but have only been met with failure.

The onActorBeginOverlap event occurs twice for one overlap made by the client. Once on the server, and once on the client. GetOwner doesn’t really seem to work, and using HasAuthority with the Actor param does the same exact thing as the sequential hasAuthority. When a client triggers the event how do I either

A) keep the same event from triggering on the server,

or

B) determine who owns the AActor that is overlapping with the boxTrigger.

Essentially I only want the server to do x, y, and z once, when the server’s character overlaps with the boxTrigger. I don’t want the server to do anything when the client’s character overlaps. So I must be able to determine who controls which character.

Is this making sense?

I’ve used getOwner-\>getDisplayName but it’s just an empty char in a string.

I’ve also used getOwner-\>hasAuthority(AActor owner) and it always returns false.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_624ad6e91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_624ad6e91](https://forums.unrealengine.com/u/anonymous_user_624ad6e91)\
**Post date:** [May 15, 2015, 2:31pm UTC](https://forums.unrealengine.com/t/getting-the-owner-of-an-actor-multiplayer/317443/2 "2015-05-15T14:31:09Z")

</div>

Did you try using SetOwner after initializing the actor?

---

<div class="post-metadata">

**Author:** ![shgs\_sls\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shgs\_sls\_1](https://forums.unrealengine.com/u/shgs_sls_1)\
**Post date:** [May 19, 2015, 4:58pm UTC](https://forums.unrealengine.com/t/getting-the-owner-of-an-actor-multiplayer/317443/3 "2015-05-19T16:58:00Z")

</div>

I ended up getting the actor parameter from the overlap event and casting it to my character class. I then compare the character from the event, and the character from getCharacter at index 0. This checks to see if the overlapping actor is the local player’s character.

This works on nondedicated multiplayer games.

Thanks Venros!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_624ad6e91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_624ad6e91](https://forums.unrealengine.com/u/anonymous_user_624ad6e91)\
**Post date:** [May 19, 2015, 5:56pm UTC](https://forums.unrealengine.com/t/getting-the-owner-of-an-actor-multiplayer/317443/4 "2015-05-19T17:56:07Z")

</div>

this works under dedicated server with 2 players?

---

<div class="post-metadata">

**Author:** ![shgs\_sls\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@shgs\_sls\_1](https://forums.unrealengine.com/u/shgs_sls_1)\
**Post date:** [May 22, 2015, 6:38pm UTC](https://forums.unrealengine.com/t/getting-the-owner-of-an-actor-multiplayer/317443/5 "2015-05-22T18:38:35Z")

</div>

Yes, and no. I’ve got some weird stuff going on that prevents casting from happening. You might not run into my error depending on what else you do with your blueprints.

Also there happens to also be a function called isLocallyControlled

> **[APawn::IsLocallyControlled](https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/GameFramework/APawn/IsLocallyControlled/)**
>
> Returns true if controlled by a local (not network) Controller.

eXi just showed it to me.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_624ad6e91](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_624ad6e91](https://forums.unrealengine.com/u/anonymous_user_624ad6e91)\
**Post date:** [May 23, 2015, 7:14pm UTC](https://forums.unrealengine.com/t/getting-the-owner-of-an-actor-multiplayer/317443/6 "2015-05-23T19:14:28Z")

</div>

IsLocallyControlled under 2 clients on a dedicated server doesnt work. So basically if a person launches 2 copies of your game on one machine, it will cause major issues. You can test this by running 2 clients on a dedicated server.
