Basic Skill Edition Info

Weekly updated column for helping skill development. Users can't directly post requests but a PM or mail can be sent to Skill-Clinician.

Moderator: Skill Clinician

Locked

0
No votes
 
Total votes: 0

User avatar
Skill Clinician
Retired staff
Warrior
Posts: 23
Joined: Thu Jul 22, 2004 9:15 pm

Basic Skill Edition Info

Post by Skill Clinician » Tue Sep 21, 2004 9:56 pm

Objectives:
Reviewing basic files and techniques related to skills in Diablo II. Being able to lurk between skills and missiles to understand how a skill works and how to modify it.

Contents:
We'll focus here on the internal management of skills in Diablo II. Then we'll see how these skills are stored in the game database, and finally, we'll quickly see the important step to edit a skill.

User avatar
Skill Clinician
Retired staff
Warrior
Posts: 23
Joined: Thu Jul 22, 2004 9:15 pm

Re: Basic Skill Edition Info

Post by Skill Clinician » Tue Sep 21, 2004 9:59 pm

Diablo II is a client/server based game. Two threads are running at the same time on your computer when the game is running. A Server thread that will handle all the calculations in the game and a Client thread that will display graphics or play sounds depending on what the server thread decides. When you play on Battle.Net, the server thread is located on the B.Net server and the client thread runs on your machine. In a solo game, both threads run on your computer.

Why is this important? Well, to get a coherent way to control skills, the skill effects are split into server effect and client effect - each of which handles a totally different kind of task and produces a different kind of result.

Moreover, each effect type is split into two parts: the Start function and the Do function. If you open up skills.txt and look at the very first row, you'll see the four columns that handle these functions:
  • * srvstfunc: This is an index into a function table server-side which controls what the skill does when you first attempt to use it, assuming the check that you have enough mana and the right item equipped etc. passes. This function will generally check that certain requirements are met and for some skills it will pre-setup some values (for example srvstfunc 9, which is used by fend, will count the number of enemies in range and save that with the unit using the skill).

    *cltstfunc: Analogous to srvstfunc but client-side. Since this is a different table than the one used by srvstfunc, the numbers are different.

    * srvdofunc: Like srvstfunc, but controls what the skill does when you hit the contact frame of the cast animation (in the case of event-triggered skills, this occurs immediately after srvstfunc since there is no animation). The srvdofunc uses the fields prgcalcX, srvmissileX, aurafilter, aurastate, auratargetstate, auralencalc, aurarangecalc, aurastat#, aurastatcalc#, auraevent#, auraeventfunc#, auratgtevent, auratgteventfunc, passivestate, passivestat#, passivecalc#, summon, pettype, petmax, summode, sumskill#, sumsk#calc, sumumod, sumoverlay, do sound a, do sound b, calc#. In general, filling out any of the above fields unless you've assigned a srvdofunc which uses them will not have any effect. Each srvdofunc can use any of the above fields for its own purposes, but generally there is a sort of logic to which fields get used for what. There are a couple of cases where srvdofunc is 0. In such a case, if there is a srvmissile that missile is fired at the target (either x,y or unit). Skills with the passive field set to 1 will also usually have srvdofunc 0. Note that this is an index into a different function table from srvstfunc.

    * cltdofunc: Analogous to srvstfunc but client-side. Since this is a different table than the one used by srvstfunc, the numbers are different. It makes use of the same fields as srvdofunc, except it uses cltmissileX in place of srvmissileX, etc.
This layout allows us to easily mix and match skills, clone skills or swap skills. The core mechanisms of skills are handled by this quadruplet of function index and function arguments. Keep this in mind for future references.

The same organization applies to missiles:
  • * pCltDoFunc: gets called every frame of a missile's existence on the client.
    * pCltHitFunc: gets called on the client when the missile hits something.
    * pSrvDoFunc: gets called every frame of a missile's existence on the server.
    * pSrvHitFunc: gets called on the server when the missile hits something.
    * pSrvDmgFunc : gets called between when the missile calculates the damage it does and when it actually applies that damage - this function is used to modify the damage done.
