Skip to content

Python Class Definitions

Dude McDude edited this page Mar 26, 2018 · 19 revisions

Intro

Temple+ allows definition of new character classes via python scripts. In addition, this allows you to alter many properties of the existing base classes.

The core component of this system is the character specification script. It contains various functions that define basic class properties, such as Hit Die type, class skills, class feats and much more.

Making a new character class will also generally make extensive use of the other systems mentioned here:

A class will always have an accompanying Modifier (a.k.a Condition). This Modifier is applied to the character whenever it takes a level in that class. It may contain various bonuses, radial menu items, D20 query/signal handlers, and so on.

Most classes will usually have associated feats that make use of the Modifier system as well.

Finally, class abilities that require advanced targeting (such as multi-targeting or AoE) may be implemented as spells. One such example is the Bard's new multi-targeting songs. For that matter, spell enums for class abilities should use the 3000-3999 range.

Getting started

The first step you should take before diving into this guide is to extract the Temple+ files and take a peek at how character classes are defined.

You may find the Temple+ class specs inside tpgamefiles.dat.

Many of the definitions there are fairly self-explanatory. As an example, you may find there the following types of lists:

class_feats = {

1: (feat_armor_proficiency_light, feat_armor_proficiency_medium, feat_armor_proficiency_heavy,
    feat_shield_proficiency, feat_simple_weapon_proficiency, feat_martial_weapon_proficiency_all, "Detect Good"),
2: ("Smite Good", "Dark Blessing"),
3: ("Aura of Despair", feat_rebuke_undead),
4: (feat_sneak_attack,)
}

class_skills = (skill_concentration, skill_craft, skill_diplomacy, skill_handle_animal, skill_heal, skill_hide, skill_intimidate, skill_knowledge_religion, skill_profession, skill_ride)


spell_list = {
	1: (spell_cause_fear, spell_cure_light_wounds, spell_doom, spell_inflict_light_wounds, spell_magic_weapon,     spell_summon_monster_i),
	2: (spell_bulls_strength, spell_cure_moderate_wounds, spell_darkness, spell_death_knell, spell_eagles_splendor, spell_mass_inflict_moderate_wounds, spell_shatter, spell_summon_monster_ii),
	3: (spell_contagion, spell_cure_serious_wounds, spell_deeper_darkness, spell_inflict_serious_wounds, spell_protection_from_elements, spell_summon_monster_iii),
	4: (spell_cure_critical_wounds, spell_freedom_of_movement, spell_inflict_critical_wounds, spell_poison, spell_summon_monster_iv)
}

spells_per_day = {
1:  (-1,0),
2:  (-1,1),
3:  (-1,1, 0),
4:  (-1,1, 1),
5:  (-1,1, 1, 0),
6:  (-1,1, 1, 1),
7:  (-1,2, 1, 1, 0),
8:  (-1,2, 1, 1, 1),
9:  (-1,2, 2, 1, 1),
10: (-1,2, 2, 2, 1)
}

And similarly, the following types of function that are used by the API require no explanation:

def IsEnabled():
	return 1

def GetHitDieType():
	return 10

def GetSkillPtsPerLevel():
	return 2
	
def GetBabProgression():
	return base_attack_bonus_type_martial

def IsFortSaveFavored():
	return 1

def IsRefSaveFavored():
	return 0

def IsWillSaveFavored():
	return 0

# Spell Casting
def GetSpellListType():
	return spell_list_type_special

def GetSpellSourceType():
	return spell_source_type_divine

def GetSpellReadyingType():
	return spell_readying_vancian

Files

The class specification scripts should be placed in

rules\char_class\classXXX_*.py

Where XXX is the Class enumeration (enum). For example, the Blackguard class has the file class022_blackguard.py.

A class's accompanying Modifier should be found inside

scr\tpModifiers\

For example, the Blackguard class has the file blackguard.py, where the Blackguard Modifier is defined, as well as all of its unique feats.

You should also consult constants.py for checking out the available alternatives to some of these specifications. It is located in tpdata\templeplus\lib\templeplus inside the Temple+ installation folder.

Class Enums

Class enums are unique identifiers associated with each class.

They must be between the range of 007 and 127.

Each Class enum is associated with a Spell Class enum. Spell Class is derived from Class enum by doing a binary OR operation with 0x80. Spell Classes without the 0x80 bit are currently considered by the engine to be Domain spells. (That's the reason Class enums are restricted to the 127 range. That, and the fact it has to fit in a single byte)

Reserved Enums

Most class enums are reserved for the sake of compatibility between future mods.

  • 007 thru 017 are the core Base classes (stat_level_barbarian through stat_level_wizard in terms of the Python constants).
  • 018 thru 032 are the core Prestige classes .
  • 033 thru 069 are reserved for several classes from supplemental materials requested by fans.
    • 046 thru 069 are still unclaimed - you may submit a reservation request for this range.
  • 058 thru 070 are reserved for the Psionic classes.
  • 071 thru 081 are reserved for the Tome of Battle classes.
  • 082 thru 111 are reserved for Pathfinder classes. (some of these may be freed up and converted to kits, however)

The range of 112 thru 127 is intended for custom user classes.

For reservation requests, please inquire here. It is possible to expand the usable range in the future, if it ever gets too crowded.

Levelup API

Feats

Under construction

Spells

Under construction

Clone this wiki locally