Announcement

Collapse
No announcement yet.

Get a unique Player ID over a multiplayer network. (Not Local)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Get a unique Player ID over a multiplayer network. (Not Local)

    So I was wondering if there was a way to give or get a unique ID to/from all the players connected to the server.

    I have this: (Concept)
    Click image for larger version

Name:	No5Le24.png
Views:	1
Size:	70.6 KB
ID:	1144375

    From what I understand though, "Player Index" only works with LOCAL multiplayer, and that is not my intention.

    So I was wondering if there was a way to get some sort of netID? Or something unique to the player when they connect? Or if I could create one in the construction of a player?

    #2
    Hi, yes gamemode has a gamestate that has an array of all the players gamestate connected to server. So you need to get the GameMode -> getGameState -> PlayerArray-> PlayerId. I think GameMode only exist on the server so be careful when you try to access it.

    Comment


      #3
      Thank you, that's great. Just what I was looking for really. Is there an event that happens when a new player is added to the PlayerArray? So I could put some of my own logic into it when that happens?
      Last edited by Winfree; 02-17-2015, 08:37 PM.

      Comment


        #4
        Click image for larger version

Name:	Networking3.PNG
Views:	1
Size:	97.0 KB
ID:	1066651

        Well I thought I had it, but all clients and the server is returning their playerID as 0. Then I get an error "Error Accessed None 'PlayerState' from node New Event Dispatcher 0 in blueprint FirstPersonCharacter" so it's receiving null for the playerstate?
        Last edited by Winfree; 02-17-2015, 09:46 PM.

        Comment


          #5
          You could assign a custom player ID whenever a new player joins. Player joins can be detected in the game mode blueprint server-side using a Event Post Login. It would look like this in your game mode blueprint:

          Click image for larger version

Name:	example.png
Views:	1
Size:	62.4 KB
ID:	1066665

          In this case my default controller class is ExampleController and I have given it a replicated int variable PlayerID.
          Journeyman's Minimap - Available on Marketplace - Forum topic - Video

          Comment


            #6
            ..check my comments here:
            https://answers.unrealengine.com/que...blueprint.html
            -= Katax Emperore =-
            www.kataxwork.com

            Comment

            Working...
            X