What to Keep in Mind?
  • What to Keep in Mind ?
    * Diablo II uses a server/client model to handle almost anything.
    * Skill and Missile effects are split into client and server effects.
    * There are some internal tables that keep track of effect functions by an ordinal index..
Last edited by Skill Clinician on Sun Oct 17, 2004 9:01 am, edited 1 time in total.

User avatar
Skill Clinician
Retired staff
Warrior
Posts: 23
Joined: Thu Jul 22, 2004 9:15 pm

Re: Basic Skill Edition Info

Post by Skill Clinician » Tue Sep 21, 2004 10:02 pm

We can find different five types of skills, each with a different behavior.

Passives Skills :
These are the easiest to understand. They use no Server and no Client functions at all. When a character or a monster has at least one point in a passive skill, the game automatically adds the passive's bonus to the character or monster stats. Passives skills can only add stats to a unit, not properties. The distinction can be slim sometimes but limits the things we can add. One of the most significant limitations is that we can't add stats that are used in properties requiring three parameters,like bonuses using the night/day switch or chance to cast spell when triggered. Basically a +crushing blow passive can be done, a +chance to cast fireball when hit cannot. We'll see later how to simulate such behavior,though. The important columns for a passive skill are the various passivestat/passivecalc that hold the stat bonus and the passive column. Note that passivecalc accept formulae. The passive column is a boolean field that removes the skill icon from the Speed Skill Bar and tells the game that this skill is a passive one. Another couple of columns seem interesting - passiveevent and passiveeventfunc. More info on those will be given later.

Remember:
A passive skill is one that uses no functions (neither action nor init) and has the passive column set to 1.
The bonus of a passive skill can be found in the passivestat/passivecalc columns.

Aura, Enchantment and Curse Skills
An aura looks like a passive skill most of the time. The prime difference is that an aura skill updates its bonus dynamically, while a passive skill only updates its bonus when the skill level is increased. Enchantments and curses also look like passives, except that they have to be cast onto someone. Aura, enchantments and curses use action and/or init functions to be performed. Classically, an aura or curse's srvdofunc seeks a valid target in a given range. The cltdofunc will only display the overlay on affected units. The bonus or malus carried by the aura are listed in the aurastat/auracalc columns.

There are additional columns are worth mentioning. The aurafilter column is a bit hard to understand. We'll see later how it works, just remember that it's a bitfield that controls what kind of unit (allies, enemies, minions, all) the aura can affect. The aurastate and auratargetstate columns tell the game which state to assign to the aura bearer or to his/her target. We'll see later how states works and how they can be used. Finnally, the auralencalc and aurarangecalc are the length in frames and range in tile unit of the aura or curse. For auras, the perdelay column tells the game how often to update the aura bonus. Its a value is given in number of frames.

Remember :
An aura or curse is a skill that may use functions (action and/or init) to apply bonuses to a limited set of targets for a specified period of time or at fixed intervals. Various parameters can be used to control these.

Summon Skills
spawn a monster. This monster may or may not be aligned with the unit which has summoned it. It's an easy way to get additional firepower. Summonning skills use a little cluster of columns: summon tells the game which monster to summon. Pettype gives additional information about the pet display (icons, group,minimap,appearance,etc ...). Petmax is a formula field that controls the number of pets of this type the summoner can have simulteaneously. Summode tells the game in what animation mode the pet is summoned. Sumskill and sumskcalc are formula fields that handle the skills a pet can have. Sumumod is the special effects the pets can have. Sumoverlay is the graphical overlay that is played when the pet is summoned. Some summoning skills use special Server Initialisation functions. These functions allow the Skill to give passive bonuses to the pet or to force the player to use a special way to summon the pet (corpse, item, etc.).

Remember:
Summonning skills use an entry from monstats.txt to spawn a monster and give it some bonus or skills. We can control the number of pets summoned, the bonus they get and how they are summoned.

