Identifying player, local multiplayer
This is really an xpost between blueprint and c++.
Our game has local split screen multiplayer (2,3 or 4). We have up to 4 characters (all the same character right now) in our game that upon colliding with collisionbox calls a function in our a custom game mode class, which inherits game mode.
What we would like to be able to do is to identify which controller number or viewport or something 1-4 or 0-3 so that we can say player 1 wins. We are looking for a way to access the controller ID but haven't been able to find one.
Our original attempt to circumvent not being able to find the controller ID was to save a reference of all of the PlayerControllers in an array then pass in the PlayerController associated with the triggering of the event then compare.
What we found doing this was that the playerController passed by the function either always finds a match (the same match regardless of the controller that caused function to be called) or it doesn't find one. IE. It always says player 1 wins or it doesn't find the player controller.
Ignoring the other strings on this blueprint (other failed attempts at fixing the problem), this is essentially how we are attempting to get the playerController that caused the event.
Does anyone know of a better way to identify which player caused the event? It really seems like controllerID is something that should be accessible to me but I've yet to find a way.
If you need any other information that may help you answer the question, please ask in a comment below.
asked Jul 08 '14 at 07:24 PM in C++ Programming
In the player state class there is a unique ID value that will help you
/** Unique id number. */ UPROPERTY(replicated) int32 PlayerId;
The controller ID is not part of UPlayer, it is in ULocalPlayer
so you must obtain a ULocalPlayer in order to access this value
It can be accessed from the Player Controller Class!
If you cannot find anyway to do this in BP (if you need to do it there), let me know and I can make a node for it
answered Jul 08 '14 at 09:26 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here