Where's the best beginner how to mod tutorial?

@quietjoy

Like everyone else, I suggest looking into other mods. I have my whole mods folder set up as a git repo, so I can track my experiments and revert anything that isn't working. Try to make small changes, run the game locally and see if it works. Check the log for errors, you can bind it with a hotkey (Debug category --> "Toggles the debugging log window"). Use LOG() or WARN() functions if you want to print values/messages to the log window.

In general, I think you are better off just asking a bunch of questions here than trying to find a complete guide. Searching for specific solutions beyond the most basic things is usually futile.

When changing units you can loop through all units and make changes based on the unit blueprint, like this:

yourmodfolder/hook/lua/system/Blueprints.lua

do
    local oldModBlueprints = ModBlueprints

    function ModBlueprints(all_bps)
        -- Run the original code of this function, so we don't override it. 
        -- Common practice when extending/hooking existing FAF functions
        oldModBlueprints(all_bps)

        for id, bp in all_bps.Unit do

            if bp.Economy.StorageEnergy then
                bp.Economy.StorageEnergy = bp.Economy.StorageEnergy * 2
            end

            if table.find(bp.Categories, "AIR") and not table.find(bp.Categories, "FACTORY") then
                if bp.Intel.VisionRadius then
                    bp.Intel.VisionRadius = bp.Intel.VisionRadius * 1.5
                end   
            end

            -- ...ETC
        end
    end
end

Anything specific you're stuck with at the moment?

What kind of UI mod do you have in mind?

How would i do a simple UI mod, for example making it so when I click on a radar the game does not play any sound?

Politely bumping this again as i would like to make some basic sounds mods. I find the noise of the T2 mobile arties and Torpedo bombers to be like a drill in my brain. Nothing wrong with the sound as such but it's the constant incessant repetition of them is just absolutely brutal. As soon as anyone on the map makes a T2 arty unit and sets it firing at an enmy tmd, that's it, you are now hearing that noise for the next 20 mins on a loop. Brutal.
If I'm better asking somewhere else (Discord??) please let me know, thanks 🙂

@quietjoy said in Where's the best beginner how to mod tutorial?:

If I'm better asking somewhere else (Discord??) please let me know, thanks 🙂

You're (probably) better off asking elsewhere (Discord) - try the modding channel:
https://discord.com/channels/197033481883222026/832710161847287819

@quietjoy Unit specific sounds maybe hard to modify as just a UI based mod. Specifically your looking at a UI mod that has interaction with the SIM side of the game. While it's not impossible, it isn't going to be easy.

Question: Are you referring to their attack sounds or their on selection sounds? If it's the latter, this shouldn't be too much to mod, as you'd be telling the UI to ignore a specific set of units sound events during mouse-over or on-click. Unfortunately, most of my experience has been with SIM side mods otherwise I'd try building this for you.

@quietjoy Missed your messages, feel free to @ me next time. Here is a working example SelectionSounds.zip

mods/SelectionSounds/hook/lua/ui/game/selection.lua

function PlaySelectionSound(newSelection)
    if playSelectionSound then
        for k, unit in newSelection do
            local bp = unit:GetBlueprint()

            if EntityCategoryContains(categories.TECH1 * categories.STRUCTURE * categories.RADAR, unit) then
                return
            end

            if bp.Audio.UISelection then
                PlaySound(bp.Audio.UISelection)
                return
            end
        end
    end
end

Check the FAF files in the fa/lua/ui folder, to see what you can "hook", thats how you override the base files. Often you want to store the original function and run it after your code, but in this case it's not useful. Will not be compatible with other mods that hooks this function though.

https://github.com/FAForever/fa/blob/b3e14934761f3a8da7adbd845bcf2d52aeefb9e9/lua/ui/game/selection.lua

Check fa/units to see what categories you want to target, or you could target specific unit IDs.

Actually, I decided to update the code to be more useful for your needs:

local disableSoundsForUnitIDs = {
    "url0001", -- Cybran commander
    "url0105" -- Cybran engineer
}

local disableSoundsForUnitCategories = {
    categories.STRUCTURE * categories.RADAR,
    categories.BOMBER * categories.ANTINAVY,

    -- Add mobile artillery as an exercise, you can find suitable categories to target in the unit file :)
}

function PlaySelectionSound(newSelection)
    if playSelectionSound then
        for k, unit in newSelection do
            local bp = unit:GetBlueprint()

            -- LOG(unit:GetUnitId()) -- Uncomment to print unit id in log when selecting them

            local unitID = unit:GetUnitId()

            if contains(disableSoundsForUnitIDs, unitID) then
                return
            end

            for k, v in disableSoundsForUnitCategories do
                if EntityCategoryContains(v, unit) then
                    return
                end
            end

            if bp.Audio.UISelection then
                PlaySound(bp.Audio.UISelection)
                return
            end
        end
    end
end

function contains(table, val)
    for i, v in ipairs(table) do
        if v == val then
            return true
        end
    end
    return false
end

I picked up modding by simply following the examples left by the game dev's. Going into the Lua, projectile, moho and Unit folders can be enlightening and intimidating all at the same time. One of the strongest tools here is your zip file compiler, as they often have search capabilities for files and keywords within files. Makes looking for example material a snap.

Note: Don't mod the original files, ever! Strongly suggest making them read-only when you intend to browse.

@freadyfish would be cool if the selection sounds for units could be toggled by the UI. Essentially using a options toggle to active a table of units provided by the player.

@resin_smoker

Indeed!

If anyone wants to collaborate: https://github.com/FreadyFishFAF/SelectionSounds

It is not at the top of my priority to add the UI but if you or someone wants to work on it I'll be there to help!

I uploaded it to the mod vault. By default it will disable all selection sounds if not configured otherwise.

@freadyfish for now your fine with an override mod, but I'd suggest moving towards a UI based method at some point. Simple reason, its more likely to be widely adopted, and thus less like to viewed as SIM cheater mod.

As for helping out, hit me or any of the other mod-dev's up if you get mega stuck.