Hi. I’m developing a turn-based 2-player game called Virtual Quarterback. I want Player 1 to go first, and throws a football downfield to hit targets for points. Then Player 2 has a turn. 5 throws per player, highest score after 5 turns wins. The challenge I’m running into is this: How can i pass control into the ball-throwing pawn when it’s that player’s turn? I’ve tried Set Control ID, I’ve tried the Possess nodes, but i always end up without alternating control of the pawn from Player 1 to Player 2. How can i effectively control this?
Some more info: I’m using a custom GameMode BP that controls an integer variable called Player Index. That swaps between 0 and 1 during the game. I was hoping to use that to communicate to other Blueprints which turn/player was valid at any given moment.
Is it possible to change the controller ID at run-time? It doesn’t work for me
Hey there @NickCortes1! Welcome back to the community! Possession should work locally in this use case, how was it failing? You may need to have the off turn player possess a spectator in the meantime to free up the pawn.
Hey Thanks for the reply. So currently, at game start, Player 1 and Player 2 pawns are both visible (i only want 1). Both pawns are also moveable with xbox controllers. When P1 throws the ball, the camera follows it and shows the result. After a couple seconds, it’s supposed to blend back to the pawn and let P2 have a turn. That’s not happening. The camera now zooms back to start, P1 is hidden and P2 can move freely around, but the camera just sits at 0,0,0, not attached to anything anymore. P2 can throw and that’s about all that happens from there.
So how do i pass active players into my QB Pawn, and the inactive player into a spectator pawn?
SOLVED IT. This was relatively easy, actually. After Level BP creates 2 players, i was able to get the Pawn the accept both inputs. After that, i used a custom event called “TURN CHANGE” to toggle using the Set Controller ID nodes, set to 0 or 1. Those values came from GameMode. I didn’t need to use a Spectator Pawn or anything, just 1 pawn with 2 players controlling it. I’m relieved it’s now working and i felt a little dumb after i finally figured it out.