 __  ____  _  _  _____                  _           
|  |/  (_)| || |/  ___|               _| |_         
|  /  / _ | || |  /    ___  _   _ _ _|_   _|__ _ __ 
|    < | || || | (    / _ \| | | | '_ \| |/ _ \ '__|
|  \  \| || || |  \__| (_) | |_| | | | | |  __/ |   
|__|\__|_||_||_|\_____\___/ \__,_|_| |_|_|\___|_|   
 _____  _____ __  __           _ 
|  __ \/ __  |  \/  |         | |
| |  | \/ / /| \  / | ___   __| |
| |  | | / / | |\/| |/ _ \ / _  |
| |__| |/ /__| |  | | (_) | (_) |
|_____//_____|_|  |_|\___/ \____|
 ____  _             _       
|  _ \| |           (_)      
| (_) | |_   _  __ _ _ _ __  
|  __/| | | | |/ _` | | `_ \ 
| |   | | |_| | (_) | | | | |
|_|   |_|\__,_|\__, |_|_| |_|
 __  ________ _ __/ |  _   _   _                       
|  |/  /  ___| |___/ _| |_| | | |                      
|  /  /  / |_   _|  |_   _| | | | ___  __ _  __ _  ___ 
|    <  (    | |\ \/ /| | | | | |/ __|/ _' |/ _' |/ _ \
|  \  \  \___| | >  < | | | |_| |__  | (_) | (_) |  __/
|__|\__\_____|_|/_/\_\|_|  \____|___/ \__,_|\__, |\___|
                                             __/ |     
                                            |___/      
Version 1.2 - 4/5/5

Foreword:

This plugin was originally meant to just increase a stat upon killing an enemy, but I found out that there are quite a few other useful effects that you may like to try out or use in your mod.

-----

Contents of this txt guide.

1) Explanation of KillCounter.txt columns
2) Customisations - Funcs and MsgStr
3) Setting up the basic KillCounter (and more)
4) More tricks!

-------
  __
 /  |
 '| |
  | |	Explanation of KillCounter.txt columns
  | | 
  |_| 

MainFunc
- Determines how the line will be interpreted
-> There are 2 MainFuncs, Kill and Bonus

SubFunc	
- Determines how the other Func lines are interpreted
-> See below for the breakdown.

KilledMon, KilledPlayer, FuncStat, FuncVal
-> Params are dependent on the Func. See below.

Class
- Allows you to make a line class-specific
-> ama, sor, nec, pal, bar, dru, ass, or left blank
The 7 class codes are the same as the other text file. Leaving this column blank will allow all classes to access it.
**NeW in v1.2** You can write multiple codes in the same cell. Both "Sorpal Barnec" and "Sore Pale Bare Neck" will enable the line for Sorc, Paladin, Barbarian and Necro. Of course putting commas and spaces would make it more legible for you, to the compiler just scans through it all and gets the valid information.

Softcore, Hardcore
-> 1 (active) or blank
These are boolean columns that allow the line for Softcore and or Hardcore.

Normal, Nightmare, Hell
-> 1 (active) or blank
These are boolean columns that allow the line the various difficulties.

*remarks
This is a blank column for you to put any remarks or notes as you please. Useful if you have a lot of bonuses and you need to keep track of them.

 /----------------------------------------------\
< The columns after this are difficulty-specific >
 \----------------------------------------------/

Chance		**New v1.2**
- The chance to happen gets its own column in v1.2.
-> Takes 1-1023, blank or 1024 and above = 100% chance. If you want a 50% chance, put 512 etc.

Stat#, Val#
-> Stat: Get the name from ItemStatCost.txt
-> Val : Up to you
The 3 pairs of Stat and Val columns allow you to increase a stat by the amount in Val. If the stat has a maxstat, it will be checked and you will not be allowed to cross it.

TreasureClass
- You can drop an item or items using TreasureClassEx.txt
-> Put the name of the TC (eg. 'Perfect Gem' without the quotes ' ')

MainMsgStr
- This is a string key from one of the tbl files. The string will be displayed at the top of the screen, like "Diablo Walks The Earth"
- Read below to see how to customise this.

MsgParam#
- For customising the MsgStr

*eol	- The usual Blizzard *eol column, put a 0 in here.

-------
 ____
/ __ \
\/ / /
  / / 	Customisations - Funcs and MsgStr
 / /__
/_____|


-=- Funcs -=-

In the individual MainFuncs, you can further customise using SubFuncs.

>>-<_MainFunc: Kill_>-<<

SubFunc - The kind of unit you kill
-> <blank>, Monster, Player, Demon or Undead

If SubFunc is blank, every kill will be processed. This is the default setting to get a KillCounter, since you want every kill to increase your counter.

If SubFunc = "Monster", only specific Monster kills will be processed. You must put the Monster Name (not ID anymore) in the KilledMon column.

