Aladore's tutorials : Items and loots edition, creation and generation for everyone !Edit

Hello everyone !
Following request and for everyone to be able to be able to play with this we'll today see how mod items at will, create any new gear we could want, and more important add our brand new stuffs in the game.
Once again : as I said in other threads around here I'm not at all a programmer. I got some basic notions of how a program work and how to read and eventually change a code. That's all. Why to say this in a modding tutorial ? Because if I can do this it means everyone can. And I'm at the moment basically able to change absolutely any basic aspect of the game.I can tweak and twist classes in every way I want, can change basic factors of the game for everything, can edit my save files at will, can change anything through existing magics, with existing monsters, can add whatever I want on the maps, can restart whatever I want. And so today it's everything for everyone about equipment modding.
All that I told you about just above is not in compiled files and so can be edited at will just with text editors. I recommand the use of WordPad if you do not have specific tools (I do not) or sometimes even noteblock because it can make some situations easier.
In this tutorial :
-modifying existing items (and relics).
-modifying existing affixes.
-creating new items (and relics).
-generating any item through saves edit.
-editing inventory through save edit.
-modifying loot of chest and monsters.
-modifying merchants offers.

First part : where to go ? Datas folders and files to edit.
1 - depending on your version (Steam,CD,Uplay,whatever...) locate your "Might & Magic X - Legacy" folder. If you have no idea how to do this Google is your best friend about this if it's not a personal installation. The Search option on your computer can probably also help. For Steam users it's : "C:\SteamLibrary\SteamApps\common\Might & Magic X - Legacy". Take note the "C:/" depends on the disk where your library is installed.
2 - Once the folder located, no big deal, follow this path "...\Might and Magic X Legacy_Data\StreamingAssets". This is the magical folder. Everything you need for everything above is in there ! Everything !
In "StreamingAssets" two folders will get our interest today : "StaticData", "Localisation" and "Dialog" (only for shop edit).
In "StaticData" you will want to edit depending on the kind of item you want to mod or add :
-Armor and ArmorModels
-Shields and ShieldModels
-Jewelry and JewelryModels
-MeleeWeapons and MeleeWeaponModels
-RangedWeapons and RangedWeaponModels
-MagicFocus and MagicFocusModels.
Absolutely everything about the game equipments is in these files.
Affixes are listed in :
and can be searched through with the ctrl+F research function.
You will also need "GeneratedEquipment" file about the shops offers.
In "Localisation" I will only bother with the "en" (for english) folder. Inside only one file named "loca". This one contains all textual details to display InGame. This file is insanely HUGE ! When you want to find any data inside of this just use the ctrl+F research command and type the code you want to find.

Now an eye at the code. As usual all informations you need are in the first line of each file describing all following information.
Once again and as usual take very good care of the ponctuation. One more or less comma and the game crash because it hase no idea what to do anymore. You must absolutely stick to and respect the construction of every file for every line. It's very easy with just a minimal amount of focus and once you know what you're doing.
Descriptive lines are just a list of datas. Datas are all separated the ones from the others by commas. Following lines are just the perfect reflect of this description except that they display the values and not the names of these datas.
More clear with an exemple :
Armor :
StaticID, Name, Icon, Price, Type, Subtype, PrefixID, PrefixLevel, SuffixID, SuffixLevel, ModelLevel, Level, RequiredXP, NextLevelItemID, Description, AC, BreakChance, RequiredSkillID, RequiredSkillTier, Identified
1, ARMOR_LIGHT_GARMENT_M1, ITM_armor_chest_light_1, 84, GARMENT, LIGHT_ARMOR, 0, 1, 0, 1, 1A, 0, 0, 0, (void), 9, 0.01, 12, NOVICE, TRUE
50, RELIC_THUNDERBLADES_HELMET_NAME, ITM_armor_helmet_might_relic_bonus, 1009, HEADGEAR, MARTIAL, 0, 5, 0, 5, 5A, 1, 1055, 51, RELIC_THUNDERBLADES_HELMET_DESC_1, 3, 0, 0, NONE, FALSE
51, RELIC_THUNDERBLADES_HELMET_NAME, ITM_armor_helmet_might_relic_bonus, 2571, HEADGEAR, MARTIAL, 8,5,0,5, 5A, 2, 2200, 52, RELIC_THUNDERBLADES_HELMET_DESC_2, 3, 0, 0, NONE, TRUE

