Hi, how to mod Wyrmsun ?

Wyrmsun is an RTS / Grand Strategy game which features elements of mythology, history and fiction.
Post Reply
User avatar
Eagle 11
Posts: 5
Joined: Fri Sep 25, 2015 7:53 pm

Hi, how to mod Wyrmsun ?

Post by Eagle 11 »

Exactly what it says in the title :p

Long version: There is built in mod-loading capability but no documentation on preparation of one ?
MrFlibble
Posts: 55
Joined: Mon May 04, 2015 11:37 pm

Re: Hi, how to mod Wyrmsun ?

Post by MrFlibble »

Hello!

A while ago I asked Andrettin a similar question in another forum, and he gave quite a detailed answer:
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:

Code: Select all

ModName = "MOD_NAME"

...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:

Image

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.
User avatar
Andrettin
Posts: 433
Joined: Sun Jun 30, 2013 9:58 pm
Location: Vienna, Austria
Contact:

Re: Hi, how to mod Wyrmsun ?

Post by Andrettin »

MrFlibble wrote:Hello!

A while ago I asked Andrettin a similar question in another forum, and he gave quite a detailed answer:
Thanks for answering his question, MrFlibble :)

Here is the modding Q&A I posted on the IndieDB page, for future reference:

1. Question: Which files do I need to create a mod?

Answer: You need at least an info.lua and a main.lua file. The former is preloaded by the game to display the mod's name in the mod screen, while the latter contains the mod's actual code.

2. Question: What structure should info.lua have?

Answer: info.lua should have the following fields (replace "STRING" with the text you want to have, in quotes):
ModName = STRING
ModDescription = STRING (optional)

3. Question: What path should I use to load files within my mod's folder?

Answer: Use paths like this:
ModPath .. "gold_mine_rail.png"

In this example, this would load gold_mine_rail.png in the mod's main folder (you can use subfolders if you wish).

4. Question: How do I edit a unit type's stats in the editor?

Answer: Right-click on the unit type's icon in the unit type list.

5. Question: How do I play a map I created?

Answer: In the custom map screen, choose the "Custom" world, and then select your map from the map list.

6. Question: Where are mods located?

Answer: In the /Wyrmsun/mods/ folder.
User avatar
Eagle 11
Posts: 5
Joined: Fri Sep 25, 2015 7:53 pm

Re: Hi, how to mod Wyrmsun ?

Post by Eagle 11 »

Thanks again through here too.

Creating the Oil resource in addition is easy, in the end its just 'black gold'. Clone goldmine rock as oil patch, structure as oil rig and give the appropriate graphics for all.

There is an 4th resource im thinking about: 'Manacrystal', now for how that functions: It appears as an container(resource container, think visually an crystal) that spawns on its own, specially designated for this purpose tile(an powernode of sorts, like the runestone) at regular intervalls(long).
This container starts with an small amount(like only 50) and slowly matures over time gaining more(with an upper cap of like 150), but only aslong its left staying untouched on that tile. It doesnt spawn at game start, only after an certain time has passed the nodes get activated. This could be configured in the scenario to be each node his own or even all at once.
It is harvested by worker unit just like an gold rock, hacks at it ten times and then carried back to nearest Magician production structure for +25 bonus or to any Townhall building for flat gain.
This resource would be the slowest amassing, it's main purpose is to help keeping spellcasters actually rare in the battlefield as both training an spellcaster and actually casting an spell requires varying amounts of this resource, and ofcourse used for researching the spells themselves too.
At training of casters its used in vital amounts (like primary casters as Mage or warlocks would require 25 per head, secondary caster like an ogre mage 20 per head, and support casters like an Priest 15 per head), at the spells themselves rather symbolic amounts(cast summon water elemental needs only 4, auto-heal 0.5 per cast, blizzard 6, etc. since they already use mana and this does not replace the manabar mechanic).
Then there is manacrystal resource's secondary purpose of boosting spellpower, it's like 2% boost per 15 manacrystal(the amounts here are only for example and subject to change) that player has remaining in store at the moment of casting the spell, the spellpower modifier here basically functions as +dmg(could be increased AoE for poison cloud, eg. spells that are already strong at base) on damage dealing spells, and -manacost(or maybe faster recharge times) on non-dmg spells, basically.
This secondary purpose of spellpower existing to create strategical depth, as an player can opt to hunt for crystal early and amass casters or make only a few that are but hardhitters, considerably contributing to his strategical capability.

Other things would possibly require are roads, selectable walls that can be converted to 2 tile wide gates that can be opened-closed manually(both horizontal and vertical variants).
User avatar
jarod42
Posts: 101
Joined: Fri Jan 20, 2012 7:43 pm

Re: Hi, how to mod Wyrmsun ?

Post by jarod42 »

ogre mage 20 per head
[joke]As magi-ogre got 2 heads, it will cost 40 ;-)[/joke]
User avatar
Eagle 11
Posts: 5
Joined: Fri Sep 25, 2015 7:53 pm

Re: Hi, how to mod Wyrmsun ?

Post by Eagle 11 »

jarod42 wrote:
ogre mage 20 per head
[joke]As magi-ogre got 2 heads, it will cost 40 ;-)[/joke]
:D

Another different idea is for how to limit natural overpoweringness of ranged unit blobs.
Archers would have an ammo mechanic, like having 15-20 arrows in the quiver before its empty, the ammo does get replenished where they are, wouldnt need to enter barracks or stand next to a wagon, but at an one by one rate and not before the unit being out of combat(must stay unattacked or himself not attacking for insertandurationhere then automatically begins the ammo replenishment).
Post Reply