Where's the best beginner how to mod tutorial?
-
@quietjoy With regards to modifying some unit properties, I'd suggest having a look at Balthazar's SupCom Mod Tutorials Wiki. Balthazar is the creator of the popular BrewLAN mod & is very active in the community.
-
I started with no modding experience and only very minimal coding experience. Being a total noob, I found this (somewhat outdated) guide a very useful starting point.
https://supcom.fandom.com/wiki/Unit_Creation.
Next was having a list of all the Supreme Commander LUA functions. Since the list doesn't really explain how these functions work, I would then search the FA GitHub to see how others had implemented them (note: you need to create a free GitHub account to be able to search for code).
List of SC Lua functions:
https://supcom.fandom.com/wiki/LUADOC_1.5.3599FA GitHub:
https://github.com/FAForeverAnd another useful step that is really helpful is to download a mod that is similar to what you are wanting to do and study their code to see how it is set up. Like, if you want to add your own unit, download a mod that adds a single new unit and see how the folders are organized, etc.
Then, when you try running your mod and nothing happens, pull up the FAF log of the game and search for "error". If there are errors in your mod, it will usually tell you the exact line and function to check.
One more useful resource is the Unit Database, if you are working on units. You can quickly check the GitHub of the unit, which will bring you to the unit's blueprint file. From there, you can quickly access the unit's script. If you aren't sure how to get something working, just check how a current unit that has those abilities works and use that as a template.
https://faforever.github.io/spooky-db/#/
This is a useful guide explaining what does what in the blueprint file.
https://wiki.faforever.com/en/Development/Modding/Blueprints
-
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.
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.
-
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.