NWNX:EE  8193.36.12
Race

Readme

This plugin allows for the builder to add new races or subraces and define many traits for the races via 2da entry or scripting. This plugin also applies effects, and weapon properties, versus a parent race to effect a child race, as well as effects vs that specific child race.

Environmental Variables

NWNX_RACE_SHOW_EFFECT_ICON - Helpful when debugging, this shows the effect's icon (the red and green squares). Some builders may even wish this permanently.

Required NWNX Plugins

Setup

Adding new races is beyond the scope of this documentation. The builder should know how to add new races by adding a new entry in the racialtypes.2da as well as adding the appropriate TLK reference identifiers for that new race then adjusting the appropriate columns for their race, including the Ability Score modifications.

The NWNX Race plugin does not provide modifications to ability scores, use the racialtypes.2da columns for changing those.

The 2da Method

To use the 2da method, the builder must create a new column at the end of the racialtypes.2da named RacialModsTable. This column should then be populated with a string value that references another 2da file in which we will define our racial modifiers. Once that is done the builder needs to include nwnx_race_2da and make sure to run NWNX_Race_LoadRacialModifiers() in their OnModuleLoad script.

For example, we've inserted a new race called Aasimar into racialtypes.2da at line 150. In the RacialModsTable column we enter RACEMOD_AASIMAR (Remember maximum 16 characters, case insensitive)

We will now create and define our racemod_aasimar.2da file and enter appropriate lines for each modifier they will receive. The end result will look something like this:

2DA V2.0
LABEL Type Param1 Param2 Param3
0 Race RACE 6 **** ****
1 ColdElectricalAcidResist DMGRESIST 272 5 ****
2 CharmPersonImmunity SPELLIMMUNITY 16 **** ****
3 DominatePersonImmune SPELLIMMUNITY 45 **** ****
4 HoldPersonImmunity SPELLIMMUNITY 83 **** ****
5 Spot SKILL 17 2 ****
6 Listen SKILL 6 2 ****
7 LightFeatUsage FEATUSAGE 1107 1 10
8 UniversalSaves SAVE 0 2 ****

The Scripting Method

The scripting method involves running a command for each race and each modifier OnModuleLoad.

The end result for the Aasimar using the script method would be something like:

Racial Modifiers


AB

The AB entry is used to modify an attack bonus for a race. Note: this is not a change to the base attack bonus, it's added on top of that.

  • Param1 = Modifier value (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 InateAB AB 1 **** ****

Example script on_module_load

ABVSRACE

The ABVSRACE entry is used to modify the attack bonus for a race versus another specific race.

  • Param1 = Racial ID from racialtypes.2da
  • Param2 = Modifier value (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 DragonAB ABVSRACE 11 3 ****

Example script on_module_load

AC

The AC entry is used to modify the base AC for a race.

  • Param1 = Modifier value (+/-)
  • Param2 = Armor Class type. Keep in mind that non-dodge AC types won't stack with other non-dodge AC from spell effects nor item properties.

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 InateAC AC 1 0 ****

Example script on_module_load

ACVSRACE

The ACVSRACE entry is used to modify the base AC for a race versus another specific race.

  • Param1 = Racial ID from racialtypes.2da
  • Param2 = Modifier value (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 DragonAC ACVSRACE 11 4 ****

Example script on_module_load

CONCEALMENT

The CONCEALMENT entry is used to grant an inate concealment to a race.

  • Param1 = Modifier value (1-100)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 Concealment CONCEALMENT 30 **** ****

Example script on_module_load

DMGREDUCTION

The DMGREDUCTION entry gives an inate damage reduction

  • Param1 = Points to soak (+)
  • Param2 = Level of soak (+)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 DR_SOAK5_PLUS5 DMGREDUCTION 5 5 ****
1 DR_SOAK10_PLUS4 DMGREDUCTION 10 4 ****

Example script on_module_load

DMGRESIST

The DMGRESIST entry gives an inate resistance to damage types

  • Param1 = The damage type, can be a single Damage Type integer or multiple Damage Type integers summed. You can also just do each on its own line if you'd prefer. Hex can be used for the scripting method if preferred.
  • Param2 = Points to resist (+)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 FireDamageResist DMGRESIST 256 10 ****
1 FireColdDamageResist DMGRESIST 288 5 ****

Example script on_module_load
NWNX_Race_SetRacialModifier(150, NWNX_RACE_MODIFIER_DMGRESIST, DAMAGE_TYPE_FIRE & DAMAGE_TYPE_COLD, 5);

DMGIMMUNITY

The DMGIMMUNITY entry gives an inate immunity to damage types

  • Param1 = The damage type, can be a single Damage Type integer or multiple Damage Type integers summed. You can also just do each on its own line if you'd prefer. Hex can be used for the scripting method if preferred.
  • Param2 = Percentage to resist (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 FireDamageImmunity DMGIMMUNITY 256 100 ****
1 AcidDamageVulnerability DMGIMMUNITY 16 -50 ****

Example script on_module_load

FEAT

The FEAT entry awards a feat at a specified level. This feat is awarded after the creature levels up. Level 1 feats can still be added using the FeatsTable column of the racialtypes.2da.

  • Param1 = The row in feat.2da
  • Param2 = The level to grant the feat

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 IronWill FEAT 22 3 ****

Example script on_module_load

FEATUSAGE

The FEATUSAGE controls the amount of usages a race will have based upon their character level for a custom feat they are granted.

  • Param1 = The row in feat.2da
  • Param2 = Usages a day granted at character creation
  • Param3 = Additional usages a day granted for this many levels

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 LightFeatUsage FEATUSAGE 1101 1 5

Example script on_module_load

IMMUNITY

The IMMUNITY entry is used to grant the race a total immunity to a variety of effects.

  • Param1 = The IMMUNITY_TYPE_ constant value

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 FearImmunity IMMUNITY 4 **** ****

Example script on_module_load

INITIATIVE

The INITIATIVE entry is used to modify the initiative check.

  • Param1 = Modifier value (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 PoorInitiative INITIATIVE -3 **** ****

Example script on_module_load

MOVEMENTSPEED

The MOVEMENTSPEED can modify the speed at which the race moves by default.

  • Param1 = The percentage change to their speed (-99/+99)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 Faster MOVEMENTSPEED 33 **** ****

Example script on_module_load

RACE

The RACE entry is used when the race the builder is adding has a parent race with which to inherit some hard coded checks. For example, a Ghostwise Halfling would have its RACE set as 3 representing the Halfling race and in turn a player with that race would have an additional +1 to ranged attacks as is set for the Halfling race.

  • Param1 = Race ID from racialtypes.2da

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 Race RACE 3 **** ****

Example script on_module_load

REGENERATION

The REGENERATION entry is used to grant the race an inate regeneration.

  • Param1 = How many hitpoints to increase (+)
  • Param2 = How often in seconds to increase the hitpoints (+)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 Regeneration REGENERATION 2 6 ****

Example script on_module_load

SAVE

The SAVE entry is used to modify base save values.

  • Param1 = 0-3 meaning SAVING_THROW_ALL, SAVING_THROW_FORT, SAVING_THROW_REFLEX or SAVING_THROW_WILL
  • Param2 = Modifier value (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 FortitudeVulnerable SAVE 1 -2 ****

Example script on_module_load

SAVEVSRACE

The SAVEVSRACE entry is used to modify base save values vs a specific race. Param1 is the Save constant ID and param2 is the target race constant ID and param3 is the modifier.

  • Param1 = 0-3 meaning SAVING_THROW_ALL, SAVING_THROW_FORT, SAVING_THROW_REFLEX or SAVING_THROW_WILL
  • Param2 = Racial ID from racialtypes.2da
  • Param3 = Modifier value (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 UniversalSaveVsUndead SAVEVSRACE 0 24 5

Example script on_module_load
NWNX_Race_SetRacialModifier(150, NWNX_RACE_MODIFIER_SAVEVSRACE, SAVING_THROW_ALL, RACIAL_TYPE_UNDEAD, 5);

SAVEVSTYPE

The SAVEVSTYPE entry is used to modify base save values vs a specific type. Param1 is the Save constant ID and param2 is the Saving Throw Type constant ID and param3 is the modifier.

  • Param1 = 0-3 meaning SAVING_THROW_ALL, SAVING_THROW_FORT, SAVING_THROW_REFLEX or SAVING_THROW_WILL
  • Param2 = A SAVING_THROW_TYPE_ constant
  • Param3 = Modifier value (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 ReflexSaveVsTraps SAVEVSTYPE 2 14 3

Example script on_module_load
NWNX_Race_SetRacialModifier(150, NWNX_RACE_MODIFIER_SAVEVSTYPE, SAVING_THROW_REFLEX, SAVING_THROW_TYPE_TRAP, 3);

SKILL

The SKILL entry is used to modify base skill ranks. Note: This requires the NWNX_SkillRanks plugin.

  • Param1 = Skill ID from skills.2da
  • Param2 = Modifier value (+/-)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 IntimidateBonus+2 SKILL 24 2 ****
1 HealLimited-2 SKILL 5 -2 ****

Example script on_module_load

SPELLIMMUNITY

The SPELLIMMUNITY entry is used to grant the race a total immunity to specific spells. Note: Only spells that can be resisted can have immunities.

  • Param1 = The spell row from spells.2da

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 HorridWiltingImmune SPELLIMMUNITY 367 **** ****

Example script on_module_load

SRCHARGEN

The SRCHARGEN entry is used to award the race a default spell resistance on character creation.

  • Param1 = Modifier value (+)
  • Param2 (Optional) = Maximum value all Spell Resistance racial values can reach

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 SRAtCharCreation SRCHARGEN 10 36 ****

Example script on_module_load

SRINCLEVEL

The SRINCLEVEL entry is used to award a spell resistance racial bonus as the creature's level increases.

  • Param1 = Amount of points to increment (+)
  • Param2 = Level per increment (+)
  • Param3 = Level at which the incremental gains begin (+)

Example 2da entry
2DA V2.0
LABEL Type Param1 Param2 Param3
0 SRIncrementLevels SRINCLEVEL 1 1 6

Example script on_module_load

Files

file  nwnx_race.nss
 
file  nwnx_race_2da.nss
 Parse a column in the racialtypes.2da to load the modifiers.
 

Functions

void NWNX_Race_SetRacialModifier (int iRace, int iMod, int iParam1, int iParam2=0xDEADBEEF, int iParam3=0xDEADBEEF)
 Sets a racial modifier. More...
 
int NWNX_Race_GetParentRace (int iRace)
 Gets the parent race for a race. More...
 
void NWNX_Race_SetFavoredEnemyFeat (int iRace, int iFeat)
 Associates the race with its favored enemy feat. More...
 
void NWNX_Race_SuppressCreatureRaceEffects (object oCreature)
 Removes any nwnx_race 'Effects' on the targeted creature. Suppression lasts until levelup, next login, or Reactivated by function. More...
 
void NWNX_Race_ReactivateCreatureRaceEffects (object oCreature)
 Reactivates the nwnx_race 'Effects' on the targeted creature after they were Suppressed. More...
 
int NWNX_Race_GetModifierConstant (string raceMod)
 Translate a modifier type from a string to its constant. More...
 
void NWNX_Race_LoadRacialModifiers (string sColumnName="RacialModsTable")
 Loops through racialtypes.2da and checks for the column for racial modifications and sets them. More...
 

Function Documentation

◆ NWNX_Race_SetRacialModifier()

void NWNX_Race_SetRacialModifier ( int  iRace,
int  iMod,
int  iParam1,
int  iParam2 = 0xDEADBEEF,
int  iParam3 = 0xDEADBEEF 
)

Sets a racial modifier.

Parameters
iRaceThe RACIALTYPE_ constant or value in racialtypes.2da.
iModThe racial modifier to set.
iParam1,iParam2,iParam3The parameters for this racial modifier.

Definition at line 69 of file nwnx_race.nss.

◆ NWNX_Race_GetParentRace()

int NWNX_Race_GetParentRace ( int  iRace)

Gets the parent race for a race.

Parameters
iRaceThe race to check for a parent.
Returns
The parent race if applicable, if not it just returns the race passed in.

Definition at line 82 of file nwnx_race.nss.

◆ NWNX_Race_SetFavoredEnemyFeat()

void NWNX_Race_SetFavoredEnemyFeat ( int  iRace,
int  iFeat 
)

Associates the race with its favored enemy feat.

Parameters
iRaceThe race
iFeatThe feat
Note
If a creature has a race that has a parent race then favored enemy bonuses will work for either race against that creature. For example a creature is a Wild Elf which has a parent race of Elf, an attacker would benefit if they had either Favored Enemy: Elf or Favored Enemy: Wild Elf

Definition at line 92 of file nwnx_race.nss.

◆ NWNX_Race_SuppressCreatureRaceEffects()

void NWNX_Race_SuppressCreatureRaceEffects ( object  oCreature)

Removes any nwnx_race 'Effects' on the targeted creature. Suppression lasts until levelup, next login, or Reactivated by function.

Parameters
oCreatureThe creature to suppress
Note
Not all nwnx_race modifiers are achieved via effect. Those that are not directly consider the creatures current race.

Definition at line 102 of file nwnx_race.nss.

◆ NWNX_Race_ReactivateCreatureRaceEffects()

void NWNX_Race_ReactivateCreatureRaceEffects ( object  oCreature)

Reactivates the nwnx_race 'Effects' on the targeted creature after they were Suppressed.

Parameters
oCreatureThe creature to reactive
Note
Safe to use on non-suppressed creatures - Triggers a refresh of effects but won't stack.

Definition at line 110 of file nwnx_race.nss.

◆ NWNX_Race_GetModifierConstant()

int NWNX_Race_GetModifierConstant ( string  raceMod)

Translate a modifier type from a string to its constant.

Parameters
raceModThe string representation of the constant.
Returns
The constant for the race modifier.

Definition at line 18 of file nwnx_race_2da.nss.

◆ NWNX_Race_LoadRacialModifiers()

void NWNX_Race_LoadRacialModifiers ( string  sColumnName = "RacialModsTable")

Loops through racialtypes.2da and checks for the column for racial modifications and sets them.

Note
Requires NWNX_Util_Get2DARowCount()
Parameters
sColumnNameThe column name in the racialtypes.2da that defines the 2da for the racial mods.

Definition at line 45 of file nwnx_race_2da.nss.

Variable Documentation

◆ NWNX_RACE_MODIFIER_INVALID

const int NWNX_RACE_MODIFIER_INVALID = 0

Definition at line 13 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_AB

const int NWNX_RACE_MODIFIER_AB = 1

Definition at line 14 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_ABVSRACE

const int NWNX_RACE_MODIFIER_ABVSRACE = 2

Definition at line 15 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_AC

const int NWNX_RACE_MODIFIER_AC = 3

Definition at line 16 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_ACVSRACE

const int NWNX_RACE_MODIFIER_ACVSRACE = 4

Definition at line 17 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_CONCEALMENT

const int NWNX_RACE_MODIFIER_CONCEALMENT = 5

Definition at line 18 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_DMGIMMUNITY

const int NWNX_RACE_MODIFIER_DMGIMMUNITY = 6

Definition at line 19 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_DMGREDUCTION

const int NWNX_RACE_MODIFIER_DMGREDUCTION = 7

Definition at line 20 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_DMGRESIST

const int NWNX_RACE_MODIFIER_DMGRESIST = 8

Definition at line 21 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_FEAT

const int NWNX_RACE_MODIFIER_FEAT = 9

Definition at line 22 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_FEATUSAGE

const int NWNX_RACE_MODIFIER_FEATUSAGE = 10

Definition at line 23 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_IMMUNITY

const int NWNX_RACE_MODIFIER_IMMUNITY = 11

Definition at line 24 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_INITIATIVE

const int NWNX_RACE_MODIFIER_INITIATIVE = 12

Definition at line 25 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_MOVEMENTSPEED

const int NWNX_RACE_MODIFIER_MOVEMENTSPEED = 13

Definition at line 26 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_RACE

const int NWNX_RACE_MODIFIER_RACE = 14

Definition at line 27 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_REGENERATION

const int NWNX_RACE_MODIFIER_REGENERATION = 15

Definition at line 28 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_SAVE

const int NWNX_RACE_MODIFIER_SAVE = 16

Definition at line 29 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_SAVEVSRACE

const int NWNX_RACE_MODIFIER_SAVEVSRACE = 17

Definition at line 30 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_SAVEVSTYPE

const int NWNX_RACE_MODIFIER_SAVEVSTYPE = 18

Definition at line 31 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_SKILL

const int NWNX_RACE_MODIFIER_SKILL = 19

Definition at line 32 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_SPELLIMMUNITY

const int NWNX_RACE_MODIFIER_SPELLIMMUNITY = 20

Definition at line 33 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_SRCHARGEN

const int NWNX_RACE_MODIFIER_SRCHARGEN = 21

Definition at line 34 of file nwnx_race.nss.

◆ NWNX_RACE_MODIFIER_SRINCLEVEL

const int NWNX_RACE_MODIFIER_SRINCLEVEL = 22

Definition at line 35 of file nwnx_race.nss.

NWNX_RACE_MODIFIER_SAVEVSTYPE
const int NWNX_RACE_MODIFIER_SAVEVSTYPE
Definition: nwnx_race.nss:31
NWNX_RACE_MODIFIER_SRINCLEVEL
const int NWNX_RACE_MODIFIER_SRINCLEVEL
Definition: nwnx_race.nss:35
NWNX_RACE_MODIFIER_INITIATIVE
const int NWNX_RACE_MODIFIER_INITIATIVE
Definition: nwnx_race.nss:25
NWNX_RACE_MODIFIER_DMGREDUCTION
const int NWNX_RACE_MODIFIER_DMGREDUCTION
Definition: nwnx_race.nss:20
NWNX_RACE_MODIFIER_SAVE
const int NWNX_RACE_MODIFIER_SAVE
Definition: nwnx_race.nss:29
NWNX_RACE_MODIFIER_AC
const int NWNX_RACE_MODIFIER_AC
Definition: nwnx_race.nss:16
NWNX_RACE_MODIFIER_SRCHARGEN
const int NWNX_RACE_MODIFIER_SRCHARGEN
Definition: nwnx_race.nss:34
NWNX_RACE_MODIFIER_FEAT
const int NWNX_RACE_MODIFIER_FEAT
Definition: nwnx_race.nss:22
NWNX_RACE_MODIFIER_DMGRESIST
const int NWNX_RACE_MODIFIER_DMGRESIST
Definition: nwnx_race.nss:21
NWNX_RACE_MODIFIER_AB
const int NWNX_RACE_MODIFIER_AB
Definition: nwnx_race.nss:14
NWNX_RACE_MODIFIER_IMMUNITY
const int NWNX_RACE_MODIFIER_IMMUNITY
Definition: nwnx_race.nss:24
NWNX_RACE_MODIFIER_DMGIMMUNITY
const int NWNX_RACE_MODIFIER_DMGIMMUNITY
Definition: nwnx_race.nss:19
NWNX_RACE_MODIFIER_SAVEVSRACE
const int NWNX_RACE_MODIFIER_SAVEVSRACE
Definition: nwnx_race.nss:30
NWNX_RACE_MODIFIER_SKILL
const int NWNX_RACE_MODIFIER_SKILL
Definition: nwnx_race.nss:32
NWNX_RACE_MODIFIER_RACE
const int NWNX_RACE_MODIFIER_RACE
Definition: nwnx_race.nss:27
NWNX_RACE_MODIFIER_FEATUSAGE
const int NWNX_RACE_MODIFIER_FEATUSAGE
Definition: nwnx_race.nss:23
NWNX_RACE_MODIFIER_SPELLIMMUNITY
const int NWNX_RACE_MODIFIER_SPELLIMMUNITY
Definition: nwnx_race.nss:33
NWNX_RACE_MODIFIER_REGENERATION
const int NWNX_RACE_MODIFIER_REGENERATION
Definition: nwnx_race.nss:28
NWNX_RACE_MODIFIER_CONCEALMENT
const int NWNX_RACE_MODIFIER_CONCEALMENT
Definition: nwnx_race.nss:18
NWNX_RACE_MODIFIER_ACVSRACE
const int NWNX_RACE_MODIFIER_ACVSRACE
Definition: nwnx_race.nss:17
NWNX_Race_SetRacialModifier
void NWNX_Race_SetRacialModifier(int iRace, int iMod, int iParam1, int iParam2=0xDEADBEEF, int iParam3=0xDEADBEEF)
Sets a racial modifier.
Definition: nwnx_race.nss:69
NWNX_RACE_MODIFIER_MOVEMENTSPEED
const int NWNX_RACE_MODIFIER_MOVEMENTSPEED
Definition: nwnx_race.nss:26
NWNX_RACE_MODIFIER_ABVSRACE
const int NWNX_RACE_MODIFIER_ABVSRACE
Definition: nwnx_race.nss:15