If SubFunc = "Player", the bonus will only be given when a player is killed. If you leave KilledPlayer blank, all PvP will trigger the reward, but you can put a class string ("ama" to "ass") to make it specific as well. v1.2 allows you to put multiple classes in the KilledPlayer column like the Class column (example above)

You could use this to increase a PlayerKillCounter for example, or give a bonus to statpoints or skillpoints.

If SubFunc = "Demon", the bonus will trigger for any demon kill.

If SubFunc = "Undead", the bonus will trigger for any undead kill.

FuncStat and FuncVal columns are unused. However, you can still use them for other things, see topic on MsgStr below.

>>-<_MainFunc: Bonus_>-<<

The Bonus lines allow you to give a bonus for attaining a certain value in a stat. They are triggered only if the stat they are checking has been increased. So these lines should always be put below all the Kill lines, so they will be triggered.

SubFunc - The kind of bonus
-> Once or Recurring

KilledMon and KilledPlayer are ignored.

FuncStat - The stat to check
You should use the stat Name from ItemStatCost.txt. Remember that the stat has to have been increased by KillCounter.txt, so if you have no Kill or Bonus line above it that increased this stat, this line will be skipped

FuncVal - Depends on the kind of bonus in SubFunc

If SubFunc = "Once", this bonus will only be triggered at that threshold you indicate in FuncVal.
eg. FuncStat = killcounter, FuncVal = 10000, the bonus will be given when you reach 10000 kills.

If SubFunc = "Recurring", this bonus will be triggered at all intervals indicated in FuncVal.
eg. FuncStat = killcounter, FuncVal = 50, the bonus will be given when your kills reach 50,100,150,...



-=- MsgStr -=-	**New v1.2**

MsgStr allows you to display a string from the tbl files on the screen. It also allows you to use %s and %d in these files and get KillCounter.txt to fill them up.

	What can this do?

The MainMsgStr is the Main Msg Str as the name suggests. If you have a string that says "You have killed 15000 monsters!" in a 'Bonus Once' line that checks killcounter for 15000, you'll have it to showing up on screen :)

However, there are some things that ought to be considered. First, if you want to tell them every 1000 kills, you'd need to have at least 200 of them to cover until 200,000 kills. Second, if you're playing a multiplayer game, who got that 15000 monster kills?

	So, what can I do?

There are a few new tricks that you can employ. First let's talk about the MsgParam columns. These columns can take a few identifiers and plug them into your MainMsgStr.

$p or $P	- Player Name
$k or $K	- Killed Player Name (for PvP of course)
$s or $S	- current value of the stat in FuncStat
$v or $V	- value in FuncVal
#<number>	- Any number, put the '#' in front to identify it as a number

To use this, you need to tweak your MainMsgStr in your favourite tbl editor. Say you like the output to be "<PlayerName> has killed <threshold value> monsters!", then in the tbl you should have

                 Key     :     String
playerhaskilledXmonsters : "%s has killed %d monsters!"

where %s and %d are the standard references to strings and numbers.

Now in KillCounter.txt, you should do the following.

MainMsgStr = playerhaskilledXmonsters
MsgParam1  = $p
MsgParam2  = $v

When this row is activated because you have crossed your threshold, this line will automatically display the string, and fill in the two references with Player Name and Threshold Value respectively!



-------

 _____
