Posted by: CamDawg
« on: August 01, 2013, 02:09:23 PM »
ADD_MUSIC fails if there are already 100 entries unless it's a GemRB game or TobEx is detected, but the EE games have this ability built in.
ADD_KIT is also going to be a bit problematic going forward, as EE kits have a lot more 2da files they need to touch to work (especially thief kits). The other problem is that some of these are still being finalized, but I wanted to at least get you a head start on what's coming. For backwards compatibility we'd probably have to extend ADD_KIT to update the new files, but provide default values if an older mod with ADD_KIT gets installed.
backstab.2da now provides for extra rows that allow for kits to define a custom backstab multiplier progression. If the row is not present the kit can not backstab.
0 1 2 3
THIEF 1 2 2 2
SHADOWDANCER 1 2 2 2
ASSASIN 1 2 2 2
BOUNTY_HUNTER 1 2 2 2
STALKER 1 2 2 2
clastext.2da allows for unique player1 biographies determined by the class/kit. It's not yet finalized and is currently of the form:
CLASSID KITID LOWER DESCSTR MIXED BIOGRAPHY FALLEN
FIGHTER 2 16384 7201 9556 1076 15881 0
BERSERKER 2 1 24239 24284 24261 15881 0
DWARVEN_DEFENDER 2 34 31973 31975 31974 15881 0
FALLEN_RANGER 12 16384 10365 9557 10369 15888 1
For now I'd suggest simply copying the parent's line outright and setting the kit ID. Biography values of -1 default to the generic biography.
clswpbon.2da lets modders set the non-proficiency penalties for kits and whether they can get extra APR for weapon specialization and beyond. A sample:
GETS_PROF_APR UNARMED_DIVISOR ZERO_SKILL_THAC0
MAGE 0 0 5
FIGHTER 1 0 2
CLERIC 0 0 3
ABJURER 0 0 5
The UNARMED_DIVISOR has to do with monks (the default monk and its kits all have 3 in this column).
hpclass.2da lets kits use a different (or custom) HP progression table than their parent class; i.e. mage kits could use the cleric HP table if desired. In this case the fighter kit Dwarven Defender is using the barbarian d12 progression:
TABLE
FIGHTER HPWAR
BERSERKER HPWAR
DWARVEN_DEFENDER HPBARB
numwslot.2da lets the modder decide how many weapon slots to give the kit:
SLOTS
MAGE 2
FIGHTER 4
KENSAI 4
thiefskl.2da lets the modder determine how many points the kit gets to distribute at character creation and at future level ups. Classes/kits w/o thief skills shouldn't use this table:
START_POINTS LEVEL_POINTS
THIEF 40 25
SHADOWDANCER 30 15
ASSASIN 40 15
BOUNTY_HUNTER 40 20
SWASHBUCKLER 40 25
MONK 0 10
The monks are there for the detect traps stuff.
traplimt.2da externalizes the maximum number of traps a thief can set:
LIMIT
THIEF 6
FIGHTER_THIEF 6
BOUNTY_HUNTER 6
clascolr.2da determines the default coloring for classes and kits (column-wise):
MAGE CLERIC BERSERKER
METAL 57 25 25
MINOR_CLOTH 58 28 28
MAIN_CLOTH 122 57 57
LEATHER 1 2 2
ARMOR 43 24 24
clasiskl.2da determines a class/kit's initial thieving bonuses (column-wise):
MAGE
PICK_POCKETS 0
OPEN_LOCKS 0
FIND_TRAPS 0
MOVE_SILENTLY 0
HIDE_IN_SHADOWS 0
DETECT_ILLUSION 0
SET_TRAPS 0
clasthac.2da lets a kit start with an initial thac0 bump over the normal class progression (column-wise):
MAGE FIGHTER
BONUS 0 0
thiefscl.2da determines what thieving skills a class has access to, and possibly bonuses. A zero means the kit can't use the skill (or invest points). Non-zero values are percentages applied to the skill points invested--so a value of 150 in find traps means that I actually get 15 points of find traps for every 10 points I actually put in. The default 2da only has values of 0 and 100:
2DA V1.0
0
MAGE THIEF BARD FERALAN
PICK_POCKETS 0 100 100 0
OPEN_LOCKS 0 100 0 0
FIND_TRAPS 0 100 0 0
MOVE_SILENTLY 0 100 0 100
HIDE_IN_SHADOWS 0 100 0 100
DETECT_ILLUSION 0 100 0 0
SET_TRAPS 0 100 100 0
STEALTH 0 0 0 0
Though it's there, the STEALTH row is unused and filled with nothing but zeroes.
And this is majorly QND, ugly hack but if it helps at all... this is a function I wrote for SP Collection to basically clone the kit's parent class values in these 2da files:
DEFINE_ACTION_FUNCTION ee_kit_appends STR_VAR class = "CDNOTSET" kitname = "CDNOTSET" BEGIN
ACTION_FOR_EACH file IN backstab clastext clswpbon hpclass numwslot thiefskl traplimt BEGIN
ACTION_IF FILE_EXISTS_IN_GAME ~%file%.2da~ THEN BEGIN
ACTION_IF ((FILE_CONTAINS_EVALUATED(~%file%.2da~ ~^%class%\([ %TAB%].+\)$~)) AND NOT
(FILE_CONTAINS_EVALUATED(~%file%.2da~ ~^%kitname%\([ %TAB%].+\)$~))) THEN BEGIN
COPY_EXISTING ~%file%.2da~ ~override~
REPLACE_EVALUATE ~^%class%\([ %TAB%].+\)$~
BEGIN SPRINT "RESULT" "%MATCH1%"
END
~%class%%RESULT%~
APPEND ~%file%.2da~ ~%kitname%%RESULT%~
COPY_EXISTING ~%file%.2da~ ~override~
PRETTY_PRINT_2DA
END
END
END
ACTION_FOR_EACH file IN clascolr clasiskl clasthac thiefscl BEGIN
ACTION_IF FILE_EXISTS_IN_GAME ~%file%.2da~ THEN BEGIN
ACTION_IF ((FILE_CONTAINS_EVALUATED(~%file%.2da~ ~[ %TAB%]%class%[ %TAB%]~)) AND NOT
(FILE_CONTAINS_EVALUATED(~%file%.2da~ ~[ %TAB%]%kitname%[ %TAB%]~))) THEN BEGIN
APPEND ~%file%.2da~ ~ ~ // add trailing newline
COPY_EXISTING ~%file%.2da~ ~override~ // first, add column on end
REPLACE_TEXTUALLY ~%TAB%~ ~ ~
REPLACE_TEXTUALLY ~ *$~ ~~ // remove trailing spaces from lines
REPLACE_TEXTUALLY ~\( +[^ ]+ +[^ ]+ +\)\([^ %LNL%%MNL%%WNL%]+\)[ %LNL%%MNL%%WNL%]+$~ ~\1\2 \2~ // only grab rows with at least three entries to avoid header
COUNT_2DA_COLS col_num
COUNT_2DA_ROWS col_num row_num
COUNT_2DA_ROWS (col_num - 1) row_num_test
PATCH_IF (row_num_test != row_num) BEGIN // basically, header row doesn't have initial entry
SET row_num += 1
READ_2DA_ENTRY 0 0 (col_num - 1) temp
SET_2DA_ENTRY 0 0 (col_num - 1) ~CDTEMPHEADER %temp%~
END
COPY_EXISTING ~%file%.2da~ ~override~ // now set values on new column
FOR (index = 0 ; index < col_num ; ++index) BEGIN
READ_2DA_ENTRY 0 index col_num header
PATCH_IF ("%header%" STRING_COMPARE_CASE "%class%" = 0) BEGIN
SET_2DA_ENTRY 0 (col_num - 1) col_num CDNEWKIT
FOR (index2 = 1 ; index2 < row_num ; ++index2) BEGIN // copy class values to newkit column
READ_2DA_ENTRY index2 index col_num temp
SET_2DA_ENTRY index2 (col_num - 1) col_num temp
END
END
END
COPY_EXISTING ~%file%.2da~ ~override~
REPLACE_TEXTUALLY ~CDTEMPHEADER ~ ~~
REPLACE_TEXTUALLY ~CDNEWKIT~ ~%kitname%~
PRETTY_PRINT_2DA
END
END
END
END