Sides

A bit about adding sides, aka, part of the BF2 Jedi Creation.doc. Forgive the lack of comedic additions, I don't want something showing up on the search that misdirects someone.

Creating a Side

This assumes you already have a world in which to work – preferably one created by VisualMunge, which has a “Worlds” folder and an “addme” folder and all that chunky goodness (the one used in the example is SID).

First thing you need to do is copy the “Common” folder from within the mod-tool “assets/sides” directory and place it in the sides folder or your world along with the "tur" side. Note that this is NOT the same folder as “assets/common”, this is “assets/sides/common”! This folder is necessary because it contains all the things that are used by every side in the game – the default soldier class, default effects and lightsaber meshes, and other things. As you get to realize what each file does, you can leave some of the files out to decrease size of the level, but for now, the whole folder is preferred.

In the same sides folder you must create a sub-folder with the name of your side – it may not be limited to 3 letters, but as it's best to keep with that convention, the side will be named “JDI”. Within your side folder, several new folders must also be created. These are: effects, munged, msh, odf, and req.

What’s the point of all these folders? They contain things specific to your side, not found in the Common folder…
- The Effects folder contains particle effects used by your side, such as explosions, powerups, and hit effects.
- The MSH folder contains assets used by your soldiers, such as .MSH files (models/geometry), TGAs (textures), and the associated .option files for those models and textures.
- The Munged folder contains munged animation data organized per skeleton, such as melee combo attacks, specialized weapon-firing animations, individual unit movement animations (walk/run/jump), etc.
- The ODF folder contains .ODF files (“Object Definition File”) for your side’s soldiers, weapons, ordnance, and other objects.
- The REQ folder contains .REQs, or requirement lists, for each unit on your side. A unit’s REQ contains a list of the ODFs required or used by that unit, and additionally any textures, models, or effects not explicity mentioned in those ODFs. A REQ is used by the munge process when packing data into a .LVL file, so that everything required by that unit is sure to be loaded when that unit is loaded into a game level.

Unit's ODF

Off into the ODF directory we go. An ODF is a soldier’s identity – it defines him, tells him what he can do and what he can use, and generally IS that unit. For now, we don’t need to have anything in it, we just need to make one so we can reference it in the other side-creation steps.
Let’s decide on a name for our soldier – how about "demojedi"? So everything that has to do with this soldier will be derived from this name. Also, to prevent confusion, we will append the name of the side – so "jdi_demojedi" is his name. Let’s create his ODF, which is blank for now, by creating a new notepad document and naming it "jdi_demojedi.odf".

Unit's REQ

Now that the soldier exists, we must create a REQ file for him, in the “req” folder. So far, this REQ will only include the soldier’s ODF, as that is all that must be included for the soldier to be loaded because the ODF directly references everything else – models, textures, weapons, etc. In some cases this may not be true, but generally a soldier’s REQ only needs to include his ODF.
So then, in the req folder we create the REQ by creating a new notepad document and naming it "jdi_demojedi.req" and putting this as text in the file:

ucft
{
    REQN
    {
        "class"
        "jdi_demojedi"
    }
}

All REQ files must begin with “ucft”, and each section is surrounded by curly braces {}. REQN is a section title, and it means requires these things as well. The first line in a REQN section is the type of thing required – “class” means the files come from the ODF folder, and end in “.odf”. So in this case, the REQ makes sure that “ODF/jdi_demojedi.odf” is included in the side.

Side’s REQ

In the base directory of your side (the side folder itself) goes the main side REQ, called “[side’s name].req” – in our case, “jdi.req” (created the same way as before). This file will be a list of which REQ files from the req folder will be included in your final munged side LVL file. Suffice it to say, if a soldier is completely made and has a REQ in the req folder, but that REQ is not included in the side’s REQ, that soldier won’t be available to load in the game.
File contents:

ucft
{
    REQN
    {
        "lvl"
        "jdi_demojedi"
    }
}

