Hi all. I'm not exactly great at modding, but I've recently learned quite a few things that I am happy to share. So, if you are interested in learning how to create your own balance mod, read on. Also, be aware that I do speak a few programming languages, but don't fully understand lua. Enough to get by, but that's about it.
Sorian provided a basic example for the community to use for modding called Boots of Better Speed. The boots of better speed mod can be downloaded here: http://sorian-ai-mod.googlecode.com/files/Boots%20of%20better%20speed.zip and was originally posted/discussed here: http://forums.demigodthegame.com/369563
Start by downloading the zip file linked above. Just extract it to your desktop for now and then open the folder that was created.
MOD_INFO.LUA
Open up mod_info.lua using notepad if you like. Take a moment to look over the file. Not alot of cool code going on here, but it provides quite a bit of information that will appear in the mod manager later. Sorian was kind enough to provide several inline comments in the lua code. For those of you not familiar with the language, -- means comment or REM in old dos speak. You can write notes, etc, in lua by inputing -- followed by text, etc. Moving on. The info that really makes a big difference is as follows:
exclusive = false
ui_only = false
uid = "48C629B6-09B1-11DC-9B89-F34356D89598"
Again, Sorian's comments come in handy. Exclusive can be set to true or false. If it's set to true, then this is the ONLY mod that can be active. I'm guessing most mods will have false as the value for this setting.
ui_only means this mod is a UI mod and can be used even if other players are not using it. Bottom line, you can have this type of mod running in MP even if no one else does.
UID - per Sorian, this has to be a unique value and he provided a link in the mod_info.lua file to a uid generator. I used that when I created my own mod. I don't know why or how the uid itself works within the mod, other than to say that it works within the mod.
Ok. We are done looking at MOD_INFO.lua for now. Let's learn some more. Start moving through the directories in the extracted zip file. Double click on hook, then lua, then common, then items and boom. Now you find a file called Boot_Items.lua. This is where the actual coding will take place for the mod.
BOOT_ITEMS.LUA
Open up the file in notepad if you like. Take a moment and look over the file now. Things that came to my mind initially was the naming conventions I was seeing. I know what Boots of speed means, but its tied somehow to ITEM_BOOT_0002 and Item_Boot_020. This also meant to me that most likely, all of the items in the game have some sort of other name (eg boots of speed is really item_boot_020 in the game). Anyway, going on that understanding, I wanted to figure out what the names were for the other items. This led me to dgdata.zip
DGDATA.ZIP
Find your demigod folder. For me, its "C:\Program Files (x86)\Stardock Games\Demigod". Double click on dgdata.zip. Remember a few steps back when we opened boot_items.lua? Well, we had to step through several directories to get there (hook\lua\common\items\). What we stepped through there is essentially what we'll step through in the dgdata.zip file. Click on lua, then common, then items. Notice what you see in the folder now? All of the code for various items is broken out into separate files. Take a look at boot_items.lua. Now, look back at the code for the mod that Sorian compiled. See how he simply copied and pasted information from this file there? If you dig a little deeper, you can see the exact changes that he made to give boots of speed a 200% buff instead of the default 10% buff. And you can follow the same process to make your own modified items.
Anyway, I played around with this for about 5 minutes and was able to make a simple mod that increased the health and mana for footman's sabatons.
How to make your own item balance mod
For now, just focus on creating 1 modified item. Pick some type of boots to simplify things for now. Pick one that you want to tweak and then move on. Use Sorian's mod as a template. Extract the zip file you downloaded. Rename the folder to whatever you want to call the mod. Update the mod_info.lua file with your info. Generate a new UID using the link Sorian provided and insert that into the mod_info.lua file. Save the mod_info.lua file. Open the boot_items.lua in both dgdata.zip and within your new mod folder structure. Go ahead and clear the results in the mod boot_items.lua. You'll be copying and pasting info from the dgdata.zip boot_items.lua. Find the item you want to modify in the dgdata.zip boot_items.lua. Select the appropriate item's code. For instance, if you wanted to modify the assassin's footguards, you'd start selecting the line above assassin's footguards in the code and copy all the way down to the final }. It should look like this:
########################
#Assassin's Footguards
########################
ItemBlueprint {
A BUNCH OF OTHER CODE THAT I'M NOT LISTING HERE
}
}
}
Select all of that code only and copy it. Flip back to your mod version of boot_items.lua (that you blanked out earlier). You'll paste this data in a moment, but you need to do one more thing. At the top of the file, type in the following:
do
Then hit enter twice. Now, paste the code in. It should look like:
do
########################
#Assassin's Footguards
########################
ItemBlueprint {
A BUNCH OF OTHER CODE THAT I'M NOT LISTING HERE
}
}
}
At the very bottom of the code after the last }, hit enter twice and enter the following:
end
So, the final product of your modded boot_items.lua file should look like this:
do
########################
#Assassin's Footguards
########################
ItemBlueprint {
A BUNCH OF OTHER CODE THAT I'M NOT LISTING HERE
}
}
}
end
Save the file. Examine the code for assassin's footguards now in your file. Modify the appropriate values to implement a change. For instance, change Evasion = {Add = 10}, to Evasion = {Add = 25},. Save the file again. Navigate to C:\Program Files (x86)\Stardock Games\Demigod\bindata\mods or whatever it is on your computer and paste the entire mod folder you created in there. Launch demigod, enable it in the mod manager, and try it out in single player or multiplayer vs an AI. See if you change took. Worked for me.