x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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):

alt text

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!

Product Version: UE 4.19
Tags:
more ▼

asked Nov 21 '18 at 11:58 PM in Blueprint Scripting

avatar image

ZeroBytes
11 1 3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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:

https://docs.unrealengine.com/en-us/Gameplay/Networking/Server

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

https://api.unrealengine.com/INT/BlueprintAPI/Networking/IsServer/index.html

Also note that GameMode exists only on server side

more ▼

answered Nov 22 '18 at 01:22 AM

avatar image

Shadowriver
37.3k 936 172 1117

avatar image ZeroBytes Nov 22 '18 at 02:23 AM

Hey Shadowriver,

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.

alt text

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

alt text

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).

gamemode.png (922.2 kB)
new-gamemode.png (340.7 kB)
(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question