austinchambers / multiplayer-vr

A multiplayer VR game
1 stars 2 forks source link

Null reference exception in network game while attempting to get player controller in BP_Sub #93

Closed austinchambers closed 9 years ago

austinchambers commented 9 years ago

Getting a null reference error from GetMyPlayerController in BP_Sub. Presumably this is due to the fact that PCs for other players can't exist on the client.

austinchambers commented 9 years ago

This was due to the fact that player controllers aren't available on client machines. Instead, we leveraged the new PlayerState class to handle everything for us.

Here's what I did:

  1. Added IncrementKills and IncrementDeaths to PlayerState class.
  2. On the server side, I got the instigator controller for the death (a parameter) and used it to get the corresponding player state. Since we're server-side, I simply incremented the kills via new functions. image 3, After we reward the killer with points, we use Player State variable available for all pawns. the available functions for the current pawn. We can call this function later when there's death-by-suicide/accident. image
  3. Removed "Get VR Player State" and "Get My Player Controller" functions. These aren't needed anymore.