Changes

ADVERTISEMENT
From Diablo Wiki
Jump to: navigation, search

Item Generation Tutorial

18,486 bytes added, 13:12, 12 May 2008
Item type selection
=Item type selection=
coming soonThis was covered in Chapter 4.1 in technical fashion.Here it's described in more vernacular terms, by Thrugg.
The Treasure Classes are like a giant tree, and all are defined in TreasureClassEx.txt. Each row in that file defines a TC, and lists the sub TCs it can drop from. When an item is dropped, the game rolls to determine from which sub TC it will come, then looks at that row and rolls again, and so on until an individual item is selected.
 
Each sub TC is not equal. For example, Hell Mephisto's TC is:
*Mephisto (H) 7 983 983 983 1024 15 "gld,mul=2048" 5 "Act 4 (H) Equip A" 52 "Act 4 (H) Junk" 5 "Act 4 (H) Good" 3
This says he gets 7 drops, bonuses of 983 to U/S/R, 1024 bonus to Magic which is why he always drops at least magic.
* Next is 15 no-drop.
* Then 5 gold with a 2048 multiplier (means decent sized stacks).
* Then 52 Act 4 (H) Equip A, which contains equipment items appropriate for the early part of Act 4 Hell.
* Then 5 Act 4 (H) Junk, which contains a bunch of crap.
* Then 3 Act 4 (H) Good, which contains good non-equipment items appropriate for Act 4 Hell. This is gems, runes, jewels, charms, rings, amulets.
 
The numbers (15, 5, 52, 5, 3) are the chances of going to each subTC with each drop. They add up to 80. So you have a 15/80 chance of going to no-drop and getting nothing — but that is with each drop. You can go there once and still get your full 6 drops (he gets 7 chances but every monster can drop at most 6 items). 52/80 equipment is why he drops quite so much of that. 3/80 good is kind of low, which is why bosses aren't much good for runes.
 
For another example, let's have a look at Act 4 (H) Equip A:
* Act 4 (H) Equip A 1 weap69 2 armo69 1 weap72 6 armo72 3 weap75 14 armo75 7 weap78 2 armo78 1 Act 3 (H) Equip B 1530
This means you get 1 item, with 2 chances of weap69 and 1 chance of armo69, etc. You also have 1530 chances (!) of dropping down to Act 3 (H) Equip B. Several things to note here.
 
First, weapons are always twice as common as armour. Also, while this is why Mephisto can drop from TC78, he really isn't likely to (especially armour in TC78). Only 1/1566 of Meph's equipment drops will be from armo78, while he is 7 times more likely to drop from armo75.
 
It looks like he is unlikely to drop from TC69 also, however he drops down to A3(H)EqB almost all the time, and that has a similar TC window shifted one back, i.e. TC66 up to TC75. So he actually gets quite a few chances to drop TC69 further down the tree.
 
The main reason why TC3s are so rare is that this rolling window stops when it hits the bottom, so you just get that one very last chance at TC3s.
 
Suppose you are lucky and you get your 1/1566 chance of armo78 from Meph. This is called an "atomic TC" and it is not defined in TCEx.txt. Instead, it is defined by armor.txt, also in your Atma directory. It contains all armours which have level (often called qlvl) 76, 77 or 78. You can also see base item qlvls at d2data.net. Armo78 contains Balrog Skin, Hellforge Plate, Troll Nest, Crusader Gauntlets and Earth Spirit in 1.10. As always when D2 makes a list, it has rarities associated too. Rarities at this level are pretty simple. All items have rarity 3 except class-specific items have rarity 1, assassin claws have rarity 2, and wands, staves and sceptres (rods) have rarity 1. Armo78 has total rarity 3+3+3+3+1=13, so you have a 3/13 chance of getting a Balrog Skin, and a 1/13 chance of getting an Earth Spirit. Meph is not your ideal source for a Spirit Keeper.
 
You'll note we split off from runes and rings and amulets a long way back. The game decides if you are getting an equipment item or something else very early on. Once the item type is selected, the Magic Find process starts, and determined what quality it will be.
 
 
=Item quality selection=
 
The explanation here is given for monster drops. Most chests and other objects use the same algorithm of quality determination, however special chests have also fixed chances for unique, set, rare and magic items (see chapter 17). The exact mechanics of quality determination can be found in the chapter 4.8, itemratio.txt. Here the process is described in more detail, with examples.
 
