Call GameMode Custom Events from Command Line?

Hello,

After packaging my game, I need to call specific events within the GameMode blueprint based on a command line given in the shortcut that is placed on the desktop. In specific, I have two different shortcuts that I will need to call different events in so specific logic occurs based on which shortcut is clicked.

Here is the shortcut logic I want to have happen:

“%userprofile%\Desktop\MyGame\WindowsNoEditor\MyGame.exe” -bIsLanMatch=1 -IsServer
“%userprofile%\Desktop\MyGame\WindowsNoEditor\MyGame.exe” -vr -IsClient

Here is the blueprint preview (from the GameMode):

260122-blueprint-events.png

I have tried using the -ce IsServer in the shortcut command line, but that only calls from a level blueprint and not a server blueprint.

Any help on this issue (preferably without C++) would be appreciated!

Sadly C++ is probably your best bet if you want to properly implement them and you can detect command line parameters with this:

FParse::Param(FCommandLine::Get(),TEXT("IsServer"));

But i really also don’t understand why you doing this IsClient and IsServer stuff, UE4 already has command line options for that:

And there nodes to detect if you are on server or client:

Also note that GameMode exists only on server side

Hey ,

I can try implementing that using C++, is there a recommended file I can put that code in to? Also, the reason the UE4 networking nodes won’t work for this method is because of the logic that goes into spawning each of the players (also due to servertravel not keeping selected pawns on level change). I am trying to get the server to spawn as a different type of pawn than the clients. This game runs off of LAN and has a maximum of 4 players, 5 with the server included.

This is the current GameMode that I am trying to use, which works for my purpose but I want the clients to not be completely reliant on a server that spawns with a server pawn.

I am working on a new one that might help with some issues that I’ve been experiencing with the current method.

I don’t want to use the listen command-line argument since this product will be sold commercially and the IP reservations will change on a per-customer basis (unless there is a way to find the IP automatically using command line arguments).