[1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

This forum is for discussions on how to edit what can not be edited through the txt files, needless to say this isn't about battle net hacking.

Moderators: Nefarius, Havvoric

Post Reply
User avatar
Nizari
Site Admin
Paladin
Posts: 115
Joined: Fri Feb 16, 2018 11:39 pm
Poland

[1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Nizari » Fri Nov 29, 2019 2:58 pm

Soo, some days ago I have discovered that MaxLevel column of MagixSuffix.txt and MagicPrefix.txt isn't working at all. Additionally, if you don't use 'magic lvl' column (left it blank, in vanilla it's used for circlets), your items will roll affixes based on it's required spawn level ('level' column of armor/weapons/misc) instead of item level (level of monster or object that spawned it).

A quick note before I continue, according to Necrolis, this is something that Adhin has found many years ago, however, I did it completly independently and so here you may find description of the exact problem and solution of it.

Now, according to our txt files guides:
MaxLevel - An extremely powerful but badly underused field. This controls the point at which this affix will no longer appear on items. Say we have a Level of 10 and a MaxLevel of 15, then the affix will only appear on items with a iLvl of 10-15, whereas it will never appear on items with iLvls 1-9 and 16-99. This is the easiest way to get those crappy low-level affixes of higher level drops to ensure that those are useful.
This is how it's supposed to work. Unroftunately, it does nothing.
Here is a piece of code I have received from Necrolis, which shows how affix level is selected:

Code: Select all

  if ( nLevelBonus )
  {
    nAdjustedItemLevel = nLevelBonus + nItemLevel;
  }
  else
  {
    nHalfSpawn = nSpawnLevel / 2;
    nInverseHalfSpawn = 99 - nSpawnLevel / 2;
    if ( nItemLevel >= nInverseHalfSpawn )
      nAdjustedItemLevel = 2 * nItemLevel - nHalfSpawn - nInverseHalfSpawn;
    else
      nAdjustedItemLevel = nItemLevel - nHalfSpawn;
  }
  if ( nAdjustedItemLevel > 1 )
  {
    if ( nAdjustedItemLevel >= 99 )
      nAffixSelectionLevel = 99;
    else
      nAffixSelectionLevel = nAdjustedItemLevel;
  }
  else
  {
    nAffixSelectionLevel = 1;
  }
Additionally:
Necrolis wrote:If your item has a magic lvl ('magic lvl' column field) bonus set in weapons/armor/misc, the affix selection level is the item level + the bonus. If there is no bonus, the affix level is wonderfully gimped by the following:

Code: Select all

    nHalfSpawn = nRequiredSpawnLevel / 2;
    nInverseHalfSpawn = 99 - nRequiredSpawnLevel / 2;
    if ( nItemLevel >= nInverseHalfSpawn )
      nAffixSelectionLevel = 2 * nItemLevel - nHalfSpawn - nInverseHalfSpawn;
    else
      nAffixSelectionLevel  = nItemLevel - nHalfSpawn;
Which produces this graph of affixes
Image
TL;DR: the 'magic lvl' is OP at pretty much any level.
Also, for the purposes of picking affixes, if the items required spawn level is greater than its item level, the required spawn level is used instead of the item level.
Explaination is done, how do we fix it then? (EDIT: in case of anyone wondering about it, it's in d2game.dll)

1.10:

Code: Select all

6FC52D70	|. /74 04		JE SHORT D2Game.6FC52D76
TO:

Code: Select all

6FC52D70	90		NOP
_______________________________________________________________________________________________

1.13c:

Code: Select all

6FC34617	|. /74 04		JE SHORT D2Game.6FC3461D
TO:

Code: Select all

6FC34617	90		NOP
Thanks to this, MaxLevel field wil work exactly as intended, additionally, affixes of your items will ALWAYS be rolled based on item level. It gives you much bigger freedom in designing your magic and rare items and absolute control over them.

Big thanks to Necrolis for helping me with this.

Gobo
Posts: 9
Joined: Tue Mar 12, 2019 10:00 pm

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Gobo » Mon Dec 09, 2019 5:04 pm

Hi - Thanks for this. If I am NOP'ing out 74 04 bytes should I be replacing with double 90 90? Or should it remain 90 04
Thanks

User avatar
Darkquake
Posts: 69
Joined: Tue Feb 20, 2018 3:38 pm
Australia

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Darkquake » Mon Dec 09, 2019 6:10 pm

Does this fix apply to suffix/prefix only or does it also solve "magic lvl" in item.txts?
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

User avatar
Necrolis
Senior Admin
Throne
Posts: 9125
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
Contact:
South Africa

Hand-picked

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Necrolis » Tue Dec 10, 2019 2:13 pm

Darkquake wrote:
Mon Dec 09, 2019 6:10 pm
Does this fix apply to suffix/prefix only or does it also solve "magic lvl" in item.txts?
They are the same selection routine, however magic level will use item level + magic level as the affix selection level, but an item without magic level gets the weird down scaling applied instead. Not sure what you mean by solve "magic lvl" however.
Gobo wrote:
Mon Dec 09, 2019 5:04 pm
Hi - Thanks for this. If I am NOP'ing out 74 04 bytes should I be replacing with double 90 90? Or should it remain 90 04
Thanks
you want to replace both bytes with 90
Image
Netiquette, Do you USE it?!?! | Nefarius' Fixed TXT Files | Terms Of Service
Blackened | Day of Death | D2GFEx
"What was yours is mine. Your land, your people, and now your life." - Lim-Dul, the Necromancer
Judgement is Final, Death is Eternal

User avatar
Darkquake
Posts: 69
Joined: Tue Feb 20, 2018 3:38 pm
Australia

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Darkquake » Tue Dec 10, 2019 3:00 pm

Necrolis wrote:
Tue Dec 10, 2019 2:13 pm
They are the same selection routine, however magic level will use item level + magic level as the affix selection level, but an item without magic level gets the weird down scaling applied instead. Not sure what you mean by solve "magic lvl" however.
I miss understood how this bug was related to magic lvl. Thanks for the clarification.
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

Daemonjax
Posts: 12
Joined: Sat Sep 01, 2012 11:44 am

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Daemonjax » Fri May 01, 2020 12:30 am

Nizari wrote:
Fri Nov 29, 2019 2:58 pm
... Thanks to this, MaxLevel field will work exactly as intended, additionally, affixes of your items will ALWAYS be rolled based on item level...
Just to be super clear:

After this fix is applied, will items that DO use the magic lvl column (e.g. circlets) now ignore it and just roll for affixes based on item level alone (instead of item level + magic lvl)?

User avatar
Nizari
Site Admin
Paladin
Posts: 115
Joined: Fri Feb 16, 2018 11:39 pm
Poland

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Nizari » Fri May 01, 2020 1:16 am

Magic lvl column will work as it should. Perhaps I should have write that items will always roll affixes properly.

User avatar
schnuppy
Posts: 5
Joined: Fri Nov 27, 2020 11:56 pm

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by schnuppy » Sat Nov 28, 2020 12:45 am

first of all: thanks for your efford for this... i didnt get too much in-depth in terms of item generation, thus i have to ask here a few stupid questions, i hope you dont mind^^

With this fix, a drop with an high ilvl (or basicly with any ilvl), which would come with "magic lv bonus" has now this bonus applied on his affix rolls. Without this fix, magic lv bonus will not be applied properly on the drop, somehow like its shown on the graph above. So it basicly removes a certain percentage of thrash drops on high ilvls and overall. Is that correct so far?

If so, my next question: I assume, this "bug" was wanted by the devs because there were so many patches, where they have could fixed that... so if i want to play the original game, do i have to leave it like it is, because that fix is already clear modding, which increases the quality of certain drops to a significiant higher level, for whoose the game is not planned? Or is it really a bug, which they didnt notice until now, and which they would rather fix, if they knew about it, instead of leaving it like it is now? That would give me green light to fix it by myself with this method. I enabled the disabled drops of the old Azurwarth and the Constricting Ring, because they are simply part of the game. So thats how i decided there, i just want to play the original game, as it was designed, without any sloppy decisions.

So is that "correct runnig magic lv" originally part of the game or not? Is it somehow "disabled" like the Ring and the Sword (btw.: The sword already droppped, so the change from 0 into 1 in the uniqueitems.txt is appearently working), just to keep the grind going on forever?

User avatar
Nizari
Site Admin
Paladin
Posts: 115
Joined: Fri Feb 16, 2018 11:39 pm
Poland

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by Nizari » Tue Dec 01, 2020 1:21 am

schnuppy wrote:
Sat Nov 28, 2020 12:45 am
With this fix, a drop with an high ilvl (or basicly with any ilvl), which would come with "magic lv bonus" has now this bonus applied on his affix rolls. Without this fix, magic lv bonus will not be applied properly on the drop, somehow like its shown on the graph above. So it basicly removes a certain percentage of thrash drops on high ilvls and overall. Is that correct so far?
Yes, to a degree. Actually it makes it possible for item of IE ilvl60 indeed roll affixes of level up to 60 instead of like 35 or so. Keep in mind, that low rolls will still be possible, and to get rid of them, you have to use MaxLevel (which starts to work with that fix) to stop them at ilvl X.
schnuppy wrote:
Sat Nov 28, 2020 12:45 am
If so, my next question: I assume, this "bug" was wanted by the devs because there were so many patches, where they have could fixed that...
I wouldn't say that... You can ask about it David Brevik himself on our discord though. There are many horrible bugs that were never fixed. Some quick examples:
1. Missiles attack rating bug that succesfully prevents every missile created by skill to not gain attack rating % bonus of that skill, it means skills such as fire arrow or ice arrow use only your base (normal attack) attack rating and because of that they are so unlikely to hit anything.
2. Fire (and any other element if you would create such skill using vanilla setup) DOT skills display error - every single one deals 33,(3)% damage of the display (IE 1111 in reality instead of 3333 on the display)
3. Enchant skill bug - beyond your display, it adds fire damage twice, resulting in quadrupled damage when you add fire mastery. Of all bugs, this is most likely the one that was closest to turn me insane while I was dealing with it.
4. Diablo inferno bug - on higher skill level, Diablo red lightning inferno is created too far away from the starting point, resulting in you taking no damage while staying close to Diablo.
5. Throwing damage display bug - any thworing weapons damage is multiplied by about 300%. Resulting in you thinking your throwing barb deals 5000 damage, while in reality it's about 1600-1700.
6... 7... 8... 9... etc...
schnuppy wrote:
Sat Nov 28, 2020 12:45 am
so if i want to play the original game, do i have to leave it like it is, because that fix is already clear modding, which increases the quality of certain drops to a significiant higher level, for whoose the game is not planned?
Once again, I wouldn't say that 60 shouldn't equal 60 and 75 equal 75.
schnuppy wrote:
Sat Nov 28, 2020 12:45 am
Or is it really a bug, which they didnt notice until now, and which they would rather fix, if they knew about it, instead of leaving it like it is now? That would give me green light to fix it by myself with this method. I enabled the disabled drops of the old Azurwarth and the Constricting Ring, because they are simply part of the game. So thats how i decided there, i just want to play the original game, as it was designed, without any sloppy decisions.
I highly recommend to apply this fix.
schnuppy wrote:
Sat Nov 28, 2020 12:45 am
So is that "correct runnig magic lv" originally part of the game or not? Is it somehow "disabled" like the Ring and the Sword (btw.: The sword already droppped, so the change from 0 into 1 in the uniqueitems.txt is appearently working), just to keep the grind going on forever?
I don't know true answer to that, however, in my personal opinion it was just bad design choice. Looking at the graph, you may have a feeling it was done to somehow keep normal and nightmare difficulty levels kinda underwhelming when it comes to drops quality,to make hell more attractive perhaps?

User avatar
schnuppy
Posts: 5
Joined: Fri Nov 27, 2020 11:56 pm

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by schnuppy » Tue Dec 01, 2020 6:59 am

Nizari wrote:
Tue Dec 01, 2020 1:21 am
You can ask about it David Brevik himself on our discord though.
Thats an interessting idea... but the answer might be not useful because if you ask someone about his faults, he has to defend himself somehow maybe? Do you have any (good) experience talking with him about bugs/development in D2?
Nizari wrote:
Tue Dec 01, 2020 1:21 am
There are many horrible bugs that were never fixed.
1. Missiles attack rating bug that succesfully prevents every missile created by skill to not gain attack rating % bonus of that skill, it means skills such as fire arrow or ice arrow use only your base (normal attack) attack rating and because of that they are so unlikely to hit anything.
2. Fire (and any other element if you would create such skill using vanilla setup) DOT skills display error - every single one deals 33,(3)% damage of the display (IE 1111 in reality instead of 3333 on the display)
3. Enchant skill bug - beyond your display, it adds fire damage twice, resulting in quadrupled damage when you add fire mastery. Of all bugs, this is most likely the one that was closest to turn me insane while I was dealing with it.
4. Diablo inferno bug - on higher skill level, Diablo red lightning inferno is created too far away from the starting point, resulting in you taking no damage while staying close to Diablo.
5. Throwing damage display bug - any thworing weapons damage is multiplied by about 300%. Resulting in you thinking your throwing barb deals 5000 damage, while in reality it's about 1600-1700.
6... 7... 8... 9... etc...
I have to save this list for my playing^^ thx for the listing of the bugs... I already noticed Diablos inferno bug and thought this might be something because of PlugY maybe or some other little programms running^^ Is there a full comprehension somewhere of the current major bugs? Because its not that easy even with a D2 experience of maybe 700-1000 hrs gameplay to detect those bugs... if i ever recognise, that something isnt working properly, i always assume, that the game is ok and its my fault/fault of some other stuff...
Nizari wrote:
Tue Dec 01, 2020 1:21 am
schnuppy wrote:
Sat Nov 28, 2020 12:45 am
so if i want to play the original game, do i have to leave it like it is, because that fix is already clear modding, which increases the quality of certain drops to a significiant higher level, for whoose the game is not planned?
Once again, I wouldn't say that 60 shouldn't equal 60 and 75 equal 75.
So you want to say that the drops would not be more powerful overall, so i dont raise a certain limit of itempower, but good drops would happen more frequently, right?
Nizari wrote:
Tue Dec 01, 2020 1:21 am
I don't know true answer to that, however, in my personal opinion it was just bad design choice. Looking at the graph, you may have a feeling it was done to somehow keep normal and nightmare difficulty levels kinda underwhelming when it comes to drops quality,to make hell more attractive perhaps?
If there was any real reason for this bug to be kept, then it would be interessting which one it is... otherwise it is a green light for everone to fix this for better loot of course. Maybe David Brevik can help there... if someone here has a connection to him, maybe he should ask him, otherwise i can do that too, if i know where exactly to find him. Although i doubt that i have enough background knowledge about that isse... or might it be enough if i refer to this diussussion here and he will know about what i am talking?

EnPhreg
Posts: 6
Joined: Thu Jan 21, 2021 3:50 pm

Re: [1.10 & 1.13c] Item affix selection misconception and maxlevel column bug - solution

Post by EnPhreg » Thu Feb 18, 2021 5:21 pm

Nizari wrote:
Fri Nov 29, 2019 2:58 pm
Explaination is done, how do we fix it then? (EDIT: in case of anyone wondering about it, it's in d2game.dll)

1.10:

Code: Select all

6FC52D70	|. /74 04		JE SHORT D2Game.6FC52D76
TO:

Code: Select all

6FC52D70	90		NOP
_______________________________________________________________________________________________

1.13c:

Code: Select all

6FC34617	|. /74 04		JE SHORT D2Game.6FC3461D
TO:

Code: Select all

6FC34617	90		NOP
Thanks to this, MaxLevel field wil work exactly as intended, additionally, affixes of your items will ALWAYS be rolled based on item level. It gives you much bigger freedom in designing your magic and rare items and absolute control over them.
can't find the corresponding values in the game.exe for the 1.14d version. searched with code fragments taken from the position 6FC34617 in 1.13c d2game.dll to find a matching entry within the 1.14d game.exe, but no luck. can anybody help? anybody already know the right position for the value to change in 1.14d game.exe?
found two entires in game.exe with 74 04 03 (like in 1.13c d2game.dll), but i don't think that this are the right values, cause the code before and after this small piece didn't seem to match with the rest of the code in d2game.dll.

Post Reply

Return to “Code Editing”