x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

show mouse cursor enable on clients [multiplayer]

hey guys. i've been looking around for long time now and i can't find a similar question or explanation about this topic. i try to give you a simple look into my situation.

problem: what i'm trying to do is to enable show mouse cursor when possessing a pawn. that works perfectly for the server but not for the clients. the cursor won't show on the clients.

what am i doing: i do have a playercharacter which enters a triggerbox to possess a new pawn. with the possession event i cast the playercontroller to enable the mouse cursor. for the server it shows, for the clients not.

the possession and the cast are properly set up (target and everything is set, i tried/watched/red alot about similar problems and i'm aware of the default input processing procedure).

so what am i missing? i know that the playercontroller is not replicated to the clients, so do i have a problem with that? do i need to bring that info back down to the clients?

i'm happy for every thoughts you got, really desperate looking for some hints... thanks alot in advance for thinking about it. just let me know if you need more info, because i haven't found any similar topics about that problem..

greetz alain

Product Version: UE 4.12
Tags:
more ▼

asked Sep 30 '16 at 11:37 AM in Blueprint Scripting

avatar image

Allen2k
1 1 1

avatar image jonahn2 Mar 25 '17 at 05:53 PM

Im having the same issue. My server has a mouse and works fine, but the client wont show it.

avatar image jonahn2 Mar 25 '17 at 06:42 PM

alt text I think Ive found part of the problem. When I set my show mouse cursor it still being run by the server even though I am in the clients "Spaceship." See how it always says server. Any idea how to make that run on the actual client?

capture.png (7.4 kB)
avatar image vanlacke Mar 25 '17 at 06:44 PM

Can you show your BP

avatar image jonahn2 Mar 25 '17 at 07:40 PM

Sure I also made a really quick video https://youtu.be/K-ppcee7lxE

avatar image jonahn2 Mar 25 '17 at 07:43 PM

I guess my question is where should I set the show mouse cursor. The level blueprint appears to run on both Server and client. Is this correct?

avatar image jonahn2 Mar 25 '17 at 07:44 PM

alt text

capture.png (54.2 kB)
avatar image vanlacke Mar 25 '17 at 07:44 PM

Thanks. The first frame of the video showed the problem x)

I'll post an answer to explain

avatar image jonahn2 Mar 25 '17 at 07:44 PM

You are awesome! thanks:)

avatar image vanlacke Mar 25 '17 at 07:58 PM

lmao I just realized you're not OP. Oh well, the answer is for you and not him !

The answer may work for him tho, hopefully

avatar image jonahn2 Mar 25 '17 at 07:59 PM

lol I know! I would totally mark it answered it I could.

avatar image vanlacke Mar 25 '17 at 08:05 PM

yeah I just want muh karma

LMK if you're still having issues though

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

To show the mouse cursor, you're using "Get Player Controller", with the index set to 0. That works fine in a single player game where the player is alone, which means he's 0, the first index.

In multiplayer however, the SERVER is always 0 - the first "player". In a multiplayer game you should never use "Get Player Controller", and instead reference certain controllers directly. In your case, you can simply set the index to 1, and client1 will have their mouse shown, however this is bad practice, UNLESS you will only ever have 2 players, server and client1.

Finally, the reason your print was showing "correctly", server and client1, is because the both the server and clients have their own instance for basically everything, EXCEPT the playercontroller, where only ONE exists per player. This is super important to understand when coding for multiplayer.. So, the print fires once for the server using its instance, and once for the client.

P.S. cool looking game.

more ▼

answered Mar 25 '17 at 07:52 PM

avatar image

vanlacke
1.5k 65 132 103

avatar image jonahn2 Mar 25 '17 at 07:57 PM

Thank you so much! You are a life saver. Totally makes sense. Would you happen to have a suggestion of where to set the "Show Mouse" that doesn't use either get controller and is not bad practice?

avatar image vanlacke Mar 25 '17 at 08:01 PM

I'd do it in the player controller BP

Actually, I DO do it there:

alt text

_4.png (22.2 kB)
avatar image jonahn2 Mar 25 '17 at 08:12 PM

Ok this was where I had it before so I must be doing something wrong. Sorry to keep bugging you. This is what I had before alt text The event gets called by my gamemode BP once post login. Even doing what you show with a key event doesnt seem to get it to work(it does work on the server) alt text

capture.png (114.0 kB)
capture.png (22.8 kB)
avatar image jonahn2 Mar 25 '17 at 08:13 PM

I was doing both of these in my player controller BP

avatar image vanlacke Mar 25 '17 at 08:19 PM

"SpaceshipCaptain" is your player controller?

I can help out quicker if you'd like on discord or some other chat. Not a big fan of extended discussion on the answerhub comment section ya know

avatar image jonahn2 Mar 25 '17 at 08:21 PM

Yessir. It Extends the PlayerController class

avatar image vanlacke Mar 25 '17 at 08:29 PM

Not sure my last comment got posted. Have you tried setting the index of Get Player Controller to 1 to see if that works as expected?

avatar image jonahn2 Mar 25 '17 at 08:38 PM

Oh shoot. Somehow missed the last one. Let me PM you with a discord number

avatar image jonahn2 Mar 25 '17 at 08:40 PM

Just kidding. Heres a link https://discord.gg/Nu6jR

avatar image jonahn2 Mar 25 '17 at 09:57 PM

Issue was a special widget I had created to show the power of the ship. This needed not to be keyed off of "get player pawn" but "get owning Pawn"

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question