After the game has calculated item level and selected an item type to drop, it selects item quality. It is done by performing a row of test for unique, set, rare, magic, high and normal quality. If some test returns success it will cancel all other tests, if all tests return fail it will generate a low quality item.
 
The test is calculating a Value and generates random number in 0-(Value-1) range. If this random number is less than 128 then the test will return success. So we have 128/Value chance to get that quality.
 
Here is quality check algorithm:
 
1) Find proper line in itemratio.txt.<br>
2) Chance = (BaseChance - ((ilvl-qlvl)/Divisor)) * 128<br>
3) if (we check for unique, set or rare quality) EffectiveMF=MF*Factor/(MF+Factor)
else EffectiveMF=MF<br>
4) Chance= Chance* 100/(100+ EffectiveMF).<br>
5) if (Chance 6) FinalChance=Chance-(Chance*QualityFactor/1024)<br>
7) If (RND[ FinalChance ])<128 return Success<br>
else return Fail
 
* '''BaseChance:''' The value from Unique, Rare, Set, Magic, HiQuality and Normal fields of itemratio.txt.
* '''ilvl:''' Item Level, usually ilvl=mlvl.
* '''qlvl:''' quality level of item type.
* '''Divisor:''' The value from UniqueDivisor, RareDivisor, SetDivisor, MagicDivisor, HiQualityDivisor and NormalDivisor fields of itemratio.txt.
* '''MinChance:''' The value from UniqueMin, RareMin, SetMin, MagicMin fields of itemratio.txt. For high quality and Normal items MinChance=0.
* '''QualityFactor:''' The value from Unique, Set, Rare, Magic fields of TreasureClassEx.txt file for TC of the monster, that dropped this item.
 
In more detail:
 
At the first step the game finds suitable line in itemratio.txt. As you know, there are separate lines for Classic/LoD games, class specific/non-class specific items and normal/exceptional and elite items. After finding proper line it has all values, that it needs for calculations: item level, quality level, base quality chance, quality divisor, minimum quality chance, MF%, MF diminishing returns factor and monster quality factor.
 
Lets repeat again where the game takes them.
 
Item level is just equal to monster level. Quality level is the level of item type. MF% are taken from players equipment. MF diminishing returns factor is 250 for unique, 500 for set and 600 for rare qualities. All other values are taken from itemratio.txt file, except monster quality factor. The last is maximum value from Unique, Set, Rare, Magic fields of TreasureClassEx.txt file for all TCs, that the game have scanned, searching for this item type.
 
At the last step we just have 128/FinalChance chance to get Success.
 
Let's take an example, Hell Baal drops an Unearthed Wand for a character who has 200% Magic Find. The check for unique:<br>
1) Use line #5, "Uber".<br>
2) ilvl=99 (from monstats.txt), qlvl=86 (from weapons.txt), BaseChance=400 (for unique from itemratio.txt), Divisor=1.<br>
Chance = (BaseChance - ((ilvl-qlvl)/Divisor)) * 128=49536.<br>
3) Factor=250 for unique quality.<br>
EffectiveMF=MF*Factor/(MF+Factor)=111.<br>
4) Chance= Chance* 100/(100+ EffectiveMF)=23476<br>
5) Chance< MinChance (false, because 23476>6400).<br>
6) QualityFactor=983 for Hell Baal (from TreasureClassEx.txt).<br>
FinalChance=Chance-(Chance*QualityFactor/1024)=939.
 
If the game generates random number in 0-(FinalChance-1) range (rnd[FinalChance] function), that will be less then 128, it will generate unique Unearthed Wand. So you have 128:939 chance per Unearthed Wand pick to get unique. If the game failed to generate unique Unearthed Wand it will try to generate set, then rare and so on.
 
For some item types and if the monster level is less than quality level of unique or set item, the game will generate a high durability item.
 
So if you find Bramble Mitts, the game will check to see if they are Unique (whether or not there is a Unique of a given item type doesn't matter at this point), if that fails then Set, if that fails then Rare, and so on. If the roll for Unique or Set succeeds and there is not one of that base item (which happens quite often with Elite Uniques, and can happen with Elite, Excep, or normal sets) a lower quality item with bonus durability will be generated. Details:
 
* If you roll a Unique when one of that type does not exist or from a monster not high enough to drop it, you'll get a Rare of that type item with 3x the normal durability.
* If you roll a Set when one of that type does not exist or from a monster not high enough to drop it, you'll get a Magical of that type item with 2x the normal durability.
* Both of these can also happen when monsters aren't high enough to drop the given set or unique.
* This also happens with Uniques, if the same one is selected to drop more than once in a game. Since it can only drop once, the 2nd, 3rd, etc times it will drop to a 3x durability Rare.
 
 
=Set and unique items selection=
 
Lets assume that after the previous steps the game has selected a certain item type and determined it will be of unique or set item quality. After that it completes the list of all possible items with this type and quality, that has quality level less or equal to Ilvl of the item. After that it has several possibilities:
# If there is no any item in that list the game generate high durability item.
# If there is only one item of that type it just selects it for dropping.
# If there are several items in the list, it selects one of them randomly according to their rarity. The chance for an item to be dropped in this case is ItemRarity/TotalRarity, where TotalRarity is the sum of rarities of all items in the list.
 
Three examples, one for every case:
 
Example #1. Hell Pindleskin decides to drop Spiderweb Sash. The unique item quality is checked next. The game creates the list of all unique Spiderweb Sashes, that has Qlvl less or equal to Ilvl (Qlvl<=86). The resulted list will be empty, because there is no such items is game files, only unique Spiderweb Sash, Arachnid Mesh, has Qlvl=87, so it cannot be dropped by Mlvl=86 monster. So the list is empty, the game drops 3x durability rare Spiderweb Sash, and poor player starts pulling hair from his back, blaming Pindleskin, The Game and Blizzard entirely. :)
 
Example #2. Hell Pindleskin decides to drop Sacred Armor. Then he rolls for unique item quality. The game creates the list of all unique Sacred Armors, that has Qlvl<=86. The result list will contain just one item, that meets all that restrictions. It is Templar's Might, another unique Sacred Armor, Tyrael's Might, cannot be dropped because it has higher Qlvl (87). So the list contain just one item, the game drops Templar's Might just to confuse player a bit before he realises that he is running Pindle, not Baal. :)
 
Example #3. Hell Pindleskin decides to drop a Ring. Then he rolls for unique item quality. The game creates the list of all unique Rings, that have Qlvl<=86. The result list will contain nine items, all unique rings have Qlvl<=86. So he needs to select one of them. He summarises rarities of all items in the list: 15+15+1+1+10+10+3+1+3=59 and generates random number to select one of them. So Nature's Peace has 3/59 chance to drop, and SoJ has only 1/59. Our poor player more likely will get another Nagel, Manald's, Raven's or Dwarf's ring (they are 50/59 of all Pindle's unique rings). :)
 
 
=Sockets Number Selection=
 
If the game creates a socketed item it must determine how many sockets the item will boast. You may find all information about sockets in armor.txt, weapons.txt and ItemTypes.txt data files. Misc items cannot have sockets.
 
The game first checks if the item may have sockets at all. These items are:
* Any weapon except throwing weapons.
* Any body armor.
* Any shields.
* Any headgear.
 
Other items cannot have sockets.
 
The most interesting information about socketed items is how many sockets they can have.
 
Most Unique and Set items do not have sockets, originally. (The use of the term "originally" in this section refers to items as they are generated, before being "socketed" by [[Quests_Act_Five#Quest_One:_Stop_the_Seige|Larzuk's quest reward]].) The number of sockets in the few unique or set items that have sockets is fixed or randomly selected from fixed range with equal probability. The information about their sockets are stored in UniqueItems.txt and SetItems.txt data files. For example Griswold's Heart (Set Ornate Plate) always have three sockets, Crown of Ages (Unique Corona) has one or two sockets with 1/2 chance of each.
 
Original Rare items in v1.10 and later (rare items never had sockets in earlier versions of D2) have one or two sockets with 1/2 chance of each when they have Mechanist's affix. See chapter 11 about affix selection mechanics if you want to know how frequently this affix may appear. Note that not all rare items may have two sockets. If maximum sockets cap for its base item is one, that Mechanist's rare item will always have one socket. The example of such item is rare buckler.
 
Original Magic items have sockets only if they have one of the following prefixes: Mechanics' (1 or 2 sockets with 1/2 chance of each), Artisan's (3 sockets) and Jeweler's (4 sockets). Socketed magic items cannot have more sockets than is allowed by its base item type.
 
1/3 of all normal and superior items are socketed. The number of sockets is generated randomly from the range, with the number effected by item type and item level. Minimum possible sockets number are always 1. Maximum sockets number can be found in armor.txt, weapon.txt and ItemTypes.txt data files for every item type. For example let me take Long Battle Bow. You can find "6" in "gemsockets" column and "bow" in "type" column of weapon.txt in its line. For "bow" type ItemTypes.txt has "3", "4" and "6" in "MaxSock1", "MaxSock25" and "MaxSock40" columns. That means that Long Battle Bow has maximum 3 sockets before Ilvl<=25, 4 sockets before Ilvl<=40 and 6 sockets after Ilvl=40.
 
Low quality items cannot originally have sockets.
 
==Adding Sockets==
 
If you are not happy with the number of sockets in your item you have several possibilities to change it.
 
===Normal Items==
 
With normal items (grey colored), there are 3 basic methods to get normal socketed items:
# Find it
# Use the socketing quest
# Use cube recipes
 
Each character can earn three socketing quest rewards, one on each difficulty level. Typically one uses this quest on a normal item when they wish to use runewords. Runewords do not replace staffmods or superior affixes on an item, so having these affixes appear on a white item will encourage you to socket the item for using a runeword.
 
The quest <u>always gives the maximum sockets allowed</u> on a normal item. If the desired runeword has fewer runes than the maximum sockets possible in a given item type, Larzuk's quest reward is useless in that instance. Instead, a cube recipe should be used to obtain a semi-random number of sockets. Socketing [[Cube Recipes]]:
# Tal, Thul, Ptopaz, normal body armor
# Ral, Amn, PAmethyst normal weapon
# Ral, Thul, PSaphire, normal Helm
# Tal, Amn, PRuby, normal shield
Low quality to normal quality:
# Eld, chippy, low quality weapon
# El, Chippy, low quality armor
 
Using the low quality to normal quality recipes changes the ilvl of the item to 1. From the above comment about maximum sockets and how they are related to ilvl, one could use this to their advantage. They could get an elite item, such as a phase blade, and use the recipe to make it a normal item then socket it to only have 3 sockets. One would want to do this in order to create runewords needing smaller number of sockets. "Malice" IthElEth would be an example of one such runeword that may be desired in a phaseblade, but 3 socketed phaseblades may be hard to come by. By finding a low quality one, using the recipe and then socketing with the quest someone could create the 3 socketed phase blade.
 
The socketing recipes for normal items give a random amount of potential sockets, which works out to a semi-random number in most items. The number is semi-random because the recipe rolls from 1-6 sockets in every item. If an item can not have up to six sockets though, any number higher than the item can contain will yield the maximum. For example, claws can get up to 3 sockets so with this recipe a claw would have:
* 1/6 chance to get 1 socket.
* 1/6 chance to get 2 sockets
* 4/6 chance to get 3 sockets
 
===Rares===
 
There are 4 methods to get rares with sockets:
# Find a rare with mechanic's prefix
# Use socketing quests
# Use recipes
# Reroll (replace the affixes of the item, using a cube recipe)
 
Using quest is the same as above. Socketing rares using recipes is much more costly than socketing normal items using any method, using the quest here may be a wiser move. The quest will always give 1 socket to rare items. Unique items and set items will also only get 1 socket with the quest reward. Also unique items and set items can only be socketed by using this quest.
 
There is one recipe for socketing rares. It always adds one socket, just like the quest:
# 3xPskulls, SOJ, rare item
 
Rerolling is like getting another item with completely different affixes, but it shares the same item type and quality. This is not of much use to most players, since it destroys the stats on the item, and simply rolls a new rare of the same item type. The odds of getting sockets on that one are low, and the odds of getting good stats + sockets is "struck by lightning" low.
 
===Magical===
 
Magical Items:
 
1. Find them
2. Use quest
3. Reroll (replace the affixes of the item, using a cube recipe)
 
 
Using the quest on magical items will give that item 1-2 sockets, with equal chance of getting 1 or 2 sockets. This method can be used when desired affixes appear on magical items. Some affixes only appear on magical items and socketing such items will allow them to get more affixes from runes, gems, jewels. One such prefix is the +3 skill tree affixes.
 
Rerolling is like getting another item with completely different affixes, but it shares the same item type and quality. The magical rerolling recipes are kind of interesting and can be used creatively.
You may socket originally unsocketed unique and set items using Socketing Quests. It always adds just one socket.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
=Thanks=
 
Originally Posted by Uzziah
Administrators
2,378
edits