View Full Version : Mapping Alt Settings For Different Gameplay Layers

2012-03-22, 05:13
This tutorial will teach you how to load alternate files, with different settings for different gameplay layers without needing to clone the map. The main uses include loading different teams, different statics and different sky settings.

It works by making the gameplay layer in question load an init.con file, which tells the PR to then load other files including your changes.

If you have trouble understanding how to set out or format the files try checking out how they are done in existing PR maps, eg Operation Marlin, Kokan, Ramiel and Al Basrah.

1a. Using alternate teams

Inside your map folder, create a new text document using notepad and insert the following lines of codes.
run ../../Factions/faction_init.con 1 "opfor"
run ../../Factions/faction_init.con 2 "blufor"
Change the team names to the teams that you actually want to be featured. Even if you want to modify only one faction, make sure you add both teams in the init.
A full list of team names and some more info on init setting can be found in this thread: [0957] Init System (https://www.realitymod.com/forum/f354-community-maps/89720-0957-init-system.html#post1475836).

Once that is done save it as Init_X.con. Replace the X with either the name of the faction being changed, the name of the layer or gamemode that it effected by the change.
Eg. Init_canada.con, Init_32.con, Init_skirmish.con.
Note you can also use this init to load other alternate files, see step 2.

NOTE: If you use alternate teams, they will use the same voices as the normal teams.
So if team 2 is USA normally all team 2 teams for that map will have USA voices and you would be restricted to only using alternate teams that use that voice, eg USMC and Canada.

1b. Altering other files
This method can also be used for making alternate Sounds settings, alternate AmbientObjects, alternate Triggerables and alternate SoundDistances.

First of all, create a backup copy of your existing sky.con and water.con, then go into the editor and tweak the lighting and water settings that you would like for your alternate sky.con and save.

Now rename your new sky.con to sky_X.con. Replace the X with either the name of sky setting, the name of the layer or gamemode that it effected by the change.
Eg. sky_night.con, sky_cloudy.con, sky_32.con, sky_skirmish.con.
Do the same for the water.con file and rename your backups of these files we created earlier to their original names.

NOTE: You can only have one set of lightmaps so sun/moon positions should not differ to much between the different sky settings. Sometimes (not always) it's also necessary to change the water settings to match the different lighting conditions.

1c. Using additional Static Objects
NOTE: You cannot use an alternate staticobjects.con file to remove objects that are in the normal staticobjects.con, you can only use this to ADD objects.

Make a backup copy of your normal staticobjects.con file. Now go into the editor, make your edits and save. You can also lightmap these additional objects.

Now go into your new staticobjects.con file and remove everything expect for the objects that you just added. The newly added objects should be at the bottom of the document. A good example of this is in the insurgency.con in Operation Marlin's server.zip.

At the top of the document you will see a series of lines showing the directory of the .con files for the static objects being loaded. It will look something like this:
if v_arg1 == BF2Editor
console.allowMultipleFileLoad 0
run /objects/staticobjects/common/object.con
console.allowMultipleFileLoad 1
Only alternate objects that have not been loaded into the normal staticobjects.con need to be in this set of lines.

Save and rename the file to staticobjects_X.con. Replace the X with either the name of the layer or gamemode that it effected by the change.
Eg. staticobjects_32.con, staticobjects_skirmish.con, staticobjects_insurgency.con.
Rename the backup of the original staticobjects.con to its normal name.

2. Making an alternate Init.con
The alternate init file is used to load all the alternate files.
Some edits may only require an alternate init file with only a few lines of code, eg alternate teams, different texture suffixes and different before spawn camera positions. You only have to include the lines of code that you have changed.

Create a new text document and include the following lines:
if v_arg1 == BF2Editor

run StaticObjects_X.con BF2Editor
run Sounds_X.con
run Sky_X.con BF2Editor
run AmbientObjects_X.con BF2Editor
run Water_X.con
run TriggerableTemplates_X.con BF2Editor


run Sky_X.con v_arg2
run Sounds_X.con
run SoundDistances_X.con
run AmbientObjects_X.con
run Water_X.con
run TriggerableTemplates_X.con


rem ------------------------------- LevelSettings -------------------------------
rem -----------------------------------------------------------------------------

run ../../Factions/faction_init.con 1 "opfor"
run ../../Factions/faction_init.con 2 "blufor"

rem -----------------------------------------------------------------------------

gameLogic.setBeforeSpawnCamera -300/33/139 86/-1/0

if v_arg1 == BF2Editor
LevelSettings.CustomTextureSuffix "marlin"
texturemanager.customTextureSuffix "marlin"
rem -----------------------------------------------------------------------------

GameLogic.MaximumLevelViewDistance 600

rem -----------------------------------------------------------------------------

Remove the lines in GREEN that do not apply to your edits (eg if you only made an alternate Static Objects file then remove everything but the lines for the staticobjects_X.con). If you want you can also remove the lines that start with "rem" as they're not needed.
Replace the Xs with the same names you gave to the other files.
Save it as init_X.con. Replace the X with the same name you used for the files it contains.

3. Loading alternate Init.con with a gameplayobjects.con

Now that the alternate init is done and saved, go into the gameplayobjects.con of the gameplay layer that you want to be affected by this change. In the gameplayobjects.con go into the first line, press enter a couple times to create two blanks lines and insert the following code into the first line:
run ../../../Init_X.con
Replace the X with what you named the init file earlier and save.

Now the first 3 lines should look something like this:
run ../../../Init_X.con

rem ********** Object Spawner **********

You can have several different alternate files and inits being loaded on different gameplay layers, just rename the files and lines of code accordingly.

2012-03-23, 02:11
Lovely tutorial! mind if I make it into a video and add it to a series i'm working on?

2012-03-23, 05:39
Go ahead

2012-04-27, 05:01
Basically, with team 1 as MEC and team 2 as GB, i wont be able to create another gamelayer with MEC vs MEINS nor using alternate config?

2012-04-27, 12:20
Basically, with team 1 as MEC and team 2 as GB, i wont be able to create another gamelayer with MEC vs MEINS nor using alternate config?

you won't be able to as the insurgents would have british voices. That's the limitation of this method.

2012-11-06, 17:41
I thought I figured it out, but for some reason it is not loading my extra init files. It worked once when I made a nightlayer. It loaded custom staticobjects and water and sky. Now I tried loading custom factions and different 'flag' staticobjects. This is how it is set up.

AAS64: loads staticobjects(normal) and staticobjects_std(holding the flag objects).
AAS32: custom factions and staticobjects_alt (holding the different flag objects).
AAS16: custom factions.

but when I load the maps none of the different factions or secondary staticobjects are loaded in.
standard init-file:

rem *** Generated by BF2Editor ***
if v_arg1 == BF2Editor

run Heightdata.con
run Terrain.con BF2Editor
run StaticObjects.con BF2Editor
run StaticObjects_std.con BF2Editor
run Sounds.con
run Sky.con BF2Editor
run Editor/GamePlayObjects.con host
Undergrowth.load Levels\shooting_range\
run Overgrowth/Overgrowth.con
Overgrowth.editorEnable 1
run AmbientObjects.con BF2Editor
run Water.con
run TriggerableTemplates.con BF2Editor


run Heightdata.con
run Terrain.con v_arg2
run Sky.con v_arg2
run CompiledRoads.con
run Sounds.con
run tmp.con v_arg1
Undergrowth.load Levels\shooting_range\
run Overgrowth/Overgrowth.con
run Overgrowth/OvergrowthCollision.con
run AmbientObjects.con
run Water.con
run TriggerableTemplates.con


rem ------------------------------- LevelSettings -------------------------------
rem -----------------------------------------------------------------------------

run ../../Factions/faction_init.con 2 "usa"
run ../../Factions/faction_init.con 1 "gb"

rem -----------------------------------------------------------------------------

gameLogic.setBeforeSpawnCamera -473/28/-344 90/0/0

if v_arg1 == BF2Editor
LevelSettings.CustomTextureSuffix "woodland"
texturemanager.customTextureSuffix "woodland"
rem -----------------------------------------------------------------------------

GameLogic.MaximumLevelViewDistance 810

rem -----------------------------------------------------------------------------

gameLogic.setDefaultNumberOfTicketsEx 16 1 500
gameLogic.setDefaultNumberOfTicketsEx 16 2 500
gameLogic.setDefaultNumberOfTicketsEx 32 1 500
gameLogic.setDefaultNumberOfTicketsEx 32 2 500
gameLogic.setDefaultNumberOfTicketsEx 64 1 500
gameLogic.setDefaultNumberOfTicketsEx 64 2 500
gameLogic.setDefaultNumberOfTicketsEx 128 1 750
gameLogic.setDefaultNumberOfTicketsEx 128 2 750
gameLogic.setDefaultTimeToNextAIWave 8
gameLogic.setTicketLossAtEndPerMin 1000
gameLogic.setTicketLossPerMin 1 10
gameLogic.setTicketLossPerMin 2 10

rem -----------------------------------------------------------------------------

rem -----------------------------------------------------------------------------

renderer.globalStaticMeshLodDistanceScale 1
renderer.globalBundleMeshLodDistanceScale 1
renderer.globalSkinnedMeshLodDistanceScale 1

if v_arg1 == BF2Editor

run StaticObjects_alt.con BF2Editor

rem ------------------------------- LevelSettings -------------------------------
rem -----------------------------------------------------------------------------

run ../../Factions/faction_init.con 2 "ru"
run ../../Factions/faction_init.con 1 "ch"

rem -----------------------------------------------------------------------------

run ../../Factions/faction_init.con 2 "ger"
run ../../Factions/faction_init.con 1 "tal"

and in the gameplayobjects.con file of the alt and inf layers I did the thingy:

run ../../../Init_alt.con

rem ********** Object Spawner **********

I don't know if I'm doing something wrong(as it worked earlier with the nightlayer) or if I'm forgetting something but after two nights I still haven't found it. Even the std layer doesn't load the staticobjects_std.con file.

2013-04-07, 02:25
If the country that I want to use as an alt layer is Great Britain, am I suppose to type Init_gb or init_Great_britain or something else?

And what I want the two layers to be of the same country but different kit settings?

2013-04-07, 02:45
naming of the init.con isn't important as long as it doesn't use any illegal characters and the run line in the GPO.con matches it, although would keep it short and simple, and to have two kit loadouts but with same factions, you need two init.cons so init_gb1.con and init_gb2.con or init_gb_aas16.con and init_gb_aas32.con or w/e.

Keep in mind however that GB uses its own, unique voices that no other faction uses, so you can't go swapping them out with the US or Canadians without either the Brits speaking in an American Accent or the Americans speaking in a British Accent.

2013-04-07, 16:45
Alright, thanks a lot, Rhino!

And sorry for bugging you over 2 threads lol.

Dr Rank
2013-06-02, 01:17
Any ideas on how to load a seperate surrounding terrain colormap? I've got everything else to work except the surrounding terrain colourmap which holds the lightmap data, so in a night layer everything is dark except the surrounding terrain. I've tried a few things including creating an alternative terraindata.raw called terraindata_night.raw and edited the colormap loading line to a colormaps_nights folder, in which I have place the darker colormaps for it to load. In addition I created a terrain_night.con with the line

terrain.load Levels/mapname/terraindata_night.raw

and added

run Terrain_night.con

to the init_night.con, which is of course prompted to load by the line in the gamemode file. Unfortunately this just made the whole terrain bright =(

All of the night stuff is loading fine except for these surrounding terrain colormaps which I need to get working otherwise the surround terrain color is far too bright compared to the rest of the terrain/map.

Any ideas/suggestions?

2013-06-02, 01:22
I had this issue in the very beginning of making my night layer. I fixed it on goose green, I just forgot how. I will look into my files tomorrow when I'm on homepc.

Dr Rank
2013-06-02, 01:29
Cheers :)

2013-06-02, 01:48
surrounding terrain doesn't have a lightmap, the lightmap is burned into teh colourmap

what I think you need to do...maybe, is to load your map in the editor with hte night light enabled, recompile your colourmaps and then the surrounding terrain colourmaps will properly match the light?

2013-06-02, 02:35
Rank: If you take a look at the files for v1.0 Fools Road or v1.0 Black Gold, you'll see how we did it.

I don't have time to write a tutorial right now, but basically you need to:

Make a copy of your colormaps folder
Load the map and lightmap the surrounding terrain at the darkness level you want for nighttime
Exit the map and reload
Now re-save compiled color and texture
You will now have the darker colormap files for your surrounding terrain, since like Rudd said, the editor doesn't use separate lightmap for surrounding terrain. Instead, it compiles the lightmap on top of the colormap.
Now rename that folder colormaps_night and make sure your original folder is named colormaps.
Create a init_night.con file with these lines:
if v_arg1 == BF2Editor

run Terrain_night.con BF2Editor
run Sky_night.con BF2Editor
run AmbientObjects_night.con BF2Editor
run Water_night.con BF2Editor


run Terrain_night.con
run Sky_night.con
run AmbientObjects_night.con
run Water_night.con


(Delete any line you don't need)

In your GPO, add this line to the top:
run ../../../Init_night.con
Create a file called terrain_night.con and place this single line inside it:
terrain.load Levels/mapname/terraindata_night.raw
Make a copy of terraindata.raw and name it terraindata_night.raw
Open it with a hexeditor and re-name the directory for colormaps from "colormaps" to "colormaps_night"

If you run into any problems, just let me know.

2013-06-02, 19:21
Ah right, just darken them with photoshop in the colormaps_night :D Yeah, I used falklands night/marlin and foolsroad1.0 to understand how building layers with different visual settings.