(Unofficial) Cossacks 3 Mod Manager

Discussion in 'Modding' started by Lieutenant-Général, Oct 1, 2016.

  1. Lieutenant-Général

    Lieutenant-Général Active Member

    Latest version:1.4.7
    Python sources

    If you update c3mm version from <1.4.5, please delette your "c3mm" folder and check your game cache integrity. All mod in format "json" keep compatible with >1.4.6 versions.

    Presentation
    Hi!

    A little tools to help modding text file.
    It is quite ineffective to replace a file which contain thousand of line in order to change one or two lines... And two mods which replace the same file will be incompatible!

    You can also use this tools to remove / add / replace file of the game, likes textures or musics.

    So i write this little tools/

    Report any bug in this thread!
    [​IMG]

    Changelogs:
    1.4.7

    -Some code enhancement
    -Add "@add_folder" command
    -Add "@add_all_file_of" or "@afo" command

    1.4.6
    -Now c3mm work like an official mod, you have to activate it in official manager panel.

    1.4.5
    -Support .c3m files

    1.4.4
    >Real multi-line, not a fake like 1.4.3

    1.4.3
    -Add an "option" field and a "optionpath" field.
    -Add multi-line
    -Re-write code from tkinter GUI lib to easytk

    1.4.2
    -Correct a bug occured when a mod isn't valid and user press "install_all"
    -Some intern modifications
    -Add a "config" field
    1.4.1
    -Graphics ameliorations
    -Fix a bug occured when a mod isn't valid (thank to Vova Dumanskiy for report)
    -Add few feed back in case of an invalid mod.
    -Now log.txt save only last session.
    -Now, show an alert if a new version of a mod is detected.
    -Now, Mod Manager don't relaunch after each install/uninstall

    1.4.0
    -Add a gui!
    -Remove file verification, that was be very ineffective. Now, after a cossacks3 update, the best way is to delete "c3mm" folder and check your game cache in steam before manager launch.
    -Remove console options.

    1.3.13
    >Missing "sys" import. fix
    >Fix a bug occured when use "" in modname

    1.3.12
    >If you double-click on c3mm, the window will stay open and you can write in.
    >c3mm is now available in stand-alone version (work without python)

    1.3.11
    >Fix bugs

    1.3.10
    >New commands installs and uninstalls
    >New command install_all, which install all mods of mod folder
    >c3mm.json is most easy to read
    >Fields "remove_file", "add_file", "modify_file", "replace_file", are now optional
    >Fix some bugs

    1.3.9

    >Now program add signature only on .script file

    1.3.8

    >Fix bugs

    1.3.7
    >Fix bugs

    1.3.6
    >New command "info"
    No new features, but a lot of bugs fixed

    1.3.5

    >Change field name. There are now
    -"modify_file" in place of "file"
    -"replace_file" in place of "otherfile"
    -"add_file" in place of "addfile"
    (you can use old name, but isn't recommended)
    >Add a new field "remove_file"
    >Improve error messages.

    Warning : "remove_file" contain a list, not a dic:
    Code:
    "remove_file":[
        "file1",
        "file2",
        "file3"
    ]
    1.3.4

    >Fix some bug
    >You can now add files with field "addfile"

    1.3.3
    >Now, mod file has a field 'otherfile'. Use this to replace a file by an other. Two mods can't replace the same file

    To use :
    Code:
    "otherfile":
    {
        "music/drummer.ogg":"pouet.ogg"
    }
    In this exemple, "pouet.ogg" must be placed in "mod" folder.
    Hint : content of file will be modified but name of file "music/drummer.ogg" don't change

    All 1.3.2 mods and installations are compatible with c3mm.py 1.3.3

    1.3.2

    >Now, mods have a field "author"
    >Now, program check mod format to avoid crash in case of bad-writing mod
    >Add a new command "valid_mod" for modder. Type python c3mm.py valid_mod modname
    >In some case, files aren't saved. It is now fix.

    Hint for modder : Format mod could change in the future (i hope no, but...), so i ask the modder to give c3mm version compatible with her mods.
    Of course, i tell you all format modifications.

    1.3.1
    >Now, if a file has been modified since last c3mm launch, program check if mods are corrupted before uninstall it and not uninstall it by defaut.
    >Add some commentary in modded file to be sure modded lines are uniques.

    1.3.0
    > Re-writing the script, simplify and normalize data use and adding some
    commentary
    > Now mods and configs files are stored in .json files
    > Now mods are check before install
    > Now give just the name of the mod without extension (mod in place of mod.json)
    > Patching file function are modified to save file in case of an unexpected error during patching
    > If the program failed to uninstall a mod, it will restore all corrupted files
    > New command uninstall_all
    > New command giveall, which print all installed mod
    > Now logs are saved in "c3mm/logs.txt"


    In case of bugs, in this topic post:
    >A screen of your console
    >A screen of your cossacks3 folder
    >A screen of your mod folder
     
    Last edited: Jan 9, 2017
    BombaRuLz, StriKe jk and Fimti like this.
  2. A. Soldier

    A. Soldier Active Member

    Very nice, perhaps you and iOrange (engaro on here) would make a great combination of coders.

    If you're interested, we have a modding group that you can join.

    Keep up the good work.
     
  3. Lieutenant-Général

    Lieutenant-Général Active Member

    Documentation

    Users tutorial

    Paste c3mm.exe in your Cossaks3 folder (program file/steam/steamapps/common)
    Create a "mod" folder. Past in this folder all mod file you want.
    To install/unistall a mod:launch 3mm.exe
    Launch the official mod manager and active "c3mm"

    Modder tutorial
    Create a file mod.c3m
    Note : all ligne with a "#" at first position will be ignored
    Open it and write:
    Code:
    @name mod's name
    @version mod's version
    @info what you want!
    @author your name/pseudo...
    Next, if you want replace text "blabla" of X file by "bla
    blabla" and text "azerty" by "qwerty", write
    Code:
    @in X
    @replace
    blabla
    @by
    bla
    blabla
    @replace
    azerty
    @by
    qwerty
    
    Now, if you want add the file Y to the location "script/lib":
    Code:
    @add script/lib/Y Y
    (You must give Y with your mod)

    You can also add an entire repertory using
    Code:
    @add_folder big_folder_with_lot_of_file
    
    Or all file of a directory:
    Code:
    @add_all_file_of directory
    
    But this is quite long, so you can also use "@afo" in place of "@add_all_file_of"
    New, if you want replace file "bapipe.ogg" by "pouet.ogg"
    Code:
    @replace_file bagpipe.ogg pouet.ogg
    (You must give pouet.ogg with your mod)

    Next, copy mod.c3m in your cossacks3/mod folder with all concerned files.

    Structures of mod files
    All mods stored in .json files. (c3m are converted in json by the mod manager)
    A strucure of a mod is:
    Code:
    {
       "name":"name of your mod",
       "version":"version of your mod",
       "info":"write what you want!',
       "author":"name of the mod author",
    
       "modify_file":dictionary of (filename => dictionary of (oldtext => newtext)),
       "add_file":dictionary of (paste_location => file_to_past_location),
       "remove_file":list of filename,
       "replace_file":dictionary of (oldfile => newfile),
    }
    Hint: dictionary syntax:
    Code:
    {
       key1:value1,
       key2:value2
    }
    Hint: list syntax
    Code:
    [elem1, elem2, elem3]
    C3mm working:
    Code:
    for file in modify_file do
        for oldtext in modify_file[file] do
            replace oldtext by newtext
        endfor
    endfor
    
    for file in add_file do
        copy file_to_past_location to paste_location
    endfor
    
    for file in replace_file do
        replace oldfile by newfile
    endfor
    
    for file in remove_file do
        remove file
    endfor
     
    Last edited: Jan 9, 2017
  4. StriKe jk

    StriKe jk Member

  5. Lieutenant-Général

    Lieutenant-Général Active Member

    1.2.0
    >Now, you have to place your mod in a "mod" folder.
    >All config file save in a "c3mm" folder
    >Now, at all launch program will check all modded file. If one file has been modify, the program will uninstall all concerned mod.
    >Fix some bugs.
     
  6. Lieutenant-Général

    Lieutenant-Général Active Member

    1.2.1
    >Fix a bug when an error is occurred during mod install
    >If the text to change isn't find, the program gives you a warning
     
  7. StriKe jk

    StriKe jk Member

    I played around with it a bit but it seems very unstable. Mostly in the case if something doesn't work right. If it can't find the string it still says that the patch is completed (even tho it isn't) and if you repatch multiple times with increasing increasing version numbers and change the file name into a different (but valid) one while doing so it forces a backup which also seem to fuck up from time to time. Sadly I hadn't had much luck reproducing.

    Just play around with this and you will find them yourself:
    change this:
    Code:
       // turn off bcheckfriendonline
       _weapon_SetWeaponCheckFriendOnLine('STRELA', False);
       _weapon_SetWeaponCheckFriendOnLine('OSTRELA', False);
       _weapon_SetWeaponCheckFriendOnLine('SHOTMUSKET', False);
       _weapon_SetWeaponCheckFriendOnLine('SHOTBLOCKHOUSE', False);
       _weapon_SetWeaponCheckFriendOnLine('NUCLGRE', False);
       _weapon_SetWeaponCheckFriendOnLine('PSMPOINTTPUS', False);
       _weapon_SetWeaponCheckFriendOnLine('DIMMORT1', False);
       _weapon_SetWeaponCheckFriendOnLine('DIMMORT2NEW', False);
       _weapon_SetWeaponCheckFriendOnLine('PSMPOINTT', False);
       _weapon_SetWeaponCheckFriendOnLine('DIMMORT2KOR', False);
    into this:
    Code:
       // turn off bcheckfriendonline
       _weapon_SetWeaponCheckFriendOnLine('STRELA', False);
       _weapon_SetWeaponCheckFriendOnLine('OSTRELA', False);
       _weapon_SetWeaponCheckFriendOnLine('SHOTMUSKET', False);
       _weapon_SetWeaponCheckFriendOnLine('SHOTBLOCKHOUSE', False);
       _weapon_SetWeaponCheckFriendOnLine('NUCLGRE', False);
       _weapon_SetWeaponCheckFriendOnLine('PSMPOINTTPUS', False);
       _weapon_SetWeaponCheckFriendOnLine('DIMMORT1', False);
       _weapon_SetWeaponCheckFriendOnLine('DIMMORT2NEW', False);
       _weapon_SetWeaponCheckFriendOnLine('PSMPOINTT', False);
       _weapon_SetWeaponCheckFriendOnLine('DIMMORT2KOR', False);
       _weapon_SetWeaponCheckFriendOnLine('PPOINTTTOW', False);
    in:
    Code:
    data/scripts/lib/weapon.script
     
    Fimti likes this.
  8. Lieutenant-Général

    Lieutenant-Général Active Member

    I see what is wrong in my program, but can-you give me your mod file?

    WIP:
    >Check the mod before install
    >Write mod file in json

    Ex mod.json:
    Code:
    {
    "name":"MyFirsttMod",
    "version":"1.0",
    "info":"The fist mod i maked!",
    "file":{
        "lib/unit.script":{
            "pikeman.slash = 2":"pikeman.slash = 0"
            },
        "lib/ia.script":{
            "be_inteligent = false":""be_inteligent = true"
           }
        }
    } 
    If think this can be better for modder.
     
  9. Lieutenant-Général

    Lieutenant-Général Active Member

    1.3.0

    > Re-writing the script, simplify and normalize data use and adding some
    commentary
    > Now mods and configs files are stored in .json files
    > Now mods are check before install
    > Now give just the name of the mod without extension (mod in place of mod.json)
    > Patching file function are modified to save file in case of an unexpected error during patching
    > If the program failed to uninstall a mod, it will restore all corrupted files
    > New command uninstall_all
    > New command giveall, which print all installed mod
    > Now logs are saved in "c3mm/logs.txt"

    I think this update fix your problem, Strike.
     
  10. StriKe jk

    StriKe jk Member

    How can I add new lines to a text with this?
     
  11. Lieutenant-Général

    Lieutenant-Général Active Member

    If you want add line "1234567" under ligne "azerty" in file "qwerty":
    Code:
    "qwerty":{
        "1234567":"1234567\nazerty"
    }
    
    "\n" is the end-line marker.

    All "go to the line" must replaced by "\n".
    If your text is some big, in notepadd++ select-it, press Ctrl+F, click "replace", in search mod check "entend search", in search field enter "\r\n" and in the replace filed entre "\\n", and finally press "replace all".
     
  12. Lieutenant-Général

    Lieutenant-Général Active Member

    1.3.1
    >Now, if a file has been modified since last c3mm launch, program check if mods are corrupted before uninstall it and not uninstall it by defaut.
    >Add some commentary in modded file to be sure modded lines are uniques.
     
  13. StriKe jk

    StriKe jk Member

    Is that why you added the signature behind the changes? I was wondering about that number string :D
     
  14. Lieutenant-Général

    Lieutenant-Général Active Member

    Yes ;)
    If you want, i can add an option to personalize them, like mod name plus a number or what you want, or an option to disable them.
     
  15. StriKe jk

    StriKe jk Member

    I'm starting to adopt my mods to your mod manager now, it seems stable enough for me and really helps out with frequent patches and stuff. :cool:
    It would be cool if you could include an Author string into the mod which also goes into the personalized signature together with the mod name. This will help out later if you have multiple mods working on the same file from different modders.

    Also I start to wonder what happens if you edit and over an edit, I guess I have to test it out sometimes.
     
  16. Lieutenant-Général

    Lieutenant-Général Active Member

    You already can put name of author in "info" field, but i will add an "author" filed.

    Please report me any occurred bugs!
     
  17. Lieutenant-Général

    Lieutenant-Général Active Member

    1.3.2

    >Now, mods have a field "author"
    >Now, program check mod format to avoid crash in case of bad-writing mod
    >Add a new command "valid_mod" for modder. Type python c3mm.py valid_mod modname
    >In some case, files aren't saved. It is now fix.

    1.3.2 version is compatible with 1.3.1 installations but can't install mod without "author" field. (sorry Strike :| )
    In doubt, use 1.3.1 version.

    Hint for modder : Format mod could change in the future (i hope no, but...), so i ask the modder to give c3mm version compatible with her mods.
    Of course, i tell you all format modifications.
     
    Fimti likes this.
  18. Lieutenant-Général

    Lieutenant-Général Active Member

    1.3.3
    >Now, mod file has a field 'otherfile'. Use this to replace a file by an other. Two mods can't replace the same file

    To use :
    Code:
    "otherfile":
    {
        "music/drummer.ogg":"pouet.ogg"
    }
    In this exemple, "pouet.ogg" must be placed in "mod" folder.

    All 1.3.2 mods and installations are compatible with c3mm.py 1.3.3
     
  19. Lieutenant-Général

    Lieutenant-Général Active Member

    I add a list of compatible mod in first post.
     
  20. Lieutenant-Général

    Lieutenant-Général Active Member

    1.3.4

    >Fix some bug
    >You can now add files with field "addfile"
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice