Normally when adding stats, they are added to the next row & ID. Due to the way D2 handles global character stats, you can only use these as item stats. Problem is, item stats can't be modified easily and require an item.
Solution: Use an "unused" entry that's less than 255. This will create a 'global' stat that can be saved with the characters stats.
As an example, I'll go through how I created the Kill Counter.
First, make a 'kill_counter' stat. This will be saved in savefile and loaded each game.
In itemstatcost.txt...
Code: Select all
Find unused183 entry and change these columns ...
Send Bits = 32 (send this stat to clients )
Saved = 1 (yes, save this stat)
CSvSigned = 0 (not needed but you may want to save negitive values)
CSvBits = 32 (could be whatever you need, up to 32)
Devide = 1024 (I just stuck this here to avoid /zero , maybe not needed.)
Direct = 1 (must be 1 to allow changes through skill, maxstat not required)
I used a skill.
In Skills.txt ...
Code: Select all
Add a new row & use next ID. Changes these columns ...
skill = CountKills
Id = 357
skilldesc = prayer (not needed but you can add a skilldesc entry if you want to)
srvdofunc = 65 (the prayer function, modifies the aurastat over time)
aurafilter = 65795 (not sure here, I think its the right one for player only ?)
aurastate = prayer (you can/should make your own state to avoid conflicts)
aurastat1 = unused183 (put your stat to modify here)
aurastatcalc1 = 1 (value to add to your stat, may use the calcs & params to get fancy)
attackrank = 0 (probably not needed)
range = none (no range required)
monanim = xx (not needed ?? )
itemeffect = 1 (yes, need to use for items)
reqlevel = 1 (ok)
aura = 1 (do we need this for an item triggered effect ? )
InGame = 1 (yes,works in game)
hitshift = 8 (not needed ?)
In itemstatcost.txt ...
Code: Select all
Add a new row & use next ID. Create a dummy stat for op function target.
Stat = dummy (name doesn't matter, just make it unique)
Id = next Id
Add a new row & use next ID. Create a display only stat.
Stat = display_kills
Id = next Id
Divide = 1024 (no /zero)
Save Bits = 1 (must have at least one save bit to save item stats)
op = 2 ( stat * op base >> op param )
op param = 0 ( no divide, we want to see the real value of "op base" )
op base = unused183 (the stat to display)
op stat1 = dummy (we don't want to add the stat to anything, use dummy)
descpriority = 180 (use whatever you want. determines order in which stats are displayed)
descfunc = 3 (show stat as "number Text". no +/- or % )
descval = 1 (show number *before* text)
descstrpos = KillCount (string table key, set key to " Kills")
descstrneg ... same
To use this in a 'real' mod you need to add a property.txt entry for the display_kills stat so you can have it generate on an item. And add the skill_on_kill with the CountKills parameter to a startup item or Quest reward etc.
It's pretty cool, you can drop the display charm and later pick it up and it shows the right kills. If another player picks it up, it shows their kills ;-)
Other possibilities ... many,many
Instead of the dummy stat, make it 'level'. When holding the charm, number of kills increases your level making very high levels possible.
'Blood Lust' skill. Increase counter on kills. Decrease over time. Apply to Strength and Stamina. If you keep killing you're god, stop and you get weak (as long as the aura is active ;-)
To Do: Need to figure out event functions. Would be nice to use them instead of skills as triggers.