Missiles and Melee Skills
These are the bread'n'butter of Diablo II. Most of these skills have very special functions for server or client and use various columns to their full potential. Just note that some melee or missile skills can be mixed with passives or summoning skills, actually producing multiple effects at once. We'll see later that melee and missile skills can be VERY different from one another.
Last edited by Skill Clinician on Sun Oct 17, 2004 9:08 am, edited 1 time in total.

User avatar
Skill Clinician
Retired staff
Warrior
Posts: 23
Joined: Thu Jul 22, 2004 9:15 pm

Re: Basic Skill Edition Info

Post by Skill Clinician » Tue Sep 21, 2004 10:03 pm

Here is the basic list of files needed to edit skills :

skills.txt
skills.txt is the master database of skills. It contains the actual list of skills used in the game and their various parameters. It's a very, very picky file. A single space lost somewhere can cause unpredictable crashes, so always check if it's correctly saved. Another important point is to know how to actually open it correctly. Most of its fields contain formulas. Some of them begin with a dreadful - (minus) symbol, luring Excel into interpretating this field as a non-valid calculation. Be sure to always open your skills.txt files with the Open menu of Excel, then in the Open Wizard, set the type of every field to be Text instead of Standard. This will force Excel to NOT try to interpret formula incorrectly.

skills.txt uses references to two other files directly: skilldesc.txt and missiles.txt.

skilldesc.txt
skilldesc.txt is used as a description database for a skill. It holds all the information about the hover text of the skill: damage display, icons and any other display information a skill may need. Most of the data held here is refering to hardcoded display functions we'll see later. All string references are string entries that can be found in one of the three tbl files. This file basically solves most of the problems we may have had in 1.09 skill editing.

missiles.txt
missiles.txt contains missile information. We'll see later that it's basically a clone of skills.txt but for missiles. A missile has its own server and client functions, graphical display and other parameters like velocity, explosion graphics or light radius color. A missile is either tied to a skill or to another missile. Missile editing is the second most powerful way to achieve awesome skills effects.

Other Files
Files like itemstatcost.txt, monstats.txt and states.txt are also important for skill editing. Each will be discussed in detail when we need to edit them later on. Some types of skills may use a special stat or a special state from those files. Since they are relatively small, they'll be explained when needed. An important point to consider is the conresponding bin files that are generated by the game. If you ever pack your mod into a MPQ archive, don't forget to include those.
Last edited by Skill Clinician on Sun Oct 17, 2004 9:10 am, edited 2 times in total.

User avatar
Skill Clinician
Retired staff
Warrior
Posts: 23
Joined: Thu Jul 22, 2004 9:15 pm

Re: Basic Skill Edition Info

Post by Skill Clinician » Tue Sep 21, 2004 10:05 pm

This part of the guide will go through some basic but very irritating errors that will lead to either confusing crashes, strange behavior or whatever.

Empty name:
The skill is just not generated and doesn't do anything or is not properly displayed.

A good way to detect that is to use Paul Siramy D2 Checker.

Modifying Hardcoded related skills:
A few skills are difficult to change, clone or swap.

The non exhaustive list includes:

* Amplify Damage
* All Auras used by monsters

Moreover, moving or removing monsters skills before the Expansion line leads to crashes or non-working expansion skills.

Duplicate Names :
You will notice your skill doesn't behave as it normally should. It could be a simple thing like it deals fire damage instead of cold damage, even when you are sure you have added the correct elemental type.

No error is shown either in D2logfile or when entering. So how to detect it?

A great help is to use D2 Analyser by Paul Siramy.

Unequal number of skills per class:
Unable to Enter game, Bad Inventory Data

Let's say you add a new skill to Necromancer but not to other. This happens often if you're testing stuff. Upon entering a game with a class that using less skills than this one, you receive that error message.

In your log file, you should find this line:

[PLAYER LOAD] ClientAddPlayerToGame() Error Loading:<char name> Error:7=nError

Using same skill name as state name
Last edited by Skill Clinician on Sun Oct 17, 2004 9:14 am, edited 3 times in total.

Locked

Return to “Skill Clinic”