Page 1 of 3

Basic Mod Questions

PostPosted: 10 Oct 2018, 05:31
by Crazy Cossack
Hello, I need some basic info to get started in modding.

1. How do I get a unique UID for my mod?

2. Where is the mod directory or where are all the mod directories (if there are more than one).

Explanation for question 2:

I found one mod directory on my pc in C:users/%username%/Documents/My games/Gas Powered Games/Supreme Commander Forged Alliance/Mods.
In that mod directory are a few mods I downloaded from the the Vault, namely Common, EM and UI-Party.
However, the other old standard GPG mods (very simple examples like 2x Res) are not there.
Where are the other mods and where are the FAF mod itself and other major mods of FAF like Nomads etc. Can I view their code?

3. Also in C:/program files(86)/steam/steamapps/common/Supreme Commander Forged Alliance/gamedata there is a files called mods.scd.
This seems to contain info about other mods. What does this file mean and what does it do exactly? Does it implement some more mods?

Re: Basic Mod Questions

PostPosted: 10 Oct 2018, 06:28
by Anihilnine
unique id - just invent a random number. there are websites that do this. i made one for you: 64867d1f-b4f8-421b-8dc0-30a058305846. You might have to remove hyphens i cant remember

normal mods from the mod vault that you have downloaded are in documents like you said.

not sure where the built-in ones (like 2x res) are but perhaps mods.scd is the answer. SCD files are zips - copy the file, rename to zip, extract to see the mod. Move the extracted files somewhere else to avoid being confused about if it is using the extracted version instead of the SCD version.

in c:\programdata\faforever\gamedata there are the FAF mod itself and probably things like Nomads. They are "nx2" files but once again they are just zips so copy, rename, extract, move somewhere else.

You can also see the FAF mod content on github.

Re: Basic Mod Questions

PostPosted: 10 Oct 2018, 07:40
by Crazy Cossack
Annhilnine, Thank you for your patience. I think I finally found it. Only after getting Windows 10 to search for compressed folders. OMG Windows 10 file search is hard to use. I miss Windows XP.

Re: Basic Mod Questions

PostPosted: 10 Oct 2018, 08:21
by Anihilnine
you just need to display hidden folders and go to

Re: Basic Mod Questions

PostPosted: 10 Oct 2018, 23:37
by Crazy Cossack
I need some links to good explanations of hooking code (non-destructive and destructive) in Sup Com / FA / FAF.

When I modded Cossacks 3, the method was to replace one or more whole script file(s) with the modded whole file(s). The scripts are written in object pascal. Even if I was just changing a few parameters in a large file, I had to destructively replace (or hook) that whole file over the vanilla game file. Their mod manager automatically did the file replacements or overwrites during load. This meant I was using the tools Notepad++ for file editing and WinMerge to merge new patch code after a patch or new version release, if the release affected the file in question. So I am familiar with those tools. Each patch or release would break the mod if the patch changed files that the mod had changed. Then I had to use WinMerge to compare files and place the new patch code into my modded file(s). At the same time, I had to be careful to not overwrite or lose any of my modding changes already in that file. So, I guess you could say the modding method provided by Cossacks 3 was destructive hooking at whole of script file level. A new release or patch often broke the mod which led to lots of maintenance.

If I was just changing some parameters of units (in the blueprint files) in FAF (as a learning exercise) how would I go about hooking these changes in? Take the simplest example. Imagine I was changing the health of the UEF ACU (in UEL0001_BP) what would be the simplest, most elegant way to hook that?

Footnote: I got sick of patches always breaking my Cossacks 3 mod and in the end I stopped supporting it. Cossacks 3 was released in a poor state and needed constant patches to fix the multiple problems it had. Every patch broke my mod and it took hours of comparing and merging to fix it each time. That left too little time and energy for new changes.

Re: Basic Mod Questions

PostPosted: 11 Oct 2018, 00:27
by Uveso
In SupCom you can hook a single function from a scriptfile.

Here an example for a non destructive hook from another topic:
(hooking the SetVeteranLevel function inside the unit class)
Code: Select all
-- Save the original Unit class
local oldUnit = Unit

-- Crate a new unitclass with all functions from the old Unitclass
Unit = Class(oldUnit) {

    -- Noe we are overwriting the original SetVeteranLevel  function.
    SetVeteranLevel = function(self, level)

        -- first lets call the old original SetVeteranLevel function.
        oldUnit.SetVeteranLevel(self, level)

        -- now we can add our own stuff
        -- Maybe add a Name to the unit with Vetaran Level:
        self:SetCustomName('Veteran Level '..level)


Re: Basic Mod Questions

PostPosted: 11 Oct 2018, 00:46
by Anihilnine

^ this post explains hooking well. once you understand how the concat works everything makes sense. Let me know if u don't get it

Re: Basic Mod Questions

PostPosted: 11 Oct 2018, 23:40
by Crazy Cossack
I can do basic hooking now, at least to the blueprint files. I guess hooking to other files is the same principle.

My main need now is to understand the best way to test changes. I've been going in and hosting FAF Sandbox games for myself to test, LOL. I am sure this is not the way I really should be testing initial changes. I assume I should be starting FAF on my PC outside the Game Lobby and testing in that manner. Do I just start the faf.exe or is there a .bat or initializing file to run? I guess I need to know cheats too so I can drop enemy units on the map and attack them in tests. All help is appreciated. :)

Re: Basic Mod Questions

PostPosted: 12 Oct 2018, 00:53
by Anihilnine
you can just run the exe to launch the game, supcom.exe or whatever it is from programdata. however its better to make a batch file so you can include the command line arguments to watch files. when u enable this it will pay attention to many code changes without having to restart.

turn cheats on and your mod and make game speed adjustable so +\- speed things up.

alt-f2 spawns a unit and allows u to change armies (play as the enemy)
alt t teleports I think
I set up other keys like instability

ctrl f10 restarts an AI match without having to do the lobby.

f9 shows debug log where u will find errors.

when u screw up the error log will be huge and the game will be mostly unrecoverable... restart (control f10) works often but sometimes u have to kill the process

Re: Basic Mod Questions

PostPosted: 12 Oct 2018, 00:53
by Anihilnine
(I answer u on my phone so I can't give precise info)