Well I am pretty much done, just running tests. I added a lot of options at the last minute for further limiting spell learning and class changing.
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]# base/classes
Unit 1 killed unit 3 and earned 1 experience. Total experience is 1
Unit 1 killed unit 5 and earned 1 experience. Total experience is 2
Unit 1 killed unit 6 and earned 1 experience. Total experience is 3
[DFHack]# classes/change-class -unit 1 -class SQUIRE
Class change successful. Changed from NONE to SQUIRE.
Unit 1 killed unit 8 and earned 1 experience. Total experience is 4
Unit 1 killed unit 9 and earned 1 experience. Total experience is 5
Unit 1 killed unit 11 and earned 1 experience. Total experience is 6
Unit 1 killed unit 7 and earned 1 experience. Total experience is 7
Unit 1 killed unit 15 and earned 1 experience. Total experience is 8
Unit 1 killed unit 16 and earned 1 experience. Total experience is 9
Unit 1 killed unit 12 and earned 1 experience. Total experience is 10
Unit 1 killed unit 14 and earned 1 experience. Total experience is 11
LEVEL UP!! SQUIRE LEVEL 1
REACHED MAX LEVEL FOR CLASS SQUIRE
Unit 1 killed unit 17 and earned 1 experience. Total experience is 12
[DFHack]# classes/change-class -unit 1 -class WARRIOR
Class change successful. Changed from SQUIRE to WARRIOR.
Unit 1 killed unit 20 and earned 1 experience. Total experience is 13
Unit 1 killed unit 23 and earned 1 experience. Total experience is 14
Unit 1 killed unit 19 and earned 1 experience. Total experience is 15
Unit 1 killed unit 21 and earned 1 experience. Total experience is 16
Unit 1 killed unit 22 and earned 1 experience. Total experience is 17
Unit 1 killed unit 32 and earned 1 experience. Total experience is 18
Unit 1 killed unit 27 and earned 1 experience. Total experience is 19
Unit 1 killed unit 29 and earned 1 experience. Total experience is 20
Unit 1 killed unit 30 and earned 1 experience. Total experience is 21
LEVEL UP!! WARRIOR LEVEL 1
Unit 1 killed unit 33 and earned 1 experience. Total experience is 22
Unit 1 killed unit 28 and earned 1 experience. Total experience is 23
Unit 1 killed unit 31 and earned 1 experience. Total experience is 24
Unit 1 killed unit 25 and earned 1 experience. Total experience is 25
Unit 1 killed unit 37 and earned 1 experience. Total experience is 26
Unit 1 killed unit 26 and earned 1 experience. Total experience is 27
Unit 1 killed unit 34 and earned 1 experience. Total experience is 28
Unit 1 killed unit 24 and earned 1 experience. Total experience is 29
Unit 1 killed unit 35 and earned 1 experience. Total experience is 30
Unit 1 killed unit 36 and earned 1 experience. Total experience is 31
LEVEL UP!! WARRIOR LEVEL 2
Unit 1 killed unit 43 and earned 1 experience. Total experience is 32
Unit 1 killed unit 48 and earned 1 experience. Total experience is 33
Unit 1 killed unit 44 and earned 1 experience. Total experience is 34
Unit 1 killed unit 40 and earned 1 experience. Total experience is 35
Unit 1 killed unit 39 and earned 1 experience. Total experience is 36
Unit 1 killed unit 41 and earned 1 experience. Total experience is 37
Unit 1 killed unit 42 and earned 1 experience. Total experience is 38
Unit 1 killed unit 46 and earned 1 experience. Total experience is 39
Unit 1 killed unit 45 and earned 1 experience. Total experience is 40
Unit 1 killed unit 47 and earned 1 experience. Total experience is 41
LEVEL UP!! WARRIOR LEVEL 3
REACHED MAX LEVEL FOR CLASS WARRIOR
Unit 1 killed unit 49 and earned 1 experience. Total experience is 42
[DFHack]#
I spawned 50 dogs and had a dragon kill them all, the onUnitDeath trigger caught 42 of them, so I think it has some trouble if a unit bleeds to death or something. Maybe if I have it run more often, since the dragon kills them very fast, I am unsure.
I will be posting all of my scripts tomorrow (was hoping for tonight, but I have found a couple bugs I need to fix, and I want to put together at least a little ReadMe for the classes scripts). Overall I am pretty happy with it. I don't really notice any slow down, and it has all the functionality I want for now (I am already thinking of other things to add, but I will release before I add more). The only thing that is finicky is the persistent variables, but expwnent said he plans on expanding that system sometime in the future so that you can store more than just a string and 7 integers, I guess when that happens I will need to rewrite a lot of these scripts, but it will also be much cleaner and faster.
For those interested the final design of the classes.txt and spells.txt files you will create are
classes.txt
[CLASS:WARRIOR] -- Unique ID for each class
[NAME:warrior:warriors:warrior] -- Standard NAME:PLURAL:ADJ for the class
[LEVELS:3] -- Number of levels a class has, note that they start out at level 0
[EXP:20:30:40] -- Experience required to move from each level
[REQUIREMENT_CLASS:SQUIRE:1] -- Previous class requirement
[FORBIDDEN_CLASS:BRAWLER:0] -- Prevents you from becoming the class if you have a forbidden class at a given level
[REQUIREMENT_PHYS:STRENGTH:1500] -- Required physical attribute
[REQUIREMENT_MENT:FOCUS:1500] -- Required mental attribute
[REQUIREMENT_SKILL:SHIELD:4] -- Required skill
[REQUIREMENT_TRAIT:ANGER:50] -- Required trait
[REQUIREMENT_COUNTER:PRAY:10] -- Required counter (used with my special-counter.lua script)
[BONUS_PHYS:TOUGHNESS:0:100:200:300] -- Bonus attributes given at each level
[BONUS_MENT:WILLPOWER:0:10:20:30] -- Bonus attributes given at each level
[BONUS_SKILL:ARMOR_USER:0:1:2:3] -- Bonus skill levels given at each level
[BONUS_TRAIT:ANGER:0:5:10:15] -- Changes to traits given at each level (not really sure its useful, but I figured why not)
[AUTO_UPGRADE:KNIGHT] -- If present, will upgrade to the given class at max level
[SPELL:SPELL_TEST_1:0] -- Spells the class can learn (must be the class at the time of learning the skill)
[SPELL_FORBIDDEN_CLASS:SQUIRE:0] -- Can't learn the spell if you have this class at this level
[SPELL_REQUIREMENT_PHYS:STRENGTH:2000] -- Can't learn the spell if your stats are below this
[SPELL_REQUIREMENT_MENT:FOCUS:2000]
[SPELL_FORBIDDEN_SPELL:SPELL_TEST_2] -- Can't learn the spell if you already learned this spell
[SPELL_UPGRADE:SPELL_TEST_3] -- If present, when learning the spell you will forget this spell
You can, of course, have multiple of all the tokens except AUTO_UPGRADE, EXP, NAME, and LEVELS.
spells.txt
[SPELL:SPELL_TEST_1]
[CDI:INTERACTION:TEST_1]
*Any CDI tokens you want
This file isn't strictly needed, but if you set it up the python script will generate the inorganics for the syndromes to learn the spells and will make sure that all the ID's match up properly.
Both files go in your raws folder.