Getting Started: Using WinRFA to make patch files

Lots of cool and useful tips to mod either serverside or clientside
User avatar
Iced Earth
Posts: 209
Joined: Sun Oct 18, 2009 2:07 pm
Contact:

Getting Started: Using WinRFA to make patch files

Post by Iced Earth »

My old tutorial, thought I would repost here!


My purpose is to explain a bit, to the noob modder, how to use winRFA to make your own patch files (mapname_005.rfa) that you can upload to your server so people can play your mod!

Col. Crushans RFA explorer is a neat program, but is buggy and can be prone to errors. WinRFA is 60kb, has a very simple interface and thus is very simple to use once you learn how.

I want to mod (map name). How do I get started?

Lets say you want to mod Operation Market Garden, for vanilla (regular) 1942, say to add bf109's for axis. *IMPORTANT:* What game type do you want to mod? Conquest? Team Death Match? Co-op? (We will revisit this later.)

First you have to understand how the game files work. If you go to Battlefield1942\Mods\bf1942\Archives\bf1942\levels, you will see all the level files for the game.

If you look, you will see a Market_Garden.rfa, Market_Garden_000.rfa and Market_Garden_003.rfa. Market_Garden.rfa is the file that was released with the original game. As you know various patches and updates came out for 1942. If the developers felt any changes needed to be made, they simply made a patch file. That's what Market_Garden_000.rfa and _003.rfa are. The game first reads the map file, Market_Garden.rfa. Then, if there are any files with a _### number it reads those, in numerical order. For instance, MapName_005.rfa would be read after MapName_003.rfa.

Now you should have a basic idea of how Battlefield 1942 reads levels and opens them. To make your own server side mod patch file, lets use number 007. Our patch file would be named Market_Garden_007.rfa.

In this case we want to simply spawn two bf109's for axis. For that reason the only file we would need in our new patch file is objectspawns.con. However, perhaps we will want to change something down the road, or lets say we want to spawn a zero instead of a bf109. If so in either case, we should include ObjectSpawnTemplates.con. (Objectspawns.con and ObjectSpawnTemplates.con may be referred to as OS.con and OST.con here for shortness sake. You will also see this on the forums sometimes.)

Another short description. Simply put:
ObjectSpawnTemplates.con defines what will spawn.
ObjectSpawns.con defines where it will spawn.

Okay! Where do we get these files? In the map's rfa file.

First, open winRFA, then choose File--> Open.rfa from the menu. Open Market_Garden.rfa. You will see a LOT of files. Don't worry, we are only looking for two. Did you decide what game type you wanted to mod (Conquest, TDM, Coop)? If not, make a decision! We could mod them all, but lets do Conquest. Okay, but I see more than one Objectspawns.con and ObjectSpawnTemplates.con. What gives?

To understand how winRFA displays files:
WinRFA displays the entire contents of a rfa file, in a list. If you look you will see:
bf1942/Levels/Market_Garden/
in front of each file. This is the file structure of the map. If you were to extract the RFA file (exactly like a zip file), bf1942 would be a folder, and in it would be a Levels folder. Once you click a file (that is text), winRFA displays the file in the lower window pane. You can edit and save them here as well.

We want to mod the Conquest game style. Do you know which OS.con and OST.con files to look for? That's right, the two under bf1942/Levels/Market_Garden/Conquest.

Click on either one of those files to highlight it. Select the second one by holding the ctrl key and clicking it. Your screen should look like this:
Image

Next, we want to extract these files somewhere. Let's say C:\Modding. With these two files highlighted, choose "Extract" from the menu and then "Selected". Tell it to extract the files to the C:\Modding folder. It works pretty quick, so once you hit the button the files should be there.

Good! We're on our way to making our own patchfile. But we aren't done! Remember, Market Garden already has two patch files of its own! If we didn't extract the newer files, our server side mod could be different from the Market Garden we know. Just remember to extract the files in order (MapName.rfa, then 000, then 001, etc etc). I will save you the trouble of looking; Market_Garden_000.rfa doesn't contain any changes we need to worry about, but Market_Garden_003.rfa contains a newer ObjectSpawns.con file.

Open Market_Garden_003.rfa and click on the conquest version of ObjectSpawns.con. Choose 'extract selected' exactly like we did above. Extract to your Modding folder.

Perfect. We're one step away from having our own patchfile! All we have to do is pack the files we extracted. Once its packed, we can edit the file in winRFA. It is easy to make a mistake packing the RFA. This step is critical to maintaining the file structure, so bf1942 opens it properly. If not, your changes won't take effect, or you will get a crash.

To pack the files into your own RFA patchfile:

Open winRFA. Click "Pack" from the menu, and choose "Directory". A new window will open, with two text boxes. The first says "Source Directory" and the second is "Base Path". Next to the source directory text box there is a " ... " button. Click it, then your mod folder, C:\Modding. There will be a new folder, called bf1942. Click it, then hit OK.

