Python Feats - GrognardsFromHell/TemplePlus GitHub Wiki
Making a new feat consists of two parts:
The format is
name: <feat name>
flags: <flags>
prereqs: <code> <value> <code> <value> ... <code> <value>
description: <description shown in the Character UI info box; must be one line; use vertical tab character if you need line breaks ( 0xB in hex, see the help.tab file for example) >
prereq descr: <short prerequisitive description>
The feat name will be used as an ID for the feat as well.
The flags field is a number representing a bitfield. The full list of flags can be found here.
You have to choose the relevant flag values, OR them, and input the resultant number in decimal.
The ones relevant for common usage are:
- FPF_CLASS_AUTMATIC - causes the feat to be hidden from normal feat selection
- FPF_CAN_GAIN_MULTIPLE_TIMES - like it says
- FPF_RACE_AUTOMATIC - in the future, if/when new races are added ;)
Example:
Let's say we want the flags
FPF_CAN_GAIN_MULTIPLE_TIMES, FPF_CLASS_AUTOMATIC and FPF_MULTI_SELECT_ITEM
The hex number is then
0x1 | 0x8 | 0x100 = 0x109 = 265
Making general Multiselect feats (a la Weapon Focus) is not yet supported. I want to generalize it as well since the current method is very shitty (you have to create a feat entry for each and every item).
The prereqs field is more interesting - this is where the prerequisites for the feat are listed.
Prerequisite definitions come in pairs of <code> <value>
The codes are either:
-
A stat_X enum (e.g. stat_strength, stat_level_fighter, stat_attack_bonus for minimum BAB)
-
A number between 1000-1999 which represents a feat enum via
feat_enum = value-1000
e.g. if you want feat_dodge, the number is 1000 + 24
See constants.py for the list of feat (and stat) enums. -
One of the following special codes
featReqCodeMinCasterLevel = -2
featReqCodeTurnUndeadRelated = -3
featReqCodeWeaponFeat = -4,
featReqCodeEvasionRelated = -5,
featReqCodeFastMovement = -6,
featReqCodeUncannyDodgeRelated = -7,
featReqCodeMinArcaneCasterLevel = -8,
featReqCodeAnimalCompanion = -9,
featReqCodeCrossbowFeat = -10
The <value>
is contextual to the feat prereq code.
e.g. if the feat code is MinCasterLevel (-2) then the value specified is the required minimum caster level.
For the special codes the value isn't always relevant; check out the _FeatPrereqsCheck function in feats.cpp for more info.
Still have to add support for prerequisite definitions that correspond to new feats, which you'll probably want for creating new general feats (i.e. ones that are not part of a class list of feats).
This is a topic of its own, covered here.
To link a Modifier to the feat, use the PythonModifier method .MapToFeat("<FEAT NAME>")
Where <FEAT NAME>
must be the same as the feat name in the .txt file.
Example:
death_attack_feat = PythonModifier("Death Attack Feat", 3)
death_attack_feat.MapToFeat("Death Attack")