I’m working on a turn-based game and I coded in blueprint function to select a player state from an array of player controller to select the player that I want, but I’m blocking on the movement.
For context :
Game mode > I’m using the OnPostLogin to create an array of Player controller when player join the game
Game State > I dupplicate the array from the game mode, from this local array, I get the first one for example and get the player state. Then, I’m setting it to a variable set to RepNotify
For information, I had help from this previous topic :
Then, I tried to send this selected controller in my blueprint controller. It display a widget, wait for an action of the player, disappear and move the player to a certain location.
Work fine for the player 1, but not the rest
I tried to do everything in the game state and it’s not working either, so I create a simple test (I add a navmesh for it to move)
Then, I tried to send this selected controller in my blueprint controller. It display a widget, wait for an action of the player, disappear and move the player to a certain location.
Work fine for the player 1, but not the rest
I tried to do everything in the game state and it’s not working either, so I create a simple test (I add a navmesh for it to move)
Hello @Alejandroagyra , there’s maybe a problem with the display of your post but I only see a copy of a sentence I wrote, did it not make any sense ?
Just in case, I saw that the node “Simple move to location” need a Nav mesh bound place on the world in order for the character to move.
I’m plugging the player controller and a vector, it’s working fine for the player 1, but not for all the others players.
Even by changing the index by hand in the game state (it will not work in the controller blueprint), the others players won’t move.
The test with the widget TRUE or FALSE ensure me that I’m able to differenciate the controller from each player but unfortunately, not the movement
So first, I tried to only affect the custom node move to and try every replicates options available > not working
So after that, I create another custom node set on “Run on server” and plug the “MoveTo” that I put on multicast to begin and then, test with all the other replicates options > same result (the server is moving, not the the other players).
I also try to check replicate the movement and replicate in the controller blueprint, but nothing either.
I’m pretty sure that the problem is not difficult, but I just don’t get why it will not replicate the movement to the other players
unfortunately i think its better to start over here, i understand you’re probably just testing but you’d never move a character on RepNotify.
Reason being is you cant set the location or speed, they’re hard coded.
You must have a server event that sets the active player, the server can then tell that player to move if thats what you want. although i assume you’d want the player to select a location?
In my main code, I’m getting an array of Player Controller from the Game Mode function OnPostLogin.
I’m calling the game mode in my game state and settings a local variable from this array.
Then, with a switch from an enumerator variable, I’m getting to the player turn.
There, I’m using my array “GS_PlayersController” and an integer variable to control the index. All the code after that is based on the choosen controller.
I put different conditions for gameplay reason and when the player launch a dice, I made a loop so that the player will move to each square board of the map, one by one.
This function is working just fine with one player but not with multiplayer, I’ll make a cleaner version of the code in a new project that I put in the conversation if it can help
So all movement should be done on the server, the actor can have movement replicated to clients.
all the client need to send is a MoveRquest, this could be a vector or in your case sounds like a dice roll. in that case though the dice roll would be server side too so basically all the client is send is a confirmation (i’ve clicked a widget or whatever)
you dont need to disable any input, when the client requests to move the sever can check, IsClientTurnActive.
Thanks again for taking the time to help me, I really appreciate
I will make some tests from what you said and I’ll come back to you when I’ve got something
It’s been a long time, but the solution was really simple, but not very obious I wouild say.
You have to go to your project settings > Engine > Navigation system and check on the settings “Allow Client side navigation”