Your screen should look like this:
Image

Click the Pack button, and save it to your C:\Modding folder, or anywhere you'd like, with the name Market_Garden_007
**Note: Its best not to save this to your game's levels folder, as you will get a "Data Differs from Server" error if you try to join an online game.

Congratulations! You have your very own patch file. If you've done it successfully, when you open it with winRFA it should look like this:
Image
Take note of the file structure. It should match the one shown above. Remember, this is key!

Now its saved, you can simply edit your patchfile directly in winRFA. Just open Market_Garden_007 any time you want to make a change, edit OS.con or OST.con to your liking, and then click the "Save Changes" button. If you forget, winRFA is smart enough to ask you "Text was modified. Save changes?" when you click another file.

You're done! You now have your very own patch file, can edit it, and can mod other maps using this same method. Have fun!


A brief overview to get your started modding (pretending we still want to add planes to market garden).

Like stated earlier, ObjectSpawnTemplates.con tells you what spawns what. Open it, and scroll down to the Fighter Object Spawner:

Code: Select all

ObjectTemplate.create ObjectSpawner FighterSpawner
ObjectTemplate.setObjectTemplate 2 mustang
ObjectTemplate.setObjectTemplate 1 bf109
ObjectTemplate.MinSpawnDelay 40
ObjectTemplate.MaxSpawnDelay 80
ObjectTemplate.SpawnDelayAtStart 0
ObjectTemplate.TimeToLive 45
ObjectTemplate.Distance 40
ObjectTemplate.DamageWhenLost 10
The first line is the spawners name. The next two determine which team (allies or axis) it will spawn for. 2 is for allies, and 1 is for axis. The rest of the code is specific modifiers to the object, and explanations for each one can be found here.

If we want to spawn a bf109 for axis, no changes would need to be made. If we wanted to spawn a zero, we would change the third line to read:

Code: Select all

ObjectTemplate.setObjectTemplate 1 zero
Next you would have to add the plane to the map. Battlecraft 1942 (BF1942 official map editor, on downloads page) is the easiest way to do this. Otherwise you can go in-game, hit the console button (~ key), and type console.showstats 1. This will give you the in-game coordinates that will show you where your are at all times on the screen under "Position:" The format is Z/Y/X, with each number having six decimal places. If looking at the map from overhead, Z=East/West (the left being zero), Y=height, and X=North/South (the bottom being zero).

Besides position, there is rotation of an object, in the Z/Y/X format as well. Beginning you will only have to worry about the Z rotation. This is which direction the vehicle will face. A rotation of 0/X/X would be facing north, 90/X/X facing east, 180/X/X facing south, and 270/X/X OR -90/X/X facing west. As you noticed, the rotation is clockwise.

Once you have your positions, you can add the plane to ObjectSpawns.con. Remember, this file tells us WHERE the object will spawn. Even though we are adding a bf109, we are actually adding a fighterspawner to the map, as far as the game is concerned. So, lets do that. In ObjectSpawns.con, add this to get two fighters for axis:

Code: Select all

rem *** Additional Fighter #1 ***
Object.create FighterSpawner
Object.absolutePosition 1193.34/40.28/724.55
Object.rotation 0/-9.66/0
Object.setTeam 1

rem *** Additional Fighter #2 ***
Object.create FighterSpawner
Object.absolutePosition 1193.34/40.28/724.55
Object.rotation 0/-9.66/0
Object.setTeam 1
These will spawn in the Axis Main Base. You can get your own positions yourself, or use these that I got using battlecraft.

The first line explains WHAT is being created (a fighter spawner), the second line the position (in z/y/x format), the third the rotation of the vehicle (z/y/x format as well), and the last which team it will spawn for. This determines WHAT will spawn (remember, this is determined by ObjectSpawnTemplates.con).

IMPORTANT: You cannot "make up" spawners and have your mod work server-side. For example, you cannot make a "MustangSpawner" in OST.con and have it work. You are limited to what is available on each map. For market garden, that is:

LightTankSpawner
HeavyTankSpawner
APCSpawner
WillySpawner
ScoutCarSpawner
AAGunSpawner
FighterSpawner
DiveBomberSpawner
HeavyBomberSpawner
MachineGunSpawner
ArtillerySpawner
LCVPSpawner

As you might know, some of these aren't used, so you could always add new vehicles to the map. For instance, LCVPSpawner isn't in use, nor is DiveBomberSpawner. Just because a spawner is named "DiveBomberSpawner" doesn't mean it has to spawn a dive bomber, however. It's just a name. For example, a DiveBomberSpawner could look like this:

Code: Select all

ObjectTemplate.create ObjectSpawner DiveBomberSpawner
ObjectTemplate.setObjectTemplate 2 lynx
ObjectTemplate.setObjectTemplate 1 kettenkrad
This spawner will now spawn the scout cars from the level Liberation of Caen. In ObjectSpawns.con, you would simply spawn the DiveBomberSpawner, then choose which team it would spawn for (setTeam 1 or setTeam 2).