Analyses :
Static ID : as always, the number ID of the item. If we ask the game to generate an armor ID 1 He will come in the Armor file and fetch the item with ID 1.
Name : self-explanatory. What you need to know though is that this obviously is not the true name of the item as shown InGame. It's a code for a line in the "loca" file where He will fetch the true name to display InGame. Why in Hell is it that complicated ? I have no idea at all... Programmer and computer language problems I guess.
Icon : self-explanatory, the picture displayed InGame for the item.
Price : value in gold of the item.
Type and subtype : they depend on the file and section you're in, and so the items listed there. It's quite the obvious so I will not list everything here.
Note : Just one thing about armor items : subtype "martial" and "arcane" is only used to ponderate the attributions of affixes during items generation. "Martial" are more alike to get let's say technical enchantment about fighting skills and combat attributes where "arcane" will get more magical enchantments like elemental, conditions, and agic skills related if I'm correct.
Prefix ID and level, Suffix ID and level : quite simple, the ID of both affixes (enchantment) refering to the lists in "Prefix" and "Suffix" files, and the level from 1 to 10 of said enchantment. When the ID is "0" it means of course that there is no enchantment.
Note about the code of affixes : when you want to put many prefixes or suffixes on a single item (for relics for example) add quote marks and note all the IDs in separated by commas like :
(previous data),"1,2,3",(next data). Don't forget the comma before and after quote marks to separate the IDs values from the other datas, as always.
Model level : this refer to the model on which yout item is based. They are listed in the "(Itemtype)Models" accompanying each item type file. More about this later.
Level : for evolutive items (relics). The level of the object (from 1 to 4 for actual relics). Take note that every level is considered as a different item ! There is the item level 1, then the item level 2 with a new ID as you can see in the exemple where I put the two first versions of the Thunderblade Helmet.
RequiredXP : amount of XPs needed to level-up the item (transform it into next version so a brand new item in fact).
NextLevelItemID : the ID of the next version of the item. The item it will transform in once XP gauge filled. If you put 0 or a non-existing (non-recognized) ID the item disappears (it transforms into something that doesn't exist).
Description : another link to a section of "loca" file. Only relics have description. You can see it's void in the first armor line but there is a code for the Thunderblade Helmet. This part is not necessary if you're creating a new item and don't want to bother with this. But remember to leave the section ! Just don't write anything between the commas.
AC : Armor Class. The value of armor the item add to your character once equipped.
Break Chance : chance for the item to break upon critical strike or block. 1 = 100%. 0.01=1%. I let the rest of the maths up to you, you should do good
RequiredSkillID : ID of the skill needed to equip the item. You can see that the medium armor needs the skill 12, which is the "Medium armor" skill. 0 means that no skill is required. It doesn't exists in the current game but you can imagine items that would required specific skills to function. Like a powerful magical ring that would require for its owner to be master in Prime Magic for exemple. As for affixes when you need to note many IDs put them between quote marks and don't forget the commas : "6, 18, 24" a sword of darkness requiring knowledge of Dark Magic (24) and a big magical potential (18, mysticism) to be wield in addition of regular skill (6). But you can even create mage weapons that would not even require the sword skill, everything is possible ! Show off your imagination !
RequiredSkillTier : the degree of mastery in required skill your character need to equip the item. NONE, NOVICE, EXPERT, MASTER, GRANDMASTER.
Identified : is the item identified ? TRUE or FALSE.
Note : skill IDs list : 1-Dagger 2-Bow 3-Crossbow 4-Mace 5-Axe 6-Sword 7-Spear
8-TwoHanded 9-Shield 10-DualWielding 12-MediumArmor 13-HeavyArmor 14-Dodge 15-Endurance
16-ArcaneDiscipline 17-FocusMagic 18-Mysticism
19-Fire 20-Water 21-Air 22-Earth 23-Light 24-Dark 25-Prime

Now to create a brand new item just add a new line (copy/paste is the simplest way) change the ID to a new ID that still doesn't exist in this file, edit any information you could want. To edit something into "loca" remember to use ctrl+F. Locate the codes of the item you're copying and add your lines. You just need to change IDs for this and add your entries. Same thing for description.
For a complete method illustrated MaxMeisel2013 posted every required line here :
Note that items can share names, icons and descriptions.

Now to add your item in the game and edit the loot in general.
First the difference between "Armor" and "ArmorModels". In "Armor" are fixed models of items, like relics, or with pre-determinated enchantments and levels. "ArmorModels" contain the ID of every existing level of armor but virgin of enchantment. They are used for item generation.
I at the moment have not found any way to add a pre-constructed item in a random loot table. Anyone who would knows how to do this is instantly begged to add the method as a comment after this tutorial. It will be added with credits and a lot of thanks.
You can still add your item InGame as a steady loot.
How to do this : in "MonsterStaticData" (still in static data) locate the "SteadyLoot" column and just add your item as follow instead or in addition of existing steady loot on the monster (preferably boss) of your choice. For this you need to note between quote marks "ItemFileName, ItemID, 1, 1, 1" like "Armor, 50, 1, 1, 1" to add the infamous Thunderblade Helmet. I do believe the last three numbers contain the probabiblity and quantity for steady loot but at the moment I still haven't get time to test this. Here again any help and complement of information is more than welcome.
With exactly the same method you can add your item or the one of your choice to steady loot for quests in "QuestSteps" ("still in StaticData") or in the chests "ChestStaticData". But for the chests it's a bit more complicated because if you want to edit a precise chest you first have to go in the folder "maps", locate the map in which you want to modify a chest, locate the chest datas in the map file, find out which kind of chest it is to edit it in ChestStaticData or add your own chest. It is still easy and everything works exactly the same. A bit more about loot editing (and so chest) later.
You can also add your item in a shop. For this just follow the steps listed by Max : -In ItemOffers locate the lines of the targeted merchant (Thurmond in the exemple). Add a new one with a new ID like in the exemple and the code of yout item like follow "ITEMTYPE (ARMOR, MELEE_WEAPON, RANGED_WEAPON, MAGIC_FOCUS...), ItemID, Quantity (1, 15, 66)". Select also first a condition DAYBREAK (renewed/reappear every morning or NONE (appear when the shop is generated the first time, never reappear).
-In folder "Dialog" locate the lines of the targeted merchant and add your offer ID like in the exemple.

About Items generation.
Some monsters or chest have a random loot table. Let's look closely at the code with an exemple. It's an extract from the MonsterStaticData file. Values are from the Spider Queen.
XpReward, SteadyLoot, ItemModels, ItemDropChance, ItemSpecificationList,
100, "POTION,11,0,3,1,POTION,29,1,1,1" ,"1B,1", 1, NONE,
PrefixChance, PrefixProbabilities, SuffixChance, SuffixProbabilities, GoldChance, GoldAmount
1, "2,14,3,5,4,1", 1, "2,14,3,5,4,1", 1, "190,200",
We already talked about steady loot and everyone is able to guess what XpReward means (I hope). The interesting part is after : ItemModels. This is the level of the items this creature can drop. 1B here. There is no ItemSpecificationList (ARMOR, MELEE_WEAPON, you know the song now.) It means this creature can drop items of any type and only of level 1B. The "1" after 1B is just a weight. It's the same thing as in Prefix/SuffixProbabilities.
These number "2,14,3,5,4,1" mean that for a level 2 affix has 14 chance to get out, a level 3 affix has 5 chances to get out, a level 4 affix has 1 chance to get out. It's just a weight of probabilities. As before all the chances in this loot table are of 1 (means 100%). It means that we have 100% chance to drop an item. This item has one chance out of one to be level 1B and can be of any type. It has 100% chance to receive both a prefix and an affix. The affixes have 14 chances out of 20 (total 14+5+1) to be level 2, 5 chances out of 20 to be level 3 and 1 chance out of 20 to be level 4.
Yes it took me some time to figure this one out
On a side note 100% chance to drop gold also. The amount is noted "minimum, maximum" possible.
If you go have a look to the chest loot tables as said earlier you'll see their loot table is built exactly the same. So are the Item Offers. You can now mod all of this at will.

Last part : editing inventory through saves edit.
First you need this amazing device brought to you by Albeoris :
Then through your XML converted save file search for :
Code: <SaveGameData id="Inventory" sealed="True">

          <Entry name="ItemCount" value="29" />
          <Entry name="Slot0" value="0" />
          <Entry name="DataType0" value="38" />
          <Entry name="Slot1" value="1" />
          <Entry name="DataType1" value="38" />
          <Entry name="Slot2" value="2" />
          <Entry name="DataType2" value="38" />
          <Entry name="Slot3" value="3" />
          <Entry name="DataType3" value="38" />

this in the very first page. Many informations here. ItemCount value is the number of items that is currently in the inventory of the party. 29 here. They are then listed and attibuted values. The first item is numbered "0" and the second "1", don't be surprised. "SlotX" is just the number of the item in the list, so is "DataTypeX" which is just the type of data for slot X. Now the next part is more interesting. ["SlotX" value] is the case the item is occupying in your inventory window. The 50 cases of your inventory are numbered from 0 to 49. Take care of this when adding items to add them in a free case otherwise you'll not be able to reconvert your file (can still be fixed after ward, don't panic). Now the "DataTypeX" value. This design the type of your item. Here is the list :
26 : armors
27*: jewelry
29 : melee weapons
30*: focus
31*: ranged weapons
38*: potions
39*: scrolls
Not any mistake will be forgiven in this too, careful. You can edit and re-edit your file at will so absolutely every mistake can be fixed perfectly easily BUT you have first to locate the mistake and identify it which is quite less easy.
Remeber also that all the beacons as SaveGameData for example must be placed at the exact level. On space more or less before the beacon and you break all the code. So be careful of the organisation. When you copy a segment make sure to put your copy at the exact same level as the original.
Datas will follow this list as below :
Code: <SaveGameData id="Item1" sealed="True">

              <Entry name="IsTracked" value="False" />
              <Entry name="IsGenerated" value="False" />
              <Entry name="Identified" value="True" />
              <Entry name="Broken" value="False" />
              <Entry name="StaticID" value="3" />
              <Entry name="PrefixLevel" value="1" />
              <Entry name="SuffixLevel" value="1" />
              <Entry name="CurrentXP" value="0" />
              <Entry name="PriceMultiplicator" value="0.1" />

Each of these segments is the details of one object. You can see that this segment is titled "item1" so it's the second item in my inventory (different save files so don't look at previous exemple). Meaning of datas Identified and Broken are obvious. Static ID is the ID of the item we want to reach in the file of the item type we entered in the inventory list (26 for armor for example). So here in my inventory is the ranged weapon (the item is noted 31 as DataType in the inventory list) number 3, which is the basic crossbow. We have the CurrentXP value for evolutive items and the affixes level. More about this later.
The more important here are the two datas atop "IsTracked" and "IsGenerated". A tracked item is from an "Itemtype" (Armor, Shield...) file. A generated item is from a loot table and generated from the "ItemtypeModels" (ArmorModels, ShiledModels...) file through the loot table the player get it with.
A generated item will be noted as such :
Code: <SaveGameData id="Item20" sealed="True">

              <Entry name="IsTracked" value="False" />
              <Entry name="IsGenerated" value="True" />
              <Entry name="Identified" value="True" />
              <Entry name="Broken" value="False" />
              <Entry name="StaticID" value="11" />
              <Entry name="PrefixId" value="1" />
              <Entry name="SuffixId" value="81" />
              <Entry name="PrefixLevel" value="6" />
              <Entry name="SuffixLevel" value="6" />
              <Entry name="CurrentXP" value="0" />
              <Entry name="PriceMultiplicator" value="0.25" />

You can see that the generated mention is now true and that the affixes IDs are present in addition of just the levels. I think that now the reading of these datas must be pretty easy for you. You can just add a segment of code like this one and edit it to add a generated object to your inventory. Just be careful to change the item count accordingly at the begining of the inventory list and to give a new ID (the next one in the existing list). You will also need to attribute to your item and a free place in your inventory.
<SaveGameData id="Inventory" sealed="True">
<Entry name="ItemCount" value="29" />
<Entry name="Slot0" value="0" />
<Entry name="DataType0" value="38" />
<Entry name="Slot1" value="1" />
<Entry name="DataType1" value="38" />
<Entry name="Slot2" value="2" />
<Entry name="DataType2" value="38" />
<Entry name="Slot3" value="3" />
<Entry name="DataType3" value="38" />
<Entry name="Slot4" value="4" />
<Entry name="DataType3" value="38" />
I just add thess two lines and so a fifth item appear in the fifth case of my Inventory (noted 4 yes it's strange). Type is 38 so it will be a potion. For the sake of the exemple we'll put a 29 (melee weapon).
I then copy paste a segment describing an item after the last one of my save. Name it Item4 to fit with my Slot4, edit it the way I want, and it's done.
With this method you can add as much enchanted item as you want to your inventory. Put 0 as ID if you don't want to add pre/suffixe. Affixes level maximum is 10. The only limit is that you can add only one prefix and suffix per item.
To add many affixes you need to create a new item in the Itemtype file (Armour,MeleeWeapons,Mom,Girlfriend...) of your choice. For this same process just copy a descriptive segment as saw in the exemple and add it after the list of the Treasures or Relics (it is of no impact on the game). Grant it with a new ID, make your edition (remember that to add many affixes IDs they must be noted between quote marks) then add it to your inventory.
BUT, when adding it to your inventory leave the Generated mention false and put the Tracked as true. You MUST NOT add your item affixes IDs in your save file. The game will track them in the Itemtype file. If you do add the IDs as for the Generated exemple you'll not be able to reconvert your save (or the game will crash).

You now know how to do anything with items and inventory datas. You can create or modify any item in any way you want and add them as a loot to any chest, monster, quest, or directly in your inventory. You also know how to change at will all your inventory.
Use all this to create lot of new mods. Monsters can be edited just the same in the MonsterStaticData, not just the loot, so grant us all with new challenges and new rewards. And now if your save is corrupted you'll at least be able to rebuild your inventory (I'm sure no one thought about using all these informations to abuse the game hmm ?)
I hope this will be useful to the players, thanks a lot for reading, share this around, don't hesitate to make any comment, ask any question, or add any information.
Original thread and discussion :! You can also check this tutorial about classes modding : My classes mod Racial/Job Specialists : Little tutorial about magic school : And this to see the informations I gathered in regard of eventually modding some kind of respawn mechanism : My big idea in regard of respawn :
Cheers guys and good game to you all !