Mod Tutorial 1

Produced by namrog84

SOME THINGS WERE WRITTEN BY GPG EMPLOYEES OR OTHER PEOPLE
I HAVE SIMPLY GATHERED INFORMATION AND ADDED TO IT
GPG DESERVES MAJORITY OF CREDIT

So you want to write your first mod but do not know where to start. I found a file deep inside the lua.scd which contained some information. I have gathered/reorganized/added to it.

First things first:

You need to have notepad or a notepad like program. If you are looking for something a little bit more advanced you should check out Crimson Editor at http://www.crimsoneditor.com/

Crimson editor will highlight certain aspects of code; give line numbers; and numerous other useful things.

NEXT: Go to the directory or folder that you installed Supreme Commander which contains a folder called gamedata
(default: C:\Program Files\THQ\Gas Powered Games\Supreme Commander\gamedata)

If you do not see the file extensions go to tools > Folder Options > “View” Tab > uncheck “Hide extensions for known file types”

You may be wandering what a .scd file is? Well, it is simply a zip that has been renamed.
I recommend WinRAR from
http://www.rarlab.com/

You do not want to actually modify or alter ANY of those because if you do you may mess something up and then you will have to reinstall Supreme Commander

You should create a folder that will be your working space. In this folder you should have 2 subfolders
Original files and Custom files

Now from your “\Supreme Commander\gamedata” folder copy units.scd, mods.scd, lua.scd over to your “working_space\original” folder

Open up WinRAR and go to working_space\original folder and open up lua.scd and extract it to working_space\original\lua and do the same to the other 2 respectively.

MOVING ALONG!!

Go to your custom folder and create a folder “mods”

Open up crimson editor and go to file > new and then go to file > “save as” and save it to your working_space\custom\mods folder as “my_first_mod_info.lua” but without the quotes

Each mod has a mod_info.lua file which contains various bits of info:

Make something similar to the following:

    name = "My First Mod"                          # Name to use for this mod
    version = 0.84                               # Version number to use for this mod
    copyright = "Copyright © 2006, namrog84"     # Optional copyright info
    description = "A long description of your mod and why it will make you happy"
    author = "namrog84"                              # Optional author info
    url = "http://www.gaspoweredgames.com"      # Optional URL to anywhere author likes
Then….

selectable = true

Flag for whether to list this mod in the mod manager window, where
the player can select it. Examples where you would set it to false are:

1. A mod containing just custom maps, along with textures and props used on
those maps. The mod will be automatically enabled when one of its maps is used.

2. A mod supplying textures and props for use by other mods. Those mods indicate
that they require this one, and it is automatically enabled when they are.

enabled = true

Setting enabled to false causes a mod to never be loaded. Provides
an easy way to disable a mod during development. The default is true.

exclusive = false

A simple form of preventing conflicting mods. Only one
'exclusive' mod can be active at a time. The default is false.
Majority of time this should be false unless you’re doing a MAJOR mod.

ui_only = false

Set true to indicate that this mod only affects the user interface. If
this flag is false (the default), all players in a multiplayer game must
have it in order for anyone to use it. If true, one player can have it
active independently of the other players. (Games on GPGNet may restrict
this further.)

icon = "mod_icon.dds"

Name of icon to use for this mod in the mod selection window. The default is
mod_icon.dds in the same directory as the mod_info.lua file.

requires = {

# Optionally indicates that this mod only works if another mod is also present.
"OtherMod1" # Requires any version of OtherMod1
{"OtherMod2", 123 } # Requires version 123 of OtherMod2
{"OtherMod3", 11, 22 } # Requires any version between 11 and 22 of OtherMod3

}

conflicts = {

Indicate any other mods that this mod is known to conflict with; the game
will refuse to enable both of them at the same time.
Same format as 'requires'.

}

before = {

List of other mod names. If this mod happens to be active at the same time
as any of the named other mods, it will be applied before them.
Same format as 'requires'.

}

after = {

List of other mod names. If this mod happens to be active at the same time
as any of the named other mods, it will be applied after them. If you do
not supply an 'after' list, the 'requires' list will be used in its place.
Same format as 'requires'.

}

Enough of the That!!!

So this is what mine looks like

Don’t forget to save it!!

Now we are going to make a few basic modifications to the game itself!

I like the site http://147.28.0.58/supcom/index.php it was posted by one of the GPG employees on the forums. It contains all the unit specifications but the reason I like it because it gives you the filename for that unit. So I will go in there and find a unit I like.

I chose Aeon Vehicle: T1 Light Tank: Aurora.

In the address bar after I clicked it gives me the unit code which is ual0201

In Crimson Editor: I choose file > new and I enter in

UnitBlueprint {
    Merge = true,        -- Merge = true  leaves the original file intact and only modifies what you change
    BlueprintId="ual0201",
}

Save as mod_units.bp

Now I go to the working_space\original\units\units\UAL0201
and open up the file UAL0201_unit.bp

I scan through and find the things that I decide I want to change

Ignore the audio, mesh, movement effects, and well most of it.
Buffs are for veteran status when you get enough kills

I want to change Defense so I select and copy the following and paste it into mod_units.bp

    Defense = {
        ArmorType = 'Normal',
        Health = 140,
        MaxHealth = 140,
        RegenRate = 0,
    },


I also think it’s a little pricey!! So I grab the economy section as well. It could gather more Intel!

Economy = {

        BuildCostEnergy = 26,
        BuildCostMass = 5,
        BuildTime = 13,
    },
    Physics = {
        MaxAcceleration = 10,
        MaxBrake = 25,
        MaxSpeed = 25,
        MaxSpeedReverse = 8,
    },
    Intel = {
        VisionRadius = 200,
    },

Now that those are in my mod_units.bp I will change it

I will change health and max health to 2800
and I will change economy to buildcostenergy and mass to 26 and 5 respectively.
I will change buildtime to 13

Now you may wonder what about the rest? If it is not being modified you can remove it. Because you are making a mod that MERGES with the original file, anything that is not here will be in the original file.

I also decide I want to change the weapon but there is a lot of stuff in the weapons category!!!

So I will extract only the stuff I want.

Weapon = {
	{
		Damage = 40,
		MaxRadius = 26,
	},
},

I change those to 400 and 260 respectively!

Now I think I am do modifying that unit. This is how it should look. I changed some numbers

Now you will have 2 files a .lua and a .bp file

Put them in a folder called “MyFirstMod”

And put it into main folder “THQ\Gas Powered Games\Supreme Commander\mods\MyFirstMod”

 

Go test it out!!!

 

Oh wait! It didn’t work? You couldn’t find it in your mod manager?!?!

 

You need to make sure you have proper file names

Rename “my_first_mod_info.lua” to “mod_info.lua”

Supcom requires that your mod info be in that format. If it isn’t, it will not work!!

Though the .bp doesn’t matter you could have named it “goushdgfuih342.bp” and it will work. The reason for that is because it identifies by

BlueprintId="ual0201", which is inside the file

 

Notes: