Hey all,
So, I’m getting in a tangled mess and going round and round in circles here…
I wanted to set two different pawns for players 1 and 2.
I set the game mode to not use a default pawn. I was unable to set the default player controller to “none”, so left it pointing to my base class.
When the game starts I have a function which performs three steps. First, its removes the player with the player index 0 - I assumed this would be the default one created by the base class.
Next, it creates player 1 using the Create Player node. I spawn a pawn, possess it with the just created controller.
I then repeat that step for player 2.
Initially I was setting the “Player Index” values to 0, and 1 respectively.
I’ve just ran into some difficulties and whilst diagnosing them it seemed that current controller doesn’t have a pawn reference - yet I am clearly able to move it around on the screen.
After more digging it would seem that I have more player controllers than I expected. I changed the player indexes from 0 and 1 to both be -1 so that it would auto-increment the numbers. Whilst outputting via a print node, I get a controller 3!
I am calling the creation of my players in my GameMode, my understanding is that this is created each time a level loads. So, on my menu, these are created unnecessarily. Then, when the player clicks “Play”, the main menu level is scrubbed, the GameMode is destroyed, the playable level loads, with a new GameMode and thus the players are created again.
Assuming my assumption above is correct - how am ending up with more player controllers than two?
Does the CreatePlayer node create persistent players in the game?
I’m getting really tangled up on this and its so frustrating, all I’m trying to do is have two players in a game which take it in turns to play when the other dies, but I can’t seem to get anywhere near that part due to all these other problems
Thanks in advance for any help. (I did try UE4 docs, but, well, you know… sparse)