Fix Mp_menu from part 3:
Add Refresh list if searching no result
Go to MP menu WB, on clicked Bttn Search Game,
add refresh set text node from For Each Loop Completed output:
Change Btn Connection type (now it starts solo game):
Go to Gameinstance BP, IsLanConnection variable
tick default value to true
Open Change ConnectionType function, return node, rename its output as IsLanGame
Create Lobby Menu
Duplicate MainMenu WB, name as WB_LobbyMenu
Recreate the widget (bttn_Mainmenu set as variable)
Go to BP MenuController, event graph
Add custom event (endclientsession)
To start replicate things between host and clients, by host tells clients end their sessions:
change replciates to Run on Own Client
Back to LobbyMenu WB, event graph, clear all old nodes and recreate:
Create MainMenu button function:
Go to BP_Menu_Gamemode, even graph, add variable All_ConnectedPlayers
Back to Lobby menu, continue the graph
Create Start Game button function:
Go to Gameinstance event graph, add custom event TravelToMap, then promote to variable
make the graph below
(Add space after typing severtravel on append node)
Back to Lobby menu, on clicked Bttn_StartGame
Create event construct (make sure joiners go to lobby map from lobbymenu, when they are on server) in LobbyMenu
(promote variable from make array node, name as All Borders Player Name and AllTextPlayerName)
Rename startgame bttn and change to variable in Designer
Continue the branch false graph if not in server
Show Lobby Menu at Startup:
Go to MenuController BP, event graph
Add function name as UI_ShowLobbyMenu
Back to event graph, add custom event and replicate, connect to function just created:
at event begin play node
Go to Menu_Gamemode event graph, type event handle starting newplayer
Add pin name manually in Switch on String node
(for if new player enter session, will return to player controller)
Test now, should be server click host game, will get into lobby (show start game)
client search game, find it, connected, get into lobby too (show please wait)
client can click main menu if not waiting, and reconnect by clicking search Game
Host click main menu will destroy session both himself and clients.
Load and display Player names on Screen
Go to BP MenuController
Add a function called LoadSaveProfile
Take same slot name as from Gameinstance “PlayerProfile_Slot”
In gameinstance:
Continue the graph for branch (when saved game existed, if not, create one)
Back to event graph, create a new custom event, called Initial_Setup , replicate on owning client