[Crash] ConsoleCommand in Blueprint 'ServerTravel MapName?listen' doesn't work

Hello!
After quiet a few days of trial and error I’m getting forward, however now my problem lies somewhere else.
Quick overview of whats going on:

I have 2 players.

Both join the Main Menu map.

After Creating Session and joining Session from oneanother and a level load to Lobby (which is working fine).

(I have the space after ServerTravel - I tried putting B in without a string and hardcode it)

When in the Lobby, everyone is ready, and i click my start button the ServerTravel MapName?listen command is fired and i promply get an error like this:

I get this error twice, for each Standalone window that just crashed. My Editor stays up and running, and I could play again after dealing with the Crash Reporter.

I tried different Mapnames for the ServerTravel, and noticed that when I would go back to MainMenu with that command, it did not crash!

When I use any other way to load the Level everything is working as expected, except for the part that I dont ServerTravel. Which is what I want to use in this case.

I’ve loaded the map before and after this crash fine if I do it in any other way.
The ServerTravel Mapname?listen one seems to not like my Map. Any ideas?

Hi Heidi,

Ok so I have done a similar thing but much simpler I feel. I believe you may have clients crashing as the console command is perhaps running on all? You should be calling this command by RPC (Run on Server) event. If not, fix this first!

Once it is se to be a run on server event, remove the get player controller from the specific player pin. It isn’t a requirement and might only cause issue. If the event only fires on server it won’t need a specific player anyhow.

Hope this helps!

This gives me the Hello text and then promptly crashes aswell.

This also happens when i rightclickt my .uproject and Launch Game.

However this does not happen in PIE. There I just get the Hello Print and it seems like the ConsoleCommand doesn’t have any effect, or is canceld out to avoid the crash.

But since this is MyGameInstance it is Serversided anyway. I cant even check for ‘Has Authority’ because of this. Seems to be something else…

Edit:
This only happens when i use

ServerTravel MapName?listen

When i use

open MapName?listen

i dont get a crash, but thats not realy the option that i need :stuck_out_tongue:

I’ve recreated this in a new project. The errorlog looks slightly different.

Am I using ServerTravel wrong? Or is that something else

Ah you are doing this from game instance. In that case, run from server is indeed pointless and you can revert back and, you need to create the session first.

From your HostGame event, make a create session node first. I’m guessing they are crashing as they are not currently in a networked session and so it can’t perform a server travel as there is no defined session settings.

Here is a Game Instance Event I have in my Tutorials Set:

The difficulty with your own is that you are running a console command each time before people are in the session.

If your game starts into a lobby where people can join then all travel (Think rocket league style) then I would have in your GameInstance Class:

Now, when the game initialises it will create a session, load the level for lobby. Now players can join and so on.
Once ready, you could perhaps have a UMG widget or event that fires to trigger the ServerTravel event. For simplicity I made one event to handle this with a Boolean which dictates which type. Game will always start as lobby but then all you would need to do is Get Game Instance, Cast to it, call the Create Session event and input into the function the desired level name and ensure Game Lobby is false.

This should theoretically work!
Let me know :slight_smile:

After comparing my Blueprint with your example i noticed that you Create 2 Sessions.
I thought I create a Session for the Lobby where all players can join and then just travel the maps. Seems like i need to Create a new Session before i use the ServerTravel command.

After rebuilding your example like this:

All i get is the Print with Error:FailedToCreateSession!
Are you sure about creating a 2nd session because it always returns the On Failed pin.

When from MainMenu i create a session and open the lobby.
And other client from MainMenu joins the session.
Both are in Lobby and working as expected.
How can I move both clients to my GameMap now???

Oh! Noob mistake! Sorry yes, you don’t need to create the new session for the Server Travel one!

Once your initial session is created and clients have connected, the server travel option without the second session create should work

Well it doesn’t. Thats what this post is about. I get the error I posted above.

Bump for visibility. Someone please help me…

So did you rework your above without the second session creation and it still fires the error?

yes, i also did that in a new project, the error log of that is above. both failed

Are you using the steam subsystem, or any online subsystem for that matter?

Try To use the ServerTravel Command in the GameMode…