Is locally controlled returns false for listen server host
As said above, when i'm using Is locally controlled node, it returns false for listen server host, and it makes game unplayable for hosts, but each other client, connected to this server, works perfectly well. What can i do to make game playable for hosts? NOTE: using OR with is dedicated server+not is working bad, it makes game buggy for each player on the server.
asked Oct 08 '17 at 08:51 AM in Blueprint Scripting
Late-ish comment and it might not apply to how/when you're using it, but I just had this problem my project too. In my case, I have a radar collision capsule on my player. Whenever an object overlaps this capsule, it checks if that pawn is locally controlled and then does some checks to see if they should be added to an array to be displayed on my radar. I'm using locally controlled so only the player pawn has to bother with these checks and radar arrays (as of course, another players radar array doesn't matter to the player).
When I started the game, the host didn't have anything on his radar when he spawns in, but if he walks out of range then back in range of an object it displays on the radar. My client worked 100% fine though. After a bit of investigating, I found my host was returning that his pawn was not locally controlled, so for the first tick of the host's pawn being alive, the host believed he wasn't controlling it and therefore did not get anything from the Overlap events for my radar. So I thought "Ok, I'll just make a function that checks and adds anything in range to the radar and pop it in BeginPlay so after spawning in, he'll get the actors he's missing" but this doesn't make any difference.
Here's the issue: when the host spawns a pawn and possesses it, there seems to be a tick or 2 where, according to himself (host) he isn't possessing it, so any events or functions that would occur during those frames (like my BeginPlay or EventOverlap which also does a check when the actor is spawned) would not go through since I gate them behind this LocallyControlled check.
Fortunately in my Game Mode BP, after spawning a pawn for the player and having them posses it, I call a custom event called OnPawnSpawn. I just stuck in my quick radar check function in there and it worked fine for my host.
So I'm not sure how or when you're using yours, but from what I've gathered I have a feeling you're using it in a BeginPlay event or some other event that is called on the same frame as BeginPlay. If this is the case, you should be able to fix this by having a small delay after spawn. Like I said, for some reason the host can't seem to posses an actor on the same frame as it's spawn (I think). Thinking about it, you could also use OnPossessed too for this.
If you're getting False AFTER these frame 1-like events then unfortunately I'm not sure, unless of course you've made some silly mistake where you aren't even possessing your pawn. Double check your BPs/code if thats the case.
answered Jan 12 '18 at 02:36 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here