This is a very basic way to get started, but hopefully you are to the point where you understand Battlefield 1942's map structure, and can create your own patch files and begin to mod them. Visit the forums if you have any questions. Good luck!
Image
Master Jay
Posts: 139
Joined: Mon Mar 29, 2010 10:28 pm

Re: Getting Started: Using WinRFA to make patch files

Post by Master Jay »

look good thanks made it into a video to ;)

Image
Im Watching You... When You Sleep!
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Getting Started: Using WinRFA to make patch files

Post by freddy »

its nice with a video tut but you missed one thing
Iced Earth wrote: Good! We're on our way to making our own patchfile. But we aren't done! Remember, Market Garden already has two patch files of its own! If we didn't extract the newer files, our server side mod could be different from the Market Garden we know. Just remember to extract the files in order (MapName.rfa, then 000, then 001, etc etc). I will save you the trouble of looking; Market_Garden_000.rfa doesn't contain any changes we need to worry about, but Market_Garden_003.rfa contains a newer ObjectSpawns.con file.
could you fix this would it be great
Master Jay
Posts: 139
Joined: Mon Mar 29, 2010 10:28 pm

Re: Getting Started: Using WinRFA to make patch files

Post by Master Jay »

must of miss it :evil: :evil: :evil:
Image
Im Watching You... When You Sleep!
User avatar
Tuesday
Posts: 36
Joined: Fri Jul 09, 2010 3:39 pm
Location: UK
Contact:

Re: Getting Started: Using WinRFA to make patch files

Post by Tuesday »

Iced Earth wrote:In this case we want to simply spawn two bf109's for axis. For that reason the only file we would need in our new patch file is objectspawns.con. However, perhaps we will want to change something down the road, or lets say we want to spawn a zero instead of a bf109. If so in either case, we should include ObjectSpawnTemplates.con.
I plan on changing and moving around vehicles, moving soldier spawns, moving control points and changing the power of some weapons on Berlin capture the flag, what files would I need in my patch file?
User avatar
Iced Earth
Posts: 209
Joined: Sun Oct 18, 2009 2:07 pm
Contact:

Re: Getting Started: Using WinRFA to make patch files

Post by Iced Earth »

You'd need (from under CTF):

ObjectSpawns.con
ObjectSpawnTemplates.con
SoldierSpawns.con
ControlPoints.con

There were no updates to the CTF files in Berlin_003.rfa, so you could just extract those files from Berlin.rfa and make your patch from those.

Generally any weapons changes are made at the end of OST.con.
Image
User avatar
MegaloDon
Posts: 18
Joined: Sat Sep 08, 2012 7:52 am

Re: Getting Started: Using WinRFA to make patch files

Post by MegaloDon »

Iced Earth wrote:IMPORTANT: You cannot "make up" spawners and have your mod work server-side. For example, you cannot make a "MustangSpawner" in OST.con and have it work. You are limited to what is available on each map.
I know this is a very old post but this statement is not true. I have created my own spawners many times in a server side mod and they work quite well. You just can't do it in OST.con.
User avatar
fo0k
Posts: 1433
Joined: Fri Oct 16, 2009 4:21 pm
Location: UK

Re: Getting Started: Using WinRFA to make patch files

Post by fo0k »

MegaloDon wrote:
Iced Earth wrote:IMPORTANT: You cannot "make up" spawners and have your mod work server-side. For example, you cannot make a "MustangSpawner" in OST.con and have it work. You are limited to what is available on each map.
I know this is a very old post but this statement is not true. I have created my own spawners many times in a server side mod and they work quite well. You just can't do it in OST.con.

You mean added to the total number of spwaners on the map, Megalo? I always understood this was not possible. Care to expand on how you have done it?
freddy
Posts: 1267
Joined: Sun Oct 18, 2009 4:58 pm

Re: Getting Started: Using WinRFA to make patch files

Post by freddy »

Worked fine for me to in Coral but in Midway its trickyer, ill try moving the spawners out from ost.con

This pops up with client in windowed mode but ignore works and let me join.
Image
Image
Image

edit: moved the code with the new spawners to os.con and it worked fine. Thanks for the tip MegaloDon
User avatar
MegaloDon
Posts: 18
Joined: Sat Sep 08, 2012 7:52 am

Re: Getting Started: Using WinRFA to make patch files

Post by MegaloDon »

fo0k wrote:You mean added to the total number of spwaners on the map, Megalo? I always understood this was not possible. Care to expand on how you have done it?
Yes you can add to the total number of spwaners on the map. As Freddy did it in OS.con, you can also make a new file and do it in there. I made one called NewSpawns.con and it works great. You just have to make sure you define it in your gametypes files (\levels\Wake\GameTypes\Coop.con, \levels\Wake\Coop.con, etc.)

Code: Select all

run SinglePlayer/NewSpawns
It's also much easier to keep track of changes you made this way.
Post Reply