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.
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.
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
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.