Official BF Editor Forums

# Battlefield 2142 Command Line

## Recommended Posts

Hello.

I am developing the mod launcher, and I am adding bf2142 mod support.

All launch parameters like auto login and window size are working, except for one thing:

Whatever I try, the game -or crashes -or just goes to the login screen.

What command line arguments should I use to, as example, load the "Sidi_Power_Plant conquest 64 " level?

I tried +loadLevel Sidi_Power_Plant +maxPlayers 64 +ai 0 but no success.

The maplist thing isn't working either.

Anyone knows how to do this?

##### Share on other sites

Perhaps try updating the usersettings.con with GSLoadLevel instead. Not sure exactly what the difference is, but might work. Also try maplist.append. Also, conquest is abbreviated gpm_cq in BF2 atleast.

Edited by Kev4000

##### Share on other sites

Well, if you look at bf2.exe anyway, the commandline options just directly set those GS variables. In theory they should do the same thing.

##### Share on other sites

Have you tried it without "+maxPlayers 64 +ai 0" to see if map will load? I think you are trying to to many things at once. Add one thing at a time to your command line, then when it crashes, you will know what caused it. At least that is what worked for me.

##### Share on other sites

Just tried this and it loads for me. Unlike BF2, I must be online or it just goes to the account login screen.

+eaAccountName ***** +eaAccountPassword ***** +playerName ****** +loadLevel Sidi_Power_Plant +maxPlayers 64 +ai 0

##### Share on other sites

That' s the same command line used in the Mod Launcher, so I guess the mod launcher for bf2142 works well then.

Could anyone confirm that the mod launcher works for loading a level in bf2142?

##### Share on other sites

Was going to try but I don't think it works for me because I have to use 1920x1080@60Hz with the widescreen option in the shortcut. Does the mod launcher produce a new file which it uses to start battlefield? If I can add widescreen manually then I could try it.

##### Share on other sites

I have BF2142 installed on my D: drive and the mod launcher would not let me select it.

##### Share on other sites
I have BF2142 installed on my D: drive and the mod launcher would not let me select it

Sorry but that is not related to my launcher, has to do with the OS not allowing drive change in the folder browser dialogue.

Workaround: edit the settings file.

NOTE: make sure "show hidden folders and files" is enabled in Windows before proceeding, could cause some trouble if not enabled.

1. Open Windows Explorer (just open some random folder)

2. In the address bar type: %appdata%

3. Press enter to go to your current application (data) folder.

4. Open the "Lost Pirates Productions" folder

5. Open the "Mod Launcher" folder

6. Open the "general.ini" file in notepad:

gmode=bf2
smod=SWOF
gpbf2=C:\Program Files\Games\EA GAMES\Battlefield 2
gpbf2142=C:\Program Files\Games\EA GAMES\Battlefield 2142

7.

gmode = the game mode used: bf2 or bf2142.

smod = the selected mod name (folder name)

gpbf2 = Game Path BF2

gpbf2142 = Game Path BF2142.

8.

Change the path after gpbf2142 to the installation path of your game.

Finished

If I can add widescreen manually then I could try it.

The shortcut arguments are in a sorta way ini file like my above post. File is:

%appdata%\Lost Pirates Productions\Mod Launcher\bf2142\launch_<modname>.ini

Edited by bergerkiller

##### Share on other sites

What I am trying to say is that the mod launcher won't work with BF2142 installed to my D: drive. I can select a folder on c: but if I select a folder on D:, I get a message that my selection was not valid.

##### Share on other sites

Well that's weird...all the launcher does is check if the "bf2142.exe" file and the "mods" folder exist in the folder (path) given.

No relative paths are used...so no real indication that Drive D: is different from C:...

Is the above condition met?

##### Share on other sites

the mod launcher is ver 1.2.3

I tried setting the mod general.ini file to:

gmode=bf2142
smod=bf2142
gpbf2=C:\Program Files\EA Games\Battlefield 2
gpbf2142=d:\Program Files\EA Games\Battlefield 2142


but, it did not fix anything. I customized my Battlefield 2142 install folder. Is the mod launcher looking for the default (Electronic Arts)?

The error message is: You haven't given a valid directory. Settings have not been saved.

##### Share on other sites

Yep, that's the message given when the program failed to find a "mods" folder and "bf2142.exe" file in the given path.

It does the same check-up upon launch, so since it is not caused by "not selectable" but by "not allowed", it will try to find the new folder.

In this case, it checks the registry and a few custom built-in paths where it could be installed.

Again, is "bf2142.exe" and "mods" folder present in "d:\Program Files\EA Games\Battlefield 2142"?

EDIT this is what is behind it:

        If FolderBrowserDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
Dim tmppath As String = FolderBrowserDialog1.SelectedPath
Dim allowed As Boolean = False
If ActiveGame = "bf2" Then
If System.IO.File.Exists(tmppath & "\bf2.exe") And System.IO.Directory.Exists(tmppath & "\mods") Then allowed = True
Else
If System.IO.File.Exists(tmppath & "\bf2142.exe") And System.IO.Directory.Exists(tmppath & "\mods") Then allowed = True
End If
If allowed = False Then
MsgBox("You haven't given a valid directory. Settings have not been saved.", MsgBoxStyle.Information)
Else
'A bunch of code here processing the path

It managed to set the path to a copy of bf2142 on my USB drive, so it can not be the program's fault...

Edited by bergerkiller

##### Share on other sites

Check this out. After starting mod launcher, I select BF2142 and then try to select the Battlefield 2142 folder, but get the same error message.

Yes, BF2142.exe is there as well as the mods folder.

I tried setting up a Battlefield 2142 folder on C: with the mods folder and a copy of the BF2142.exe, but no luck.

Then I tried, with Bf2142 selected, trying to browse to the Bf2 folder and it accepted it. Based on your code, the only way that could happen is if ActiveGame parameter is not getting changed to bf2142.

Edited by Dnamro

##### Share on other sites

I am also running the mod launcher from an XP system. Are there any specific versions of add ons needed to work properly with mod launcher?

##### Share on other sites

You can check the version in the about tab; latest is version 1.2.4

Ow version wasn't updated, should display 1.2.3

And yes, only possibility is that the parameter was not changed to bf2142 when you changed the radiobuttons.

(...there are radiobuttons to change from bf2 <> bf2142 mode, are there?)

    Private Sub ModeButtons_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged
If RadioButton1.Checked = True Then ActiveGame = "bf2"
If RadioButton2.Checked = True Then ActiveGame = "bf2142"
If ListBox1.Items.Count <> 0 Then
If ListBox1.Items.Contains(ActiveGame) Then
ListBox1.SelectedItem = ActiveGame
Else
ListBox1.SelectedIndex = 0
End If
End If
If RadioButton1.Checked = True Then GamePath = GPbf2
If RadioButton2.Checked = True Then GamePath = GPbf2142
End If
End Sub

No bug to be found here either...confused

The title of the folder select dialogue should give away the activegame btw, it either displays one of the two:

Select Battlefield 2 installation directory

Select Battlefield 2142 installation directory

Edited by bergerkiller

##### Share on other sites

Where do I get the 1.2.4 version? Mine says 1.2.3.

##### Share on other sites

No that's the latest version, forgot to update the version number label (again).

Honestly can't tell what the issue is...looked over it a few times (every code section that gets executed from loading to setting the new path), but no bug to be found.

At least I know it is somewhat related to the "ActiveGame" variable, but that only gets set in one or two places.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.