(Tutorial) Skills.txt and passiveitype

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
kongdev
Posts: 7
Joined: Mon Oct 30, 2017 9:54 am

(Tutorial) Skills.txt and passiveitype

Post by kongdev » Sat Jul 22, 2023 4:18 am

Short summary
In my various projects of unfinished and odd mods, there is one special little trick which enables plenty of wonderful ideas.
This is not that advanced itself, but you'll need to have some advanced knowledge already to really make full use of it.
I've provided a few examples first
What you will learn:
Passive specific Reanimated
Passive Auras
Passive oskills
Chaining oskills
Extending max passivestat properties via. chained oskills



Skills.txt
Inside Skills.txt, we are interested in passiveitype. If you input the code from a row in ItemTypes.txt, it will read that as parameter for your passivestat1 entry.
What this means, in short, is that we are given a single passivestat1 entry in which we can specify the parameter.
Normally we are unable to do that, because there's only a passivecalc1 field.
In other words, there are some new things we have "unlocked", and to really find out what we have to delve into ItemStatCost.txt


ItemStatCost.txt
Inside this file is a row entry called item_reanimate, which are the reanimated monsters from items such as Faith runeword in unmodded D2.
Turning this into a passive would mean that you can specify which monster id (from MonStats.txt) should spawn, read from passiveitype (but again, this reads from ItemTypes.txt), and the chance to happen, read from passivecalc1
And here is where we will need to introduce, dummy ItemTypes


Dummy ItemTypes
Say you want to spawn a reanimated Diablo as a passive, since he has hcIdx 243 we will come into an issue.
There is simply no item row 243 in ItemTypes.txt!
We will need to create a bunch of dummy itemtypes. These are only used for referencing via. passiveitype in Skills.txt
In other words you will need as many dummy rows as the number you are trying to use as value.
That doesn't matter if it is in Skills.txt or MonStats.txt, if you want to use skill id or monster id as 300, you'll need at to add as many rows to ItemTypes.txt
Due to the file structure, it is not perfectly aligned 1:1 (using code 'gems' for example would become the skill, 'Resist Fire')


Now you see it
But that was just one out of many entries in ItemStatCost.txt
Why limit ourselves to reanimates? I haven't experimented with every stat, but I can show you a few promising ones I did find use of.

Introducing stat entry, item_nonclassskill, also known more commonly as 'oskills'
The same rules apply. To make your new passive reference the row you want, you use passiveitype.
Make sure it matches your dummy row, or if using a low id you may have to use an actual itemtype code.
Ta da, you just made a passive give you an oskill to say, +x Charged Bolt.
Don't worry, we'll get back to why this is amazing.
Do let it be noted, to use skill id more than 254, you'll need to increase cap of the stat first.

Another neat one is item_aura
There is a few issues with this one, mainly that it affects how item-worn auras behave.
Creating a passive aura, in other words, you put a skillpoint into Defiance; and then you gain the Defiance aura immediately. No need to spend a mouse slot, maintaining it on all the time. This is a passive aura, one that I've found to be useful in many cases but also isn't a perfect solution because it can be wonky with aura interaction. It was mostly something I used in non-vanilla mods. An example, you can make mercenaries trigger their aura immediately on spawn, softcoded this way - but they won't be able to wear an item giving an aura, and have the passive aura on at the same time.)
It's the same ruleset as before, reference the skillid via. passiveitype and it becomes your aura.

There are more stats, such as state, that can be specified too.


