Skip to content
Dude McDude edited this page May 9, 2022 · 7 revisions

Python race API is meant for PC races, which opens up new races at character creation.
NPCs can already be freely defined with various properties at the protos level, so this isn't relevant for them.

Enums

The compound race enum packs race and subrace bitwise as race | (subrace <<5), or equivalently race + subrace*32.
For example:
Elf (base race) = 2
Aquatic Elf = 2 +1*32 = 34
Drow = 66
Gray Elf = 98
Wild Elf = 130
Wood Elf = 162

This also means the max number of base races is 32. Currently 12 are used.
You can retrieve these via stat_level_get(stat_race) and stat_level_get(stat_subrace).

Python race definition file

This is where various stat related properties are defined, which cannot be in the protos entry (since PCs cannot make use of NPC fields).
See examples here:
https://github.com/GrognardsFromHell/TemplePlus/tree/master/tpdatasrc/tpgamefiles/rules/races

Python modifier file

This is a permanent modifier which gets automatically applied. It must have 0 args. See python modifiers section and various examples from existing races.

Protos entry

You need to add a protos entry. See examples here:
https://github.com/GrognardsFromHell/TemplePlus/blob/master/tpdatasrc/tpgamefiles/rules/protos/subraces.tab
Important notes:

  • Make sure the race field matches the race name, as defined in the python race def file. Do NOT rely on the vanilla toee race enums, even if the race already exists there (i.e. for NPCs).
  • Note that all the NPC properties will not be parsed by the engine, since the protos define PC prototypes. Hence only critter and object properties will apply.
Clone this wiki locally