Andrettin wrote:The game is very moddable, and it shouldn't be difficult to make a mod that does things like adding units and etc. The game checks for mods in the /mods/ folder; basically, you need a folder there for your mod, and within that folder at least these two files: one called info.lua, and another called main.lua. In info.lua, you need to have the following line:
...replacing MOD_NAME for your mod's name. You can also have a similar ModDescription line in there which will contain you mod's description for the Mods screen (accessible from the main menu).
Now, for main.lua. In that file you would actually change the game with your mod. Let's say you want to add a Roman Legionary unit to the game in a mod. Your main.lua should then look something like this:
Code: Select all
DefineIcon({
Name = "icon-roman-legionary",
Size = {46, 38},
File = "mods/Legionary/graphics/latin/icons/roman_legionary.png"
})
DefineUnitType("unit-roman-legionary", { Name = _("Legionary"),
Parent = "unit-template-infantry",
Civilization = "latin",
Image = {"file", "mods/Legionary/graphics/latin/units/legionary.png", "size", {72, 72}},
Animations = "animations-dwarven-axefighter", Icon = "icon-roman-legionary",
Corpse = "unit-human-dead-body",
Sounds = {
"selected", "click",
"dead", "basic-human-voices-dead",
"hit", "sword-attack",
"miss", "attack-miss"
}
} )
table.insert(editor_types, "unit-roman-legionary") -- adds the unit to the map editor
Note that you can load other .lua files in your mod's main.lua, so you don't have to keep everything in one file. For instance, you could move the aforementioned code from your mod's main.lua to a /scripts/units.lua file within your mod's subfolder, and load it in your main.lua with the following line:
Code: Select all
Load("mods/Legionary/scripts/units.lua")
...and everything would work just as before.
Once you have your mod in place, just go to the "Mods" screen from the main menu, select your mod and enable it (you need to restart the game for the mod to be loaded).
It should be relatively simple to add a way for modders to display an introductory briefing with scrolling text before a mission. In fact, I went ahead and added support for that now, and that will be present in version 1.0.3. To add a new quest, you would put code like this in your mod:
Code: Select all
Quests.TheMeadOfWisdom = {
Name = "The Mead of Wisdom",
Icon = "dwarf/icons/durin",
Description = "The sage of Modsognir's clan has disappeared, taken by two dwarves called Fjalar and Galar. Modsognir has sent Durin to enter their hall, rescue the sage - or what remains of him - and bring the evil pair to justice.\n\nMap: Fjalar's and Galar's Hall\n\nRewards: 2 Dwarven Technology Points.",
World = "Nidavellir",
Civilization = "dwarf",
TechnologyPoints = 2,
Map = "maps/nidavellir/fjalars-and-galars-hall.smp",
Scenario = "scripts/dwarf/scenarios/the_mead_of_wisdom.lua",
X = 1,
Y = 1,
PlayerColor = "red"
}
The scenario file is what is processed after the map is loaded, adding triggers, placing quest-specific units and so forth (this allows different quests to easily use the same map). After v1.0.3 is released, to add a scrollable briefing, you would just need to put in something like this within the quest definition:
Code: Select all
Briefing = "The sage of Modsognir's clan has disappeared, taken by two dwarves called Fjalar and Galar. Modsognir has sent Durin to enter their hall, rescue the sage - or what remains of him - and bring the evil pair to justice.",
Here's how it would look like:
Allowing for branched quests would be a bit more complicated, because the game checks within the completed quests to see which quests are unlocked. I already have an idea on how to accomplish that, though. It is definitely something I want to add support for.
To alter which building produces what unit and etc. is relatively easy (you only need to define the proper buttons to do that). To make them show up correctly in the tech tree screen is a bit harder, though, if you want to add new unit classes (the tech tree in the tech tree screen is generated based on unit classes like worker, infantry, etc.). It is still possible, but would require a bit of Lua programming. If you want to make those "allied" units be available only in specific scenarios, then the way to go would be to define an upgrade which would allow that unit, and would be given to the player at the beginning of the scenario. You could, for instance, allow that unit only in scenarios of a particular branch in the campaign.
Yes, it is possible to define new UIs in mods, and to make them look like the classic one.
I have actually been considering whether it would be better to make the tech tree limitations be used only for quests, making skirmish games not have such limitations. Previously quests were accessed from the single player setup menu, but since now they have their own submenu, it might make more sense to do away with tech tree limitations for skirmish games. And yes, it would indeed be possible to bypass those limitations if you want in custom campaigns.
To make the game use only two resources, you would only need to redefine the worker units to not be able to harvest stone from rocks, and the change the UI files to make stone not appear.