The “lvl” line means that the files that are included end in “.req” and comes from the “req” folder. Every .REQ file is munged into an LVL, with the soldier’s LVL (jdi_demojedi.req -> jdi_demojedi.lvl) being included in the final side’s LVL (jdi.req -> jdi.lvl). The side’s LVL is what is actually loaded by the game, and sub-LVLs inside are accessed to load specific solder classes. You can look in the “assets/sides” folder to see how the shipped game’s sides were organized.

Side’s munged-data folder.

This is the final step for creating the framework of your side. If you open up your mod’s directory (in our case, data_SID), then go into the _BUILD folder, there should be a Sides directory. Inside this directory, we must create the folder where our side’s munged data will go. It has the same name as our side’s main folder (“JDI”), and then copy …\_BUILD\Sides\ALL\clean.bat and munge.bat into that folder. NOT clean.bat and munge.bat from _BUILD/Sides – those are different!

Munging

At this point, you should be able to open up your mod’s VisualMunge and see that in the “SIDES” box there is indeed a JDI side, ready and waiting to be munged. Remember: the first time you munge, you must munge your world with the Common check-box checked, as well as the JDI side. After that, if you change your side, you can un-check the Common check-box and just munge your side (and your world, but there’s no escaping doing that).
If you do munge now, then it will create the folder “[your mod dir]/_LVL_PC” and inside that, “SIDES”, and inside that it will place “jdi.lvl”. At this point jdi.lvl has nothing in it, but this means the framework is set up correctly.

ODF

The BF2 Jedi Creation.doc now goes into detail about ODF files.

Combo

The BF2 Jedi Creation.doc now goes into detail about combo files.

Final Notes

When you munge now, “jdi.lvl” should contain your character. How do you use it in the game? Well, so you know, it’s in the SIDE folder of your mod’s _LVL_PC folder. When you munge, this gets copied into your BF2 directory automatically.

From there, in your mod’s mission scripts, you can load your character into your level:

ReadDataFile("dc:SIDE\\jdi.lvl",
           "jdi_demojedi")

The "dc:" tells the game that this lvl file is located in your mod’s folder, rather than in the normal game data folder. The first parameter is the side’s lvl file to open, and the rest are individual soldiers to load from within that side’s lvl – in our case jdi_demojedi, and if we had made one, jdi_otherdemojedi or jdi_demojedi2, etc. Now all you have to do is set your teams up to use that soldier, and you’re done.

Note: Once a soldier class (ex. “jdi_demojedi”) is loaded by ReadDataFile, it can be used on ANY team. It doesn’t matter where the soldier comes from, you can mix-and-match Republic soldiers and CIS soldiers on the same team if you decide to, as long as all the soldier classes you use are actually loaded.

Both of the following are already be present with default heroes and soldiers in your mission LUA scripts. To set your Jedi up as a team’s hero, use the following line:

SetHeroClass([team], "hero_req_name")

for example:

SetHeroClass(REP, “rep_hero_macewindu”)

or:

SetHeroClass(CIS, “jdi_demojedi”)

To set your Jedi or soldier up as a normally-selectable or points-unlocked soldier on a team, modify the SetupTeams section of your mission LUA and replace an ODF name with your own soldier’s loaded ODF name:

SetupTeams{
        rep = {
            team = REP,
            units = 20,
            reinforcements = 150,
            soldier  = { "rep_inf_ep3_rifleman",9, 25},
            assault  = { "rep_inf_ep3_rocketeer",1, 4},
            engineer = { "rep_inf_ep3_engineer",1, 4},
            sniper   = { "jdi_demojedi", 1, 4},
            officer = {"rep_inf_ep3_officer",1, 4},
            special = { "rep_inf_ep3_jettrooper",1, 4},

        },
        [then CIS section]
}

For a more complete description of what the SetupTeams or SetHeroClass functions do, please see the Lua page.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License