Download

Any way to use "servertravel" command with specific game mode options?

I was looking forward to this a loot of time but I cant find any reference to that, using the command “servertravel Map?Game=/Game/Blueprints/MyGameMode.MyGameMode_C” doesnt work, the server dont do nothink

If I use “servertravel Map” it works, but the loaded game mode is the maps default game mode so, how can I change the game mode when using servertravel()?

Thank you community

I just hit the same problems. I want to reuse a map with different GameModes but I just can’t get it to work. Did you get it to work with “open Map?Game=GameMode”.

That doesn’t work for me either.

I have not tested it with open command, Ill give it a try

Someone has more info about this?

Any luck on your side? Didn’t look into it that much, but I am reaching a point in development where I have to figure this out. I really want to reuse maps for different GameModes.
I will probably just hook it up on LoadLevel() in c++, but I’d prefer a working default implementation :smiley:

Ok I figured it out, I realized that ShooterGame can reuse maps so I digged into that.

so either you use the full GameClassName


?game=YourProject.YourGameMode

or you can add an alias to your DefaultGame.ini like this


[/Script/Engine.GameMode]
+GameModeClassAliases=(ShortName="DefaultGame",GameClassName="YourProject.YourGameMode")

and then you can just write ?game=DefaultGame to load it.

Edit: just tested it with ServerTravel, and it doesn work. It seems it will just keep the current options.

This seems to pop up in the Search Results and the last answer suggests that Server Travel doesn’t work with specifying and changing the GameMode.

THAT IS WRONG!

You can indeed change the GameMode via every travel when specifying ?game=<Shortcode> or the classname with module name in front.

What DennyR posted above is correct in terms of telling UE4 to change the GameMode.

The only thing that you might need to keep in mind is that if you perform a ServerTravel with “RELATIVE” mode, it will grab the data from the current URL, which is your current GameMode.
You need to make sure that you travel “ABSOLUTE”. The Console Command should do this by default, but if you travel via C++, you might need to pass in an extra “TRUE” to the ServerTravel function.

Hope that helps peeps that are encountering this in the future.

PS: The Shortcode can be specified (by now?) in your Project Settings. Go to the Maps&Modes page and expand the top most advanced menu. There you should find the GameModeClassAliases map, where you can specify the Shortcode and select the GameMode Class for it.

1 Like