QUICK TUTORIAL: Creating New Skill Modifiers for Items

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

User avatar
Borgin
Forum Regular
Angel
Posts: 902
Joined: Fri Dec 05, 2003 5:25 am
Location: Wisconsin

QUICK TUTORIAL: Creating New Skill Modifiers for Items

Post by Borgin » Wed Apr 19, 2023 1:47 am

This was requested by a user on the discord! I'm always happy to help others with modding.

If you’ve played almost any modern arpg, you’ve seen items that grant bonuses to specific skills. Things like “100% Increased Effect of Buffs from your Flame Golems” or “50-100 Physical Damage to Vire’s Might” or *cough* “11% Damage to Tempest Rush”. Suffice to say, item-based modifiers to skills are very common and they make for interesting gear choices. This tutorial will empower you to add these stats to Diablo II, allowing for extra spicy items!

First, let’s go over what files you’ll need in order to add skill modifiers to items:

Code: Select all

Itemstatcost.txt
Properties.txt
Skills.txt
uniqueitems.txt
You’ll also want to be familiar with adding new strings to the game so the new modifiers show up correctly.

For the sake of explanation, this tutorial will cover two very easy cases: We’ll add one stat that doubles the effectiveness of the passive skill Critical Strike, and another one that lets you summon an additional Clay Golem.

The first file we’ll need to modify is itemstatcost.txt. We’ll add two new rows at the end of the file, and give them the next ID’s in sequence. Let’s call them special_double_crit and special_extra_golem. Of course you can name them whatever you want. To make this easier on us, let’s copy in all the other values from the life for knockback (id 81). Then, we only need to change a couple of things:
Remove the damagerelated/itemevent/itemeventfunc entries
Change descstrpos and descstrneg to modcritspecial (for special_double_crit) and modgolemspecial (for special_extra_golem)
Let me break down what this will do. We’ve added the new stats to the game now, and we’ve also given it a string for the game to display when the itemstat appears on an item (the descstrpos/neg). While we really added these new itemstats to be booleans, we could easily add new modifiers that, say, add an hp modifier to Skeletons, or increase Fire Arrow’s fire damage by 10%-20%, or reduce the frames between Thunder Storm strikes by 1-20, or whatever. The sky's the limit!

Right away, let’s get these strings added to our string table. Open up your .tbl file of choice and add these new strings, modcritspecial and modgolemspecial. You can have the description show up however you’d like, but here’s what I’d put for each:

Code: Select all

Doubles the effectiveness of Critical Strike
Allows an additional Clay Golem summoned
Now we have item modifiers, and strings for when those mods show up. Now all we need is to turn this itemstat into a property, so we can tie it to items. This one’s easy. Open up properties.txt. Add two new rows to the bottom. Call them doublecrit and extragolem, set func1 to 1, set stat1 to our new itemstats (special_double_crit and special_extra_golem), and that’s it.

Now we’ll need to make sure our skills have these effects added correctly. Open up skills.txt and go to Critical Strike. Passivecalc1 is the column that controls the critical strike chance added by the skill, so let’s just change it from “dm12” to this:

Code: Select all

(1+stat(‘special_double_crit’.accr)*dm12
What this formula tells the game to do is, if you don’t have the new item stat, you have 1*dm12, meaning no change. But if you DO have special_double_crit, then 1+1 is 2, so you double dm12. This will double whatever effectiveness the skill has. Let’s now do the same for Clay Golem. Navigate to its row and scroll right to the petmax column. Change the “1” to:

Code: Select all

1+stat(‘special_extra_golem’.accr)
This is pretty straightforward, you can always summon 1 Golem, but if you have that extra_golem itemstat, you get another one (or really, as many extras as you grant from the itemstat).

Now we’ve got those set up. Let’s add them to some unique items for extra flavor! Open up uniqueitems.txt. Let’s have Ichorsting (row 70) get the double crit effect, and how about Ironstone (row 24) for an extra golem? All we need to do is add the properties we created- doublecrit added as prop7 for Ichorsting, with min/max set to 1, and extragolem added as prop7 for Ironstone, with min/max set to 1.

You’re done! Now, when these items drop, they’ll have an extra special unique modifier on them that will apply only to these skills.

Hopefully, this tutorial gives you some ideas about other new stats you could add to make items more interesting, and allow for more diverse skill choices! Just remember, itemstatcost.txt is limited to ~500 rows, so it’s best to use these sparingly… or find a clever workaround! But that’s an idea for a different tutorial.

Return to “General Mod Making”