Calc Functions based on Class

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
Posts: 9
Joined: Sat Feb 09, 2019 4:52 am
United States of America

Calc Functions based on Class

Post by ectorzage » Mon Feb 25, 2019 3:58 pm


So I am trying to recreate the elixirs from the original diablo. I have gotten it to where the potions can be consumed and do raise the stats. Strength and Dexterity are working just fine, but Vitality and Energy are proving problematic. I have identified the need for maxhp, maxmana, maxstamina, but cannot figure out the syntax. Here is what I could come up with:

Life per Vitality

Stamina per Vitality

Mana per Energy

Anyone have the silver bullet? I guess I just need to know how to incorporate class into the calculations.

User avatar
Site Admin
Posts: 9067
Joined: Sat Mar 25, 2006 1:22 pm
Location: The Land of the Dead
South Africa


Re: Calc Functions based on Class

Post by Necrolis » Mon Feb 25, 2019 10:00 pm

Unfortunately the formula parser doesn't provide a way to know if the target is a specific class; you need to do it based on a specific skill or stat value. Also important to note is that it only does integer math, so no decimals are supported, in this case its not an issue as those three stats work in 256ths.
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
Junior Member
Posts: 147
Joined: Sat Apr 26, 2014 9:19 am
Korea South

Re: Calc Functions based on Class

Post by mmpx222 » Tue Feb 26, 2019 12:04 am

You could make a dummy stat (class_type_stat). Then create 7 innate passive skills for each class that provide different amounts of the dummy stat. Then you could use a formula like:

Code: Select all

stat('class_type_stat'.accr) == 4 ? 120 : 0
However, the formula could become too long and easily exceed the 256 char limit. I suggest adding one dummy stat per effect (elixir_maxhp_factor, elixir_maxmana_factor, ...) and making the class-specific innate passives provide different amounts of each dummy stat.
D2TXT / D2INI - Python scripts for editing TXT files, or converting between TXT ↔ INI files

Post Reply

Return to “General Mod Making”