Level ranges on %chance to cast level x-y spell on hit/damage taken

Post here about all aspects of D2 mod making whether it's information, problems or whatever. Please specify whether your post is relating to Classic D2 or the Expansion.

Moderator: Nizari

Post Reply
Elmegaard
Posts: 7
Joined: Mon Nov 25, 2019 9:14 am
Denmark

Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Elmegaard » Mon Dec 02, 2019 3:26 pm

I am making a tool that can auto generate documentation for mods based on .txt and .tbl files for a modder. I have it completed for the vanilla files for d2 1.13c and probably also for 1.10, but that is yet to be tested.

I have 1 last issue remaining and that is these "%chance to cast level x-y spell on hit/damage taken". It works fine for me when the level is not a range: "Level ranges on %chance to cast level x spell on hit/damage taken", but for ranges the parameter is just 0 and I just can't figure where this level range is coming from then.

In for example the unique stormrider, the parameters from UniqueItems.txt are as follows:
get-hit 3 50 0

Which shows as this when I generate the documentation:
10% Chance to cast level 0 Charged Bolt on striking

This is supposed to look like this:
10% Chance To Cast Level 13-20 Charged Bolt On Striking

I just can't find where the 13-20 is coming from, is this hard coded? Is it from another file?

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

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Darkquake » Mon Dec 02, 2019 4:55 pm

A value of 0 for slvl forces the game to default to the ilvl for basing affixes off. This is not random, for example a ilvl 77 will never roll beneath slvl20. Should also be noted that this behaviour caps at slvl 20. The calculation seems to be:

ilvl/3.9=slvl, rouded up after 0.5, with a min and max of 1 and 20.
example ilvl53/3.9 = 13.589, because it's rounded up after 0.5 ilvl53 always rolls with slvl14.

ilvl99-77 is always slvl20
ilvl76-73 is always slvl19
etc
ilvl52-49 is always slvl13
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

Elmegaard
Posts: 7
Joined: Mon Nov 25, 2019 9:14 am
Denmark

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Elmegaard » Mon Dec 02, 2019 6:28 pm

Awesome thanks man!

EDIT:
This does not explain ranges to me though? I mean, I can sure calculate that to the ilvl of the unique, but in this case it should be 13-20. In that case is it always ilvl to 20? That does not seem right to me, but it could be that it is?

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

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Darkquake » Mon Dec 02, 2019 6:40 pm

Depends on the ilvl it spawns with. If baal drops it it'll be ilvl 99 and there for slvl 20. If it drops late nightmare it might only be ilvl53. Hence where you end up with a slvl range.
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

Elmegaard
Posts: 7
Joined: Mon Nov 25, 2019 9:14 am
Denmark

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Elmegaard » Mon Dec 02, 2019 6:44 pm

Ahh, so it's from the minimum ilvl it can drop as to the max it can drop as! I get it. Is there a way to get these numbers from the .txt files?

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

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Darkquake » Tue Dec 03, 2019 4:13 am

Well the cap is always slvl 20 because every item can drop at ilvl 99. The low end you would have to calculate based of the qlvl in uniqueitems. If min qlvl is 39 then the min slvl would be 10, so it would have a range of 10-20.
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

Elmegaard
Posts: 7
Joined: Mon Nov 25, 2019 9:14 am
Denmark

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Elmegaard » Tue Dec 03, 2019 9:15 am

I am not sure if it is because the diablo fandom wiki is wrong then, but I did as you say and it looks right for most items, but an item like this: https://diablo.fandom.com/wiki/Snowclash
Shows as 7-19 on this website, but will show as 13-20 for me.

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

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Darkquake » Tue Dec 03, 2019 10:19 am

That's correct, this changes when the skill in question has a required level. Blizzard has a required level of 24 so that is the ilvl that it starts counting up from. It's my mistake for not giving you a more global formula in the first place. A better formula would be:

(ilvl-(rqlvl-1))/3.9=slvl
ilvl = item level
rqlvl = player level required to use skill
slvl = skill level
Rouded up after 0.5, with a min and max of 1 and 20.

Example: ilvl49 snowclash,
(49-(24-1))/3.9=6.667, rounded up to 7.

afaik this formula would work for all proc skills such as; gethit, hit-skill, etc.
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

Elmegaard
Posts: 7
Joined: Mon Nov 25, 2019 9:14 am
Denmark

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Elmegaard » Tue Dec 03, 2019 10:36 am

Awesome, thanks! But in this case this sash has a max level of 19 for this blizzard. Is that just a mistake then? In theory it could drop as level 20?

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

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Darkquake » Tue Dec 03, 2019 11:26 am

If it could reach ilvl100 it would drop as slvl20 yeah. But with ilvl99 it can only reach slvl19. Tested with the formula and it checks out.
I make things? I make things.
Image
https://www.moddb.com/mods/darkquake

Elmegaard
Posts: 7
Joined: Mon Nov 25, 2019 9:14 am
Denmark

Re: Level ranges on %chance to cast level x-y spell on hit/damage taken

Post by Elmegaard » Tue Dec 03, 2019 12:01 pm

Thanks, this was a big help!

Post Reply

Return to “General Mod Making”