Let's take it up a notch
You remember thinking the Charged Bolt thing was silly? It does get stupid now.
If we go back to Skills.txt, and take a look at Charged Bolt itself, we will see that the passive-related cells are not used.
Thus, if we input the item_nonclassskill there, and gave it a reference to say, Ice Bolt.
Then we do the same, and we add another item_nonclassskill, but this time to Ice Bolt. We'll make it reference Fire Bolt.
Let's not go too crazy and stop there.
The result, when you put a skillpoint into your new passive, you'll immediately get 3 new oskills: Fire, Ice and Charged Bolt!
Chaining oskills is the cool new excuse to give your sorceress a whole new tri-elemental skillpage.
Another neat perk is that you can bypass the stat limitations for passive skills by chaining it with another passive, increasing the limit with each chain (I've not really tested if there was a limit, but the actual one would be 1023 seeing as that is the highest you can increase the oskill cap to)

One should remember that skill icons will, in most certain cases, need to be added correspondingly, and it's recommended to not reference class skills due to oskill +3 limit.




In the end, your limit is your skill and missile knowledge and monster knowledge, as skills can use missiles that spawn monsters.
There are many crazy combinations one can do, when you can chain several skills and passives, even auras.
Just remember that if you add them to a hardcoded skill such as 'Attack', every class will get the skill. If you'd rather there was differences between each, you'll have to flesh out the skills themselves with either dummystat calculations or other ways to negate it.

I believe this ends my rambling and hope you may find this of use; I certainly have found it immensely powerful.
Last edited by kongdev on Wed Jul 26, 2023 3:56 pm, edited 10 times in total.

User avatar
kongdev
Posts: 7
Joined: Mon Oct 30, 2017 9:54 am

Re: Skills.txt and 'passiveitype'

Post by kongdev » Sat Jul 22, 2023 4:30 am

The result of simply just chaining Fire Bolt via. this method, so that the passivefields reference to Ice Bolt, which then references to Charged Bolt.
The result is the tri-elemental paladin, or whatever skills you want to chain.

Image
Last edited by kongdev on Wed Jul 26, 2023 6:42 am, edited 1 time in total.

User avatar
Cypress
Moderator
Champion of the Light
Posts: 448
Joined: Fri Dec 01, 2017 2:08 am

Re: 'Breakthrough': Tutorial to Skills.txt and passiveitype, and how to chain oskills

Post by Cypress » Mon Jul 24, 2023 12:51 am

Very cool guide kongdev! Some quick notes for anyone that is planning on using this method (I'm a huge fan of this, first heard of it with: viewtopic.php?t=63447 and did a lot of experimenting years ago).
(1) This technique may cause crashes. I can't remember what exactly results in the crash, except that it will happen on death. However, now that I test it again on a new computer, I cannot get the crash to occur, so either it was some weird setup of my mod, or it has some obscure computer-related cause. If anyone does happen to experience the crash, the fix I used was: set plrstaydeath,monstaydeath,bossstaydeath=1 on the itype state to stop death crashes.
(2) Delete the Expansion row from itemtypes.txt. It's really annoying, as it offsets the expected ID of each itemtype. The Expansion row does nothing and is not counted towards the file IDs.
(3) Passive aura doesn't just disable aura-on-equipped from hirelings, but also from players.

And a few questions/notes/opinions:
You say that you can update passive skills by giving Attack through an itype state. Do you mean this constantly updates all passives? I have something like this in my mod, although I'm not able to pull that off with just Attack. How exactly are you doing this?

I think giving players skills with this method is questionable. You have to sacrifice an entire state every time you do this, which is a rather hefty cost considering the 256 state limit. Or are you stacking the states somehow to conserve them? I'm not seeing any other way you can pull off entire skill trees or chain hundreds of passives with this method otherwise.

I think a more flexible alternative to passive auras is to set your auras to use SC anim and periodic=1. This will make it so you can cast your aura, which will remain activated until you choose to cast a different aura. In your example, you would be stuck with only one aura ever, because if you upgrade Defiance, then it will be active over all other auras, so the Paladin would be forced into an awkward situation where he has 20 aura skills, but effectively has only 1 that can ever be used until he re-specs into a different aura.

User avatar
kongdev
Posts: 7
Joined: Mon Oct 30, 2017 9:54 am

Re: (Tutorial) Skills.txt and passiveitype

Post by kongdev » Wed Jul 26, 2023 4:03 pm

Cypress wrote:
Mon Jul 24, 2023 12:51 am
Very cool guide kongdev! Some quick notes for anyone that is planning on using this method (I'm a huge fan of this, first heard of it with: viewtopic.php?t=63447 and did a lot of experimenting years ago).
Hi, I'm glad to hear others have been experimenting too, I was hoping others could chime in and perhaps introduce even more knowledge, I've far from tried every isc entry (disappointed to say ctc effects seem not to work, at least not at my early attempts at it)
Cypress wrote:
Mon Jul 24, 2023 12:51 am
(1) This technique may cause crashes. I can't remember what exactly results in the crash, except that it will happen on death. However, now that I test it again on a new computer, I cannot get the crash to occur, so either it was some weird setup of my mod, or it has some obscure computer-related cause. If anyone does happen to experience the crash, the fix I used was: set plrstaydeath,monstaydeath,bossstaydeath=1 on the itype state to stop death crashes.
I haven't experienced any crash that seemed odd, other than maybe skilldesc-related ones (icons primarily), but this is good info to know!
Cypress wrote:
Mon Jul 24, 2023 12:51 am
(2) Delete the Expansion row from itemtypes.txt. It's really annoying, as it offsets the expected ID of each itemtype. The Expansion row does nothing and is not counted towards the file IDs.
This is really neat. I wasn't sure if I could or not, so I opted not to touch it. Good to hear that I can
Cypress wrote:
Mon Jul 24, 2023 12:51 am
(3) Passive aura doesn't just disable aura-on-equipped from hirelings, but also from players.
Passive aura in general seems like it has a big trade-off, unless you start using that effect as part the mod ("you can only have one aura active")
I haven't really found a use for it in vanilla-like mods, because it'll break the current design of auras.

Cypress wrote:
Mon Jul 24, 2023 12:51 am
I think giving players skills with this method is questionable. You have to sacrifice an entire state every time you do this, which is a rather hefty cost considering the 256 state limit. Or are you stacking the states somehow to conserve them? I'm not seeing any other way you can pull off entire skill trees or chain hundreds of passives with this method otherwise.
I should probably have mentioned this, but I completely forgot.
You can re-use the same state for your chained oskills. (At least, for 'active' skills such as fire bolt, this has been tested. Pure passives might not be re-useable, I'd need to test again.)
I bolded it because as you say, states are the lifeblood and we are given so few (softcoded), so this in itself is great.

But yeah, I was just being silly and over the top, I don't think a full triple-skill tree for every class would be viable.
However, one really cool use case I loved was the whole summon Golem skills. Instead of having 4 different skills (and even having to level all 5 for golem synergy, wtf blizzard?), you could just have a single summon golem skill and then pick your own one at any time. (You'd still be limited to your petmax calcs)
Cypress wrote:
Mon Jul 24, 2023 12:51 am
And a few questions/notes/opinions:
You say that you can update passive skills by giving Attack through an itype state. Do you mean this constantly updates all passives? I have something like this in my mod, although I'm not able to pull that off with just Attack. How exactly are you doing this?
I've edited that section out for now, cause I wrote it badly.
Granting oskills this way, via. Normal Attack/Throw (hardcoded skills) does work and adds the skills to the character but seems to suffer from the same issue that they aren't triggered on character creation (so no, doesn't update)
The only way I could get it to update constantly is to use passive aura, which for some reason does work on character creation (which seems odd?) - but then you suffer with other issues.
Cypress wrote:
Mon Jul 24, 2023 12:51 am
I think a more flexible alternative to passive auras is to set your auras to use SC anim and periodic=1. This will make it so you can cast your aura, which will remain activated until you choose to cast a different aura. In your example, you would be stuck with only one aura ever, because if you upgrade Defiance, then it will be active over all other auras, so the Paladin would be forced into an awkward situation where he has 20 aura skills, but effectively has only 1 that can ever be used until he re-specs into a different aura.
That seems like a cool solution, I haven't tried it myself, toggle-able skills are fun though
My 'idea' of passive aura was more the idea that you had a skillpage of auras and you were limited to one, maybe even 'build' it via. increasing pulse rate and what not, in other skills on the same page.

Return to “General Mod Making”