/ ___ \
\/  / /
   ( ( 	Setting up the basic KillCounter (and more)
/\__\ \
\_____/

Okay, now let's set up some samples.

To get the basic killcounter,
  MainFunc = Kill
  Softcore, Hardcore = 1
  Normal, Nightmare, Hell = 1
  Stat1,Stat1(N),Stat1(H) = killcounter
  Val1,Val1(N),Val1(H) = 1
  *eol = 0

To get a 1 skill point bonus for killing Diablo,
  MainFunc = Kill
  SubFunc = Monster
  KilledMon  = diablo
  Softcore, Hardcore = 1
  Normal, Nightmare, Hell = 1
  Stat1,Stat1(N),Stat1(H) = newskills
  Val1,Val1(N),Val1(H) = 1
  *eol = 0

To give 1 skill point for killing Diablo in Normal, 2 points in NM and 3 in Hell
line #1
  MainFunc = Kill
  SubFunc = Monster
  KilledMon  = diablo
  Softcore, Hardcore = 1
  Normal, Nightmare, Hell = 1
  Stat1 = newskills
  Val1 = 1
  Stat1(N) = newskills
  Val1(N) = 2
  Stat1(H) = newskills
  Val1(H) = 3
  *eol = 0

To have:
  25% chance in SoftCore
  50% chance in Hardcore
to get 5 stat points and 1 skill point from killing a Player,
you need 2 lines.
line #1
  MainFunc = Kill
  SubFunc = Player
  Softcore = 1
  Normal, Nightmare, Hell = 1
  Chance,Chance(N),Chance(H) = 256
  Stat1 = 4
  Val1 = 5
  Stat2 = 5
  Val2 = 1
  *eol = 0
line #2
  MainFunc = Kill
  SubFunc = Player
  Hardcore = 1
  Normal, Nightmare, Hell = 1
  Chance,Chance(N),Chance(H) = 512
  Stat1 = 4
  Val1 = 5
  Stat2 = 5
  Val2 = 1
  *eol = 0

To have:
  10% chance in Normal to get a Chipped Gem
  20% chance in Nightmare to get a Flawed Gem
  30% chance in Hell to get a Flawless Gem
from killing a demon:
  MainFunc = Kill
  SubFunc = Demon
  Softcore, Hardcore = 1
  Normal, Nightmare, Hell = 1
  Chance = 102
  Chance(N) = 205
  Chance(H) = 307
  TreasureClass = Chipped Gem
  TreasureClass(N) = Flawed Gem
  TreasureClass(H) = Flawless Gem (look in TreasureClassEx.txt to get your TCs)
  *eol = 0

I think covers all the important options under Kill, now let's look at Bonus.

Remember that you will need Kill or Bonus lines above this line to activate it. If the checked stat has not been increased, it will not work.

To get 10000 gold after achieving 10000 kills,
  MainFunc = Bonus
  SubFunc = Once
  FuncStat = killcounter
  FuncVal = 10000
  Softcore, Hardcore = 1
  Normal, Nightmare, Hell = 1
  Stat1 = 14
  Val1 = 10000
  *eol = 0

To get 50 gold after every 50 kills,
  MainFunc = Bonus
  SubFunc = Recurring
  FuncStat = killcounter
  FuncVal = 50
  Softcore, Hardcore = 1
  Normal, Nightmare, Hell = 1
  Stat1 = 14
  Val1 = 50
  *eol = 0
  
To give
  3 stat points in Normal per 300 kills
  5 stat points in NM per 400 kills
  7 stat points in Hell per 500 kills
to Hardcore characters,
you need 3 lines.
line #1
  MainFunc = Bonus
  SubFunc = Recurring
  FuncStat = killcounter
  FuncVal = 300
  Hardcore = 1
  Normal = 1
  Stat1 = 4
  Val1 = 3
  *eol = 0
line #2
  MainFunc = Bonus
  SubFunc = Recurring
  FuncStat = killcounter
  FuncVal = 400
  Hardcore = 1
  Nightmare = 1
  Stat1(N) = 4
  Val1(N) = 5
  *eol = 0
line #3
  MainFunc = Bonus
  SubFunc = Recurring
  FuncStat  = 183 (or your killcounter ID)
  FuncVal = 500
  Hardcore = 1
  Hell = 1
  Stat1(H) = 4
  Val1(H) = 7
  *eol = 0

To get an SOJ for reaching 77777 kills,
you'll need to create a new TC in TreasureClassEx eg:
  Treasure Class = My SoJ Drop
  Picks = -1
  Unique = 1024
  Item1 = The Stone of Jordan
  Prob1 = 1
  Term = 0

And then in KillCounter.txt
  MainFunc = Bonus
  SubFunc = Once
  FuncStat = killcounter
  FuncVal = 77777
  Softcore, Hardcore = 1
  Normal, Nightmare, Hell = 1
  TreasureClass, TreasureClass(N), TreasureClass(H) = My SoJ Drop
  *eol = 0

-------

    _
   / |
  /  |
 / / |  More tricks!
|__  |
   |_|

Beyond the usual stuff, you can also use the KillCounter to display messages or do specialised drops beyond the usual TreasureClassEx.

-=- Messaging -=-

I'd use this for debugging purposes, but having something that reports another value regularly would do different things for different people.

Use a Kill on your Killcounter and set the FuncStat and FuncVal to whatever you want to report. Use the MsgParams to display the Funcstat and you can watch your FuncStat. 

-=- Drops -=-

If you would like to have seemingly random drops, you could try this
  MainFunc = Bonus
  FuncStat = killcounter
  FuncVal  = 7
  Softcore,Hardcore = 1
  Normal,Nightmare,Hell = 1
  Chance = 30
  Chance(N) = 60
  Chance(H) = 90
  TreasureClass = Rune 3
  TreasureClass = Rune 8
  TreasureClass = Rune 11
  *eol = 0

I'm sure you'll find more tricks, and if you'd like to add them on, let me know before the next release and I'll quote you :)

-------------

Thanks for trying this plug-in out. If there are any bugs or queries, PM me in the Keep.

Cheers,
RicFaith


Acknowledgements:
Kingpin - Once again he's da man behind the offsets. He posted the info on the arena code.
Havvoric - Because NewTxt is goo-ood. Thanks for taking the time to teach me how to use it. And kudos for the TC drop methods.
SVR - First idea for killcounter, and honestly no D2Mod plugins without him either...