Shayan's Subrace Engine features several scripting enhancements.
Constants[]
The following constants are defined in sha_subr_consts
.
LIGHT_SENSITIVE_SAVING_THROW_DC
specifies the DC of the saving throw that light sensitive subraces must make in sunlight.LIGHT_BLINDNESS_STRIKES_EVERY_ROUND
controls the interval between saving throws that light sensitive subraces must make in sunlight.LIGHT_STRUCK_BLIND_FOR_ROUNDS
governs the duration of the blindness resulting from a failed saving throw by a light sensitive subrace.APPLY_AB_AND_SAVING_THROW_DECREASES_IN_LIGHT
, if set to TRUE, causes light sensitive subraces to suffer attack roll and saving throw penalties.LIGHT_AB_DECREASE
is the size of the penalty suffered by light sensitive subraces.LIGHT_CAUSES_AB_AND_SAVES_DECREASE_FOR_ROUNDS
is the number of rounds that attack and save penalties last for light sensitive subraces.
The following ITEM_TYPE_* constants are used by SubraceRestrictUseOfItems()
. These are bit-field constants that can be combined with |
, the bitwise "or" operator.
Weapons | |
---|---|
ITEM_TYPE_WEAPON_MELEE | melee weapons (includes gloves but not bracers) |
ITEM_TYPE_WEAPON_RANGED_THROW | throwing weapons |
ITEM_TYPE_WEAPON_RANGED_LAUNCHER | ranged weapons that use ammunition |
ITEM_TYPE_WEAPON_RANGED | all ranged weapons |
ITEM_TYPE_WEAPON | all weapons |
ITEM_TYPE_WEAPON_PROF_SIMPLE | simple weapons |
ITEM_TYPE_WEAPON_PROF_MARTIAL | martial weapons |
ITEM_TYPE_WEAPON_PROF_EXOTIC | exotic weapons |
ITEM_TYPE_WEAPON_PROF_ANY | all weapons (any proficiency) |
ITEM_TYPE_WEAPON_SIZE_TINY | tiny weapons |
ITEM_TYPE_WEAPON_SIZE_SMALL | small weapons |
ITEM_TYPE_WEAPON_SIZE_MEDIUM | medium weapons |
ITEM_TYPE_WEAPON_SIZE_LARGE | large weapons |
ITEM_TYPE_WEAPON_SIZE_SMALL_DOWN | small and tiny weapons |
ITEM_TYPE_WEAPON_SIZE_MEDIUM_UP | medium and large weapons |
ITEM_TYPE_WEAPON_SIZE_ANY | all weapons (any size) |
Armor, helms, and shields | |
ITEM_TYPE_SHIELD_SMALL | small shields |
ITEM_TYPE_SHIELD_LARGE | large shields |
ITEM_TYPE_SHIELD_TOWER | tower shields |
ITEM_TYPE_SHIELD_ANY | all shields |
ITEM_TYPE_ARMOR | armor |
ITEM_TYPE_ARMOR_TYPE_CLOTH | clothing (AC 0) |
ITEM_TYPE_ARMOR_TYPE_LIGHT | light armor (AC 1-3) |
ITEM_TYPE_ARMOR_TYPE_MEDIUM | armor with base AC 4-6 |
ITEM_TYPE_ARMOR_TYPE_HEAVY | armor with base AC 7-8 |
ITEM_TYPE_ARMOR_AC_0 | armor with base AC 0 |
ITEM_TYPE_ARMOR_AC_1 | armor with base AC 1 |
ITEM_TYPE_ARMOR_AC_2 | armor with base AC 2 |
ITEM_TYPE_ARMOR_AC_3 | armor with base AC 3 |
ITEM_TYPE_ARMOR_AC_4 | armor with base AC 4 |
ITEM_TYPE_ARMOR_AC_5 | armor with base AC 5 |
ITEM_TYPE_ARMOR_AC_6 | armor with base AC 6 |
ITEM_TYPE_ARMOR_AC_7 | armor with base AC 7 |
ITEM_TYPE_ARMOR_AC_8 | armor with base AC 8 |
ITEM_TYPE_HELM | helms |
ITEM_TYPE_FULL_ARMOR_SET | all armor, shields, and helms |
Miscellaneous | |
ITEM_TYPE_JEWLERY | rings and amulets |
ITEM_TYPE_MISC_CLOTHING | cloaks, bracers, and boots |
ITEM_TYPE_NONE_BIOWARE_ITEM | non-BioWare base items (e.g. CEP base items) |
sha_subr_methds[]
Basic subrace functions[]
void CreateSubrace (int Race, string subrace
,
string HideResRef="", string UniqueItemResref=""
,
int IsLightSensitive=FALSE, int DamageTakenWhileInLight=0
,
int IsUndergroundSensitive=FALSE, int DamageTakenWhileInUnderground=0
,
int ECL=0, int IsUndead=FALSE
,
int PrestigiousSubrace=FALSE
)
int Race
- This is the base race from which the subrace is created. It must be either
RACIAL_TYPE_ALL
or aRACIAL_TYPE_*
constant for a playable race. Additional races can be specified by calling AddAdditionalBaseRaceToSubrace() afterwards. string subrace
- This is what a player will have to type into the subrace field to get this subrace. It must not have spaces (e.g. use "Dark-elf" instead of "Dark elf"). This is not case sensitive.
string HideResRef
- This is the ResRef of the skin item that will be equipped on PCs of this subrace. This skin will have all the subrace traits, such as ability modifiers, base feats, etc. Specifying "none" or "" will disable this for this subrace.
string UniqueItemResref
- This is the ResRef of an item to be given to PCs of this subrace upon entry into the module (for such things as holding spells or describing the subrace). Ideally this item will be flagged as both cursed and plot. Specifying "none" or "" will disable this for this subrace.
int IsLightSensitive
- If this is TRUE, the subrace will be light sensitive.
int DamageTakenWhileInLight
- This is the amount of divine damage members of this subrace suffer for each round spent in sunlight. (The subrace does not need to be light sensitive for this to have an effect.) A negative value will cause regeneration in sunlight instead of damage.
int IsUndergroundSensitive
- If this is TRUE, the subrace will be underground sensitive.
int DamageTakenWhileInUnderground
- This is the amount of negative energy damage members of this subrace suffer for each round spent underground. (The subrace does not need to be underground sensitive for this to have an effect.) A negative value will cause regeneration while underground instead of damage.
int ECL
- This is the effective character level used by members of this subrace. (That is, this number is added to the PC's character level before calculating the experience point award for a kill.) Positive numbers result in less experience, while negative numbers result in more.
int IsUndead
- If this is TRUE, members of this subrace will be treated as undead by healing and harming spells.
int PrestigiousSubrace
- If this is TRUE, then this subrace is invalid for level 1 characters. (PCs can become part of this subrace once they reach a certain level with another sub-race.) See SetupSubraceSwitch() for more information.
This is the primary function of the subrace engine, and should be called in the OnModuleLoad event. No subrace-related functions can be called before this function.
Example: In a module's OnModuleLoad event handler include "sha_subr_methds" and use
CreateSubrace(RACIAL_TYPE_ELF, "drow", "sha_pc_drow", "sha_subrace_drow", TRUE, 2, FALSE, 0, 1);
to create a subrace called "drow" that is light sensitive, taking 2 points of divine damage while in light areas, and that has an effective character level adjustment of +1. This assumes that a skin item with ResRef "sha_pc_drow" has been created (in the Toolset), as well as a cursed plot item with the ResRef "sha_subrace_drow" that contains spell-like abilities and information about the drow subrace.
void AddAdditionalBaseRaceToSubrace (string subrace, int AdditionalBaseRace
)
string subrace
- This should be the subrace name used in
CreateSubrace()
. int AdditionalBaseRace
- This is the additional race that qualifies for the subrace. It must be either
RACIAL_TYPE_ALL
or aRACIAL_TYPE_*
constant for a playable race.
This function adds another race that can be part of the indicated subrace.
void CreateSubraceClassRestriction (string subrace, int CanBe_Barbarian=TRUE
,
int CanBe_Bard=TRUE, int CanBe_Cleric=TRUE
,
int CanBe_Druid=TRUE, int CanBe_Fighter=TRUE
,
int CanBe_Monk=TRUE, int CanBe_Paladin=TRUE
,
int CanBe_Ranger=TRUE, int CanBe_Rogue=TRUE
,
int CanBe_Sorcerer, int CanBe_Wizard=TRUE
)
string subrace
- This should be the subrace name used in
CreateSubrace()
.
This function will limit which PCs can be part of this subrace, based upon their first class. Parameters of TRUE allow the indicated class, while FALSE prohibits it.
Note that this limitation only applies to the first class. So if a subrace is restricted to fighter, then a wizard/fighter will not meet the criteria, but a fighter/wizard will.
void CreateSubraceAlignmentRestriction (string subrace, int CanBeAlignment_Good=TRUE
,
int CanBeAlignment_Neutral1=TRUE, int CanBeAlignment_Evil=TRUE
,
int CanBeAlignment_Lawful=TRUE, int CanBeAlignment_Neutral2=TRUE
,
int CanBeAlignment_Chaotic=TRUE
)
string subrace
- This should be the subrace name used in
CreateSubrace()
.
This function will limit which PCs can be part of this subrace, based upon their alignment. Parameters of TRUE allow the indicated alignment, while FALSE prohibits it. This alignment restriction only applies when a PC enters the module for the first time. (A database entry is made.) Thus it will not stop a PC from being part of a subrace after the PC changes alignment.
void CreateSubraceSpellResistance (string subrace, int SpellResistanceBase
,
int SpellResistanceMax
)
string subrace
- This should be the subrace name used in
CreateSubrace()
. int SpellResistanceBase
- This is the spell resistance given to members of this subrace at level 1.
int SpellResistanceMax
- This is the spell resistance members of this subrace achieve at the maximum achievable level. (The default is 40, but this can be changed in the script
sha_subr_consts
.)
This function will give the indicated amount of spell resistance to members of this subrace, with the possibility of the spell resistance varying with character level.
void CreateSubraceAppearance (string subrace, int AppearanceChangeTime
,
int MaleAppearance, int FemaleAppearance
,
int Level=1
)
string subrace
- This should be the subrace name used in
CreateSubrace()
. int AppearanceChangeTime
- This indicates the time of day the appearance changes. Using TIME_BOTH or TIME_NONE indicates when a member of this subrace is forced to have the specified appearance. (Using TIME_NONE indicates that members of this subrace can control when they have this appearance.) Using TIME_DAY or TIME_NIGHT indicates when a member of this subrace reverts to the normal appearance. (The indicated appearance is forced during the reverse of the named constant.)
int MaleAppearance
- This is an APPEARANCE_TYPE_* constant indicating the appearance for male members of this subrace.
int FemaleAppearance
- This is an APPEARANCE_TYPE_* constant indicating the appearance for female members of this subrace.
int Level
- This indicates the level at which this appearance setting becomes effective.
This function will cause members of this subrace to have an altered appearance.
Note: Some appearances were introduced in the expansion packs, and using the corresponding constants without the expansions may have unexpected results. For example, trying to set the appearance to a black wyrmling when no expansion packs are installed will result in a mephit's appearance.
void CreateTemporaryStatModifier (string subrace, struct SubraceStats Stats
,
int TimeToApply, int InInteriorArea=TRUE
,
int InExteriorArea=TRUE, int InNaturalArea=TRUE
,
int InArtificialArea=TRUE, int InUndergroundArea=TRUE
,
int InAbovegroundArea=TRUE
)
string subrace
- This should be the subrace name used in
CreateSubrace()
. struct SubraceStats Stats
- This indicates the modifiers that will be in place. It can be obtained from the function
CreateCustomStats()
. int TimeToApply
- This indicates when the temporary stat modifier is active. It gets the value TIME_DAY or TIME_NIGHT (for a modifier active during the day or during the night, respectively).
int InInteriorArea
- This indicates (TRUE or FALSE) if the stat modifier is active in interior areas.
int InExteriorArea
- This indicates (TRUE or FALSE) if the stat modifier is active in exterior areas.
int InNaturalArea
- This indicates (TRUE or FALSE) if the stat modifier is active in natural areas.
int InArtificialArea
- This indicates (TRUE or FALSE) if the stat modifier is active in artificial areas.
int InUndergroundArea
- This indicates (TRUE or FALSE) if the stat modifier is active in underground areas.
int InAbovegroundArea
- This indicates (TRUE or FALSE) if the stat modifier is active in above ground areas.
This function causes members of the indicated subrace to have altered ability scores, attack bonus, or armor class during either the day or night, with potential dependence on the current terrain type. This may be used twice per subrace (once with TIME_DAY and once with TIME_NIGHT).
Example: First, a SubraceStats structure needs to be created, for example by calling
struct SubraceStats mystats = CreateCustomStats(<fill in appropriate values>);
Once this is done, the designated stat modifiers can be added to a subrace by calling
CreateTemporaryStatModifier("mysubrace", mystats, TIME_DAY, TRUE, FALSE);
This causes any PC belonging to "mysubrace" to have its ability scores changed during daytime hours when they are in exterior (i.e. outdoors) areas.
struct SubraceStats CreateCustomStats (int StatModifierType, float StrengthModifier
,
float DexterityModifier, float ConstitutionModifier
,
float IntelligenceModifier, float WisdomModifier
,
float CharismaModifier, float ACModifier
,
float ABModifier
)
int StatModifierType
- This is either
SUBRACE_STAT_MODIFIER_TYPE_PERCENTAGE
orSUBRACE_STAT_MODIFIER_TYPE_POINTS
, indicating whether the rest of the parameters are percentage (relative) or fixed (absolute) modifiers.
This function is used to create the structure passed to CreateTemporaryStatModifier()
.
Example:
To reduce a PC's strength by 80%, increase dexterity by 50%, increase
constitution by 60%, increase AC by 65%, and reduce AB by 10%,
the following code would be used:
struct SubraceStats mystats = CreateCustomStats(SUBRACE_STAT_MODIFIER_TYPE_PERCENTAGE, -0.80, 0.50, 0.60,
0.0, 0.0, 0.0, 0.65, -0.10);
Then mystats
would be used as the second parameter to CreateTemporaryStatModifier()
.
void SubraceRestrictUseOfItems (string subrace, int ItemType
,
int TimeOfDay=TIME_BOTH, int Allow=ITEM_TYPE_REQ_DO_NOT_ALLOW
)
string subrace
- This should be the subrace name used in
CreateSubrace()
. int ItemType
- This is a bit-field formed by combining ITEM_TYPE_* constants with
|
(the bitwise "or" operator). int TimeOfDay
- This should either be one of TIME_DAY, TIME_NIGHT, and TIME_BOTH (for time-based restrictions) or one of TIME_SPECIAL_APPEARANCE_NORMAL and TIME_SPECIAL_APPEARANCE_SUBRACE (for appearance-based restrictions). In case of a conflict, appearance-based restrictions have priority.
int Allow
- This should be one of ITEM_TYPE_REQ_ALL (indicating all requirements must be met for weapons), ITEM_TYPE_REQ_ANY (indicating that meeting a single requirement is sufficient), and ITEM_TYPE_REQ_DO_NOT_ALLOW (reversing the input by indicating the subrace cannot use ItemType during TimeOfDay).
This function creates restrictions concerning the use of items for a given subrace.
AddSubraceFavoredClass()[]
Add a favored class to the subrace.
Use this only ONCE per subrace. It will not work correctly if used more than once per subrace
This would mean that when determining XP penalty for multiclassing, the favored classes do not apply when determining it Works the same way as default NWN favored classes.
(This will work ONLY if you are using the attached Shayan's XP System script).
Syntax:
void AddSubraceFavoredClass(string subrace, int MaleFavoredClass, int FamaleFavoredClass);
NOTE:
You can use any playable base CLASS_TYPE_* constant. Do NOT USE Prestige classes, as they are not taken into consideration when determining multiclassing penalty by NWN. Also if you do specify a prestige class it will end up giving players a 20% boost to the XP gained.
AddSubraceEffect()[]
Add a permanent or a temporary subrace effect on the PC, during day or night or permanently.
Use as many times as desired.
Syntax:
void AddSubraceEffect(string subrace, int EffectID, int Value1, int Value2, int nDurationType, float fDuration, int TimeOfDay);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
EffectID:
There are a limited number of effects you can use here... EFFECT_TYPE_ARCANE_SPELL_FAILURE EFFECT_TYPE_BLINDNESS EFFECT_TYPE_CHARMED EFFECT_TYPE_CONCEALMENT EFFECT_TYPE_CONFUSED EFFECT_TYPE_CUTSCENEGHOST EFFECT_TYPE_HASTE EFFECT_TYPE_IMMUNITY EFFECT_TYPE_IMPROVEDINVISIBILITY EFFECT_TYPE_INVISIBILITY EFFECT_TYPE_MISS_CHANCE EFFECT_TYPE_MOVEMENT_SPEED_DECREASE EFFECT_TYPE_MOVEMENT_SPEED_INCREASE EFFECT_TYPE_POLYMORPH EFFECT_TYPE_REGENERATE EFFECT_TYPE_SANCTUARY EFFECT_TYPE_SLOW EFFECT_TYPE_TEMPORARY_HITPOINTS EFFECT_TYPE_TRUESEEING EFFECT_TYPE_ULTRAVISION EFFECT_TYPE_VISUALEFFECT
Value1:
This is the value of the first parameter (from left) that you can input for the effect. IE: If you choose EFFECT_TYPE_CONCEALMENT, which means the effect applied will be: EffectConcealment(int nPercentage, int nMissType=MISS_CHANCE_TYPE_NORMAL) Thus Value1 will be the value of nPercentage. YOU MUST INPUT A VALUE! IF NOT THE SCRIPT WILL PUT IN 0!!
Value2:
This is the value of the second parameter you can input for the effect. IE: (Refer to Value1's example) This will be the value of nMissType. YOU MUST INPUT A VALUE! IF NOT THE SCRIPT WILL PUT IN 0!!
nDurationType:
Duration type of the effect being applied... DURATION_TYPE_INSTANT, DURATION_TYPE_PERMANENT, or DURATION_TYPE_TEMPORARY.
fDuration:
The number of seconds the effect should last for... (Put 0.0 if you are making it last "forever" -IE: Whole of day time, or night time or permanetly)
TimeOfDay:
The time of day you want this applied. Use TIME_BOTH if you want this permanently applied on the PC.
AddAdditionalSkinsToSubrace()[]
Add a different skin to the subrace at specified level. (Use as many times as desired)
Use as many times as desired.
Syntax:
void AddAdditionalSkinsToSubrace(string subrace, string SkinResRef, int EquipLevel, int iTime = TIME_BOTH);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
SkinResRef:
The Blueprint ResRef of the skin that you want the subrace to be equipped.
EquipLevel:
The level at which you want the skin to be applied.
iTime:
The time at which you want the skin to be equipped. (Use TIME_DAY, TIME_NIGHT, or TIME_BOTH.)
Example:
You want to add a skin for the subrace Illithid to use at level 15, during day time. Then call onModuleLoad script: AddAdditionalSkinsToSubrace("Illithid", "my_illithid_skin", 15, TIME_DAY); (Where "my_illithid_skin" is the resref of the skin you want equipped.)
Note:
If you say add a skin for a subrace to be equipped at level 15, then all PCs belonging to the subrace above level 15 will also use the same skin for that time -unless you add a different skin for those levels.)
AddClawsToSubrace()[]
Add equipable creature claws to the subrace.
This allows you to add 'Claws' to your subrace. You simply specify the Blue print resref of the claw you want equipped on the player, and at what level.
Use as many times as desired.
(You can use this to equip claws/slams/gore or what ever else that maybe equipped in a PC's claw item slots)
Syntax:
void AddClawsToSubrace(string subrace, string RightClawResRef, string LeftClawResRef , int EquipLevel, int iTime = TIME_BOTH);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
RightClawResRef:
The resref of the right hand claw. (Use "" if you do not want to specify a claw, use "none" if you want any existing right claws to be removed from the player.)
LeftClawResRef:
The resref of the left hand claw. (Use "" if you do not want to specify a claw, use "none" if you want any existing right claws to be removed from the player.)
EquipLevel:
The level at which these claws should be equipped.
NOTE:
1. Make sure the PCs have weapon proficiency in creature weapons!!! I can't stress this enough. (Give the feat through the subrace Skin) 2. If you are going to use one claw, make sure it is the right claw. 3. Also note that you need not change both claws at once. (IE: Say you equipped a right and left claw at level 5, then say at level 10, if you want to change the left claw then you only need to specify the resref of the left claw... the PC keeps the existing right claw.)
SetupSubraceSwitch()[]
Switch the player from one subrace to another
This allows you to switch a player from one subrace to another.
(Use only once per Level)
Syntax:
void SetupSubraceSwitch(string subrace, string switchSubraceName, int Level, int MustMeetRequirements = TRUE);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
switchSubraceName:
The syntax of the subraces, you wish to switch the player (Should be the same as whatever the new subraces' name used in it's CreateSubrace())
Level:
The level at which this switch should take place.
MustMeetRequirements:
Set to FALSE, if you want the switching to bypass any class/race/alignment restriction the new subrace might have. If MustMeetRequirements set to TRUE, and the character fails to meet a requirement... then they will continue on as part of their current sub-race.
IDEA:
You can set the subrace you want the player to switch to as a hidden and unaccessible subrace for new characters, by setting PrestigiousSubrace to TRUE, in CreateSubrace(). That way, players must earn their way to this new subrace (switchSubraceNames).
Example:
IE: If I had set up three subraces like: CreateSubrace(RACIAL_TYPE_HUMAN, "illithid", "sha_pc_illithid", "sha_subrace_illi", TRUE, 0, FALSE, 0, 3); (Along with other setting for subrace, like class restrictions, appearance, additional skins, etc) CreateSubrace(RACIAL_TYPE_HUMAN, "vampire", "sha_pc_vamp001", "sha_subrace_vamp", TRUE, 2, FALSE, 0, 3, TRUE); Can only be evil. CreateSubraceAlignmentRestriction("vampire", FALSE, FALSE, TRUE); (Along with other setting for subrace, like class restrictions, appearance, additional skins, etc) CreateSubrace(RACIAL_TYPE_HUMAN, "wolkier", "sha_pc_wolk", "sha_subrace_wolk", TRUE); Can only be Neutral;. CreateSubraceAlignmentRestriction("wolkier", FALSE, TRUE, FALSE); (Along with other setting for subrace, like class restrictions, appearance, additional skins, etc) And I wished that PCs belonging to illithid be switched to vampire or wolkier at level 15, depending on which criteria they meet, then I would call: SetupSubraceSwitch("illithid", "vampire_wolkier", 15, TRUE); If I didn't want the alignment criteria to be check during switching then I would call: SetupSubraceSwitch("illithid", "vampire_wolkier", 15, FALSE); The order in which you choose the subrace to be switched is important. If the player can meet both requirements, it gives prioirty to the first one. You can put in any number of subraces to switch to.. IE: SetupSubraceSwitch("illithid", "vampire_wolkier_pixie_shadow", 8, TRUE); If a player doesn't meet the criteria for any one of the subraces, he/she wil remain part of thier usual/current subrace. You can use SetupSwitchSubrace() as many times as you like. EG: SetupSubraceSwitch("illithid", "vampire_wolkier_pixie_shadow", 12, TRUE); SetupSubraceSwitch("illithid", "air-genasi_underminion", 18, TRUE); SetupSubraceSwitch("illithid", "mindbreaker_telephathest_darkmoon", 32, TRUE); SetupSubraceSwitch("illithid", "greatone", 40, FALSE); Where: vampire, wolkier, pixie, shadow, air-genasi, underminion, mindbreaker, telephathest, darkmoon, and greatone are all subraces.
Note:
In order for this to work the subrace you wish to switch the player to does NOT have to be marked as prestigious.
AddSubraceItem()[]
Give the player belonging to a subrace, additional unique items
This allows you to give players belonging to a subrace additional unique items, at any level.
(Use as many times as desired for any levels)
Syntax:
void AddSubraceItem(string subrace, string ItemResRef, int Level = 1);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
ItemResRef:
The blueprint res-ref of the item to give.
Level:
The level at which to give the item.
Example:
Say I wanted to give my players belonging to the vampire subrace, an armour and a scythe at level 2. And then an amulet at level 10. The armor's resref is: "sha_vamp_arm" The scythe's resref is: "sha_vamp_scythe" The amulet's resref is: "sha_vamp_ammy" So I simply call: AddSubraceItem("vampire", "sha_vamp_arm", 2); AddSubraceItem("vampire", "sha_vamp_scythe", 2); AddSubraceItem("vampire", "sha_vamp_ammy", 10);
NOTE:
You can only give ONE item of each. IE: You CAN'T do this expecting to give 2 amulets: AddSubraceItem("vampire", "sha_vamp_ammy", 10); AddSubraceItem("vampire", "sha_vamp_ammy", 10);
SetupSubraceAlias()[]
Setup an alias for your subrace.
Allows you to use two or more "names" for the same subrace without having to add it twice.
See SSE_TREAT_ALIAS_AS_SUBRACE in sha_subr_consts for more info.
Syntax:
void SetupSubraceAlias(string subrace, string Alias);
CreateSubracePrestigiousClassRestriction()[]
Setup a Prestige class restriction for a 'Prestige' subrace.
This will only be checked during a 'subrace switch' for obvious reasons. Refer to SetupSubraceSwitch(...)
Syntax:
void CreateSubracePrestigiousClassRestriction(string subrace, int MinimumLevels = 1, int CanBe_ArcaneArcher = TRUE, int CanBe_Assasin = TRUE, int CanBe_Blackguard = TRUE, int CanBe_ChampionOfTorm = TRUE, int CanBe_RedDragonDisciple = TRUE, int CanBe_DwarvenDefender = TRUE, int CanBe_HarperScout = TRUE, int CanBe_PaleMaster = TRUE, int CanBe_ShadowDancer = TRUE, int CanBe_Shifter = TRUE, int CanBe_WeaponMaster = TRUE);
subrace
Should be the same as the Subrace's name used in CreateSubrace().
MinimumLevels
The minimum number of levels in a/any particular prestigious class allowed to pass the restriction.
CanBe_
Set CanBe_<Class> values as desired.
Example:
Say I have a subrace 'Phantasm' and I wanted to add a restriction so that only Shadow Dancers, Blackguards, and Assasin can be part of. AND they must have atleast 5 levels in any of those classes. So I set: CreateSubracePrestigiousClassRestriction("phantasm", 5, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE); A player with class combination like <Any base class>/Assasin(2)/ShadowDancer(3) will meet this criteria.
NOTE:
This can be used in combination with CreateSubraceClassRestriction(...) If you wanted to you can also set-up a primary/base class restriction with CreateSubraceClassRestriction(...) and also create a Prestigious class restriction with this.
ModifySubraceAppearanceAttachment()[]
Add wings or tail to the subrace
You may use this as many times as desired.
Syntax:
void ModifySubraceAppearanceAttachment(string subrace, int Male_Wings = 0, int Female_Wings = 0, int Male_Tail = 0, int Female_Tail = 0, int Level = 1);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
Male_Wings:
The wing to be added for a male character: Use any APPEARANCE_TYPE_ATTACHMENT_WINGS_* constant.
Female_Wings:
The wing to added for a female character: Use any APPEARANCE_TYPE_ATTACHMENT_WINGS_* constant.
Male_Tail:
The tail to be added for a male character: Use any APPEARANCE_TYPE_ATTACHMENT_TAIL_* constant.
Female_Tail:
The tail to be added for a female character: Use any APPEARANCE_TYPE_ATTACHMENT_TAIL_* constant.
Level:
The level at which to add these attachments.
NOTE:
If you are using any of the CEP tails or wings, your server/module must have CEP.
Example of Usage:
Say I want to add bird like wings to the male character, and angel wings to the female character at level 21: I also want to change the male wings to devil and the female to red dragon disciple's, and add a bone tail to both genders at level 36. AddSubraceAppearanceAttachment("mysubrace", APPEARANCE_TYPE_ATTACHMENT_WINGS_BIRD, APPEARANCE_TYPE_ATTACHMENT_WINGS_ANGEL, 0, 0, 21); AddSubraceAppearanceAttachment("mysubrace", APPEARANCE_TYPE_ATTACHMENT_TAIL_DEVIL, APPEARANCE_TYPE_ATTACHMENT_WINGS_RED_DRAGON_DISCIPLE, APPEARANCE_TYPE_ATTACHMENT_TAIL_BONE, APPEARANCE_TYPE_ATTACHMENT_TAIL_BONE, 36);
CreateSubraceGenderRestriction()[]
Use to restrict subrace's gender
Syntax:
void CreateSubraceGenderRestriction(string subrace, int CanBeMale = TRUE, int CanBeFemale = TRUE);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
CanBeMale:
Set to FALSE if you do not want the subrace to be playable by Male characters
CanBeFemale:
Set to FALSE if you do not want the subrace to be playable by Female characters
Example of useage:
Say I want my subrace "Pixie" only be playable by Female characters... then I would call: CreateSubraceGenderRestriction("pixie", FALSE, TRUE);
ChangePortrait()[]
Use to the portrait of a character
List of portraits' file names can be found in portraits.2da.
You may use this as many times as desired.
Syntax:
void ChangePortrait(string subrace, string MalePortrait, string FemalePortrait, int Level = 1);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
MalePortrait:
Set the name of the male portrait.
FemalePortrait:
Set the name of the female portrait.
Level:
The level at which to change the portrait.
NOTE:
This function will correclty set the portraits. But whether or not other players or the player him/herself can see it depends on whether they have portrait in their portrait folder or the expansion packs containing the portraits. (Like in the below for example: The Queen Shao's portrait is only included in HoTU. So if the player does not have Queen Shao's portraits in his/her portrait folder will not be able to see them. And other players without HoTU will not be able to see the player's portrait)
NOTE 2:
If you want to use any of the standard portraits (That is any from NWN) make sure you have "po_" as prefix. IE: If you want to use the portrait set 'el_f_04_' (as listed in portraits.2da) the actual name is: po_el_f_04_. (Some portraits in the standard library do not use the po_ prefix... and there is no way to tell other than by trial and error)
Example of Useage:
Say I have the Queen Shao's portraits. These portraits are po_queenshao_h, po_queenshao_l, po_queenshao_m, po_queenshao_s, and po_queenshao_t. So this means that this portrait set is refered to by: po_queenshao_ Likewise say I have another portrait set: my_male_port_ And say I want to set Queen Shao's portrait to all the female players, and my other portrait set to the male characters at level 6. So I would call: ChangePortrait("mysubrace", "my_male_port_", "po_queenshao_", 6);
ModifySubraceFaction()[]
Use to set-up an automated change in the subrace's faction
Syntax:
void ModifySubraceFaction(string subrace, string FactionCreatureTag, int Reputation = SUBRACE_FACTION_REPUTATION_HOSTILE);
string subrace:
Should be the same as the Subrace's name used in CreateSubrace()
string FactionCreatureTag:
The tag of the creature whose perception of the subrace will be adjusted.
int Reputation:
Use any SUBRACE_FACTION_REPUTATION_* constants.
Example of function usage:
Say I have a NPC faction called 'Drow Faction'. This faction will normally attack (Hostile) player character. But I want to have the players belonging to the 'Drow' subrace be treated friendly, by the NPCs belonging to this faction... So inorder to do this; first I will need to create: An NPC in a LOCKED room (IE: no player can enter), I would remove all weapons and items from this NPC. Set it as Immortal (NOT Plot). Set it's tag to say: MY_DROW_FACTION_NPC And then call this function: ModifySubraceFaction("drow", "MY_DROW_FACTION_NPC", SUBRACE_FACTION_REPUTATION_FRIENDLY);
CreateSubraceStartLocation()[]
Setup a start location for a subrace
This will teleport the player belonging to the Subrace 'subrace' to the waypoint, when they enter the module.
Syntax:
void CreateSubraceStartLocation(string subrace, string WaypointTag);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
WaypointTag:
The Tag of the waypoint to which the player will be ported to.
LetoScript functions[]
ModifySubraceFeat()[]
Add/remove a feat to/from the character belonging to a subrace
You may use this as many times as desired.
Syntax:
void ModifySubraceFeat(string subrace, int FeatID, int Level = 1, int Remove = FALSE);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
FeatID:
Use any FEAT_* constants.
Remove:
If set to TRUE, it will remove the the feat from the player.
Level:
Level at which to give this bonus feat.
NOTE:
Player must have the required expansion packs for the feats. IE: If you were to give Epic Dodge, the player must have HoTU expansion pack installed inorder to recieve/use the feat.
Example of Usage:
Say I want to give Disarm at level 5, and improved knockdown at level 8 to the players belonging to Drow subrace. I also want to remove Alterness from the player at level 10. ModifySubraceFeat("drow", FEAT_DISARM, 5); ModifySubraceFeat("drow", FEAT_IMPROVED_KNOCKDOWN, 8); ModifySubraceFeat("drow", FEAT_ALERTNESS, 10, TRUE);
CreateBaseStatModifier()[]
Create custom base stats
This is used in conjunction with CreateBaseStatModifier(...) -refer to it for more details.
Fill in the Modifiers as desired.
For speed modification use any MOVEMENT_SPEED_* constant.
Use to make PERMANENT changes to the ability scores or movement speed of the character
This is used in conjunction with SubraceBaseStatsModifier CustomBaseStatsModifiers(...)
You may use this as many times as desired.
Syntax:
void CreateBaseStatModifier(string subrace, struct SubraceBaseStatsModifier Stats, int Level = 1, int Set = FALSE);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
SubraceBaseStatsModifier:
Use CustomBaseStatsModifiers(...) to create the stats.
Level:
The level at which to make these changes.
Set: If you set it to TRUE, then these stats will REPLACE (instead of adding or subtracting) the player's
stats.
Example:
I want to increase Strength by 6, decrease Dexterity by 4, increase Consitution by 4, and change the movement speed to fast. So I would call: struct SubraceBaseStatsModifier MyStats = CustomBaseStatsModifiers(6, -4, 4, 0, 0, 0, MOVEMENT_SPEED_FAST); struct SubraceBaseStatsModifier CustomBaseStatsModifiers(int StrengthModifier, int DexterityModifier, int ConstitutionModifier, int IntelligenceModifier, int WisdomModifier, int CharismaModifier, int MovementSpeedModifier);
Example 2:
Say I have a subrace called: black-dragon. And I want to increase Strength by 6, decrease Dexterity by 4, increase Consitution by 4, and decrease charisma by 2, and change the movement speed to fast at level 10. So I would call: struct SubraceBaseStatsModifier MyStats = CustomBaseStatsModifiers(6, -4, 4, 0, 0, -2, MOVEMENT_SPEED_FAST); CreateBaseStatModifier("black-dragon", MyStats, 10);
ChangeSoundSet()[]
Use to the soundset of the character
You may use this as many times as desired.
Syntax:
void ChangeSoundSet(string subrace, int MaleSoundSet, int FemaleSoundSet, int Level = 1);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
MaleSoundSet:
Refer to the table in the PDF guide book and enter the 'Reference Number'.
FemaleSoundSet:
Refer to the table in the PDF guide book and enter the 'Reference Number'.
Level:
The level at which to change the soundset.
Example of Useage:
Say I want to change the Male character's soundset to Minotaur, Chief and the Female character's soundset to Succubusat level 16. And then at level 25 change it to Ogre and Nymph. The numbers are 65 for Minotaur Chief, 90 for the Succubus, 70 for Ogre, and 197 for the Nymph soundsets). ChangeSoundSet("mysubrace", 65, 90, 16); ChangeSoundSet("mysubrace", 70, 197, 25);
ModifySubraceSkill()[]
Modify a skill a character belonging to a subrace has
Syntax:
void ModifySubraceSkill(string subrace, int SkillID, int iModifier, int Level = 1, int Set = FALSE);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
SkillID:
Use any SKILL_* constants.
iModifier:
The value to increase or decrease or set the skill by/to. Set: If set to TRUE, the skill points in the chosen skill will be set to the value of iModifier.
Example of Usage:
Say I want to increase Spot skill by 15, and decrease Search by 12 at level 10, and set Tumble to 5 at level 16. I would call: ModifySubraceSkill("mysubrace", SKILL_SPOT, 15, 10); ModifySubraceSkill("mysubrace", SKILL_SEARCH, -12, 10); ModifySubraceSkill("mysubrace", SKILL_TUMBLE, 5, 16, TRUE);
ModifySubraceAppearanceColors()[]
Use to setup different skin and hair colors for subrace
Syntax:
void ModifySubraceAppearanceColors(string subrace, int Male_Hair = -1, int Female_Hair = -1, int Male_Skin = -1, int Female_Skin = -1, int Level = 1);
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
Male_Hair:
Refer to the guide book for which number represents which color
Female_Hair:
Refer to the guide book for which number represents which color
Male_Skin:
Refer to the guide book for which number represents which color
Female_Skin:
Refer to the guide book for which number represents which color
Level:
the level at which this change is to take place.
CreateSubraceSpecialRestriction()[]
Use to setup a special subrace restriction
Syntax:
void CreateSubraceSpecialRestriction(string subrace, int Type, string VarName, int Existance=TRUE, string Database="");
subrace:
Should be the same as the Subrace's name used in CreateSubrace()
Type:
The type of special restriction (e.g. item, variable etc) See SUBRACE_SPECIAL_RESTRICTION_*
VarName:
The variable name if a variable or the tag if item (etc.)
Existance:
if TRUE then this variable/item must exist, if FALSE it must not exist.
Database:
The name of the database or the tag of the item, which holds the variable (not used for "must have item" restriction). if Database is empty it will default to SUBRACE_DATABASE (if Database) or the Player (if Local var)
Module functions[]
SubraceOnClientEnter[]
Add this on the Module OnClientEnter script.
Syntax:
void SubraceOnClientEnter(object oPC = OBJECT_INVALID);
SubraceOnPlayerRespawn()[]
Add this to Module OnPlayerRespawn script.
Syntax:
void SubraceOnPlayerRespawn();
SubraceOnPlayerLevelUp()[]
Add this to Module OnPlayerLevelUp script.
Syntax:
void SubraceOnPlayerLevelUp();
SubraceOnPlayerEquipItem()[]
Add this to Module OnPlayerEquipItem script.
Syntax:
void SubraceOnPlayerEquipItem();
SubraceOnItemActivated()[]
Add this to the Module OnItemActivated script.
Syntax:
void SubraceOnItemActivated();
SubraceHeartbeat()[]
Subrace Heartbeat function - For use in clock
Syntax:
void SubraceHeartbeat(object oPC = OBJECT_SELF);
SubraceOnClientLeave()[]
Add this to the Module OnClientLeave script.
Syntax:
void SubraceOnClientLeave();
GetIsSSEDisabled()[]
Returns TRUE if SSE has been disabled serverwide.
This check does NOT care if SSE has been disabled in the current area.
Syntax:
int GetIsSSEDisabled();
GetIsSSEDisabledInArea()[]
Returns TRUE if SSE has been disabled in Area.
This check does NOT care if SSE has been disabled Serverwide.
returns FALSE on error (e.g. if input is non an area)
Syntax:
int GetIsSSEDisabledInArea(object Area);
GetSSEStatus()[]
Returns SSE_STATUS_OPERATIONAL if SSE is running properly.
Else it returns a flag depending on the issue.
See SSE_STATUS_* constants. It adds all that applies.
If a non-valid area is supplied, area check is skipped.
Syntax:
int GetSSEStatus(object Area=OBJECT_INVALID);
SubraceForceUnequipItem()[]
Force the player to properly un-equip the item.
Syntax:
void SHA_SubraceForceUnequipItem(object oItem);
SHA_SubraceForceEquipItem()[]
Force the player to properly equip oItem in the inventory slot: InvoSlot.
Syntax:
void SHA_SubraceForceEquipItem(object oItem, int InvoSlot);
GetSubraceXPModifier()[]
Return the XP modifier for being part of the Subrace
(Calclates modifer value for Subrace Favored classes)
Syntax:
float GetSubraceXPModifier(object oPC);
Subrace_GetIsUndead()[]
Returns TRUE if the player is marked as being part of an undead subrace.
Returns FALSE if player is not an undead OR provided character is NOT a PC!
Syntax:
int Subrace_GetIsUndead(object oPC);
GetECL()[]
Returns the Effective Character level of oPC.
Syntax:
int GetECL(object oPC);
DeleteSubraceInfoOnPC()[]
Deletes every bit of subracial information stored on the PC. Also destroys equipped skins and claws.
Set ClearSubraceField to TRUE if you wish, to have their Subrace field cleared (set to "") after this is done.
If you don't SSE will assume they are new to the subrace and re-initiate them to the subrace at next login
(assuming they still meet the demands)
Syntax:
void DeleteSubraceInfoOnPC(object oPC, int ClearSubraceField=FALSE);
ChangeToPCDefaultAppearance()[]
Change the PC to his/her default humaniod appearance.
IE: If the player is human and his/her appearance is Illithid, this will turn them back to looking like human again.
Syntax:
void ChangeToPCDefaultAppearance(object oPC);
GetIsPCLightSensitive()[]
Returns TRUE if PC belongs to a subrace which is Light sensitive.
Syntax:
int GetIsPCLightSensitive(object oPC);
Subrace_GetFavouredClass()[]
Return the Favored class of the PC. Returns -1 if there is none.
Syntax:
int Subrace_GetFavouredClass(object oPC);
SHA_SendSubraceMessageToPC()[]
Send's a message to PC, with a Subrace Engine title. Set Important to TRUE if it is an important message. (Refer to sha_subr_consts for more info.)
Syntax:
void SHA_SendSubraceMessageToPC(object oPC, string message, int Important = TRUE);
SSE_MessageHandler()[]
Send's a message to PC with a Subrace Engine title. This will follow the new message standards and allow very selective messages. If you wish to use this for non-standard-SSE messages, MessageReference should be MESSAGE_USER_MADE.
VariableText will then be directly displayed (With Subrace Engine title)
MessageType must contain the MESSAGE_TYPE_* constants, for user made messages!
Syntax:
void SSE_MessageHandler(object Receiver, int MessageReference, string VariableText="", string VariableText2="", int MessageType = MESSAGE_TYPE_DEFAULT);
NOTE:
MESSAGE_TYPE_VITAL will ALWAYS be displayed REGARDLESS of settings and MESSAGE_TYPE_LOG will ALWAYS be logged! (Assuming there is a message to send/log)
SearchAndDestroySkinsAndClaws()[]
Traverses through oPC's inventory, destroying all Skins, and creature items.
Syntax:
void SearchAndDestroySkinsAndClaws(object oPC);
ClearSubraceEffects()[]
Removes temporary subrace ability scores and AB boosts.
Syntax:
void ClearSubraceEffects(object oPC);
SHA_GetCurrentTime()[]
Returns TIME_DAY, or TIME_NIGHT depending on the current hour of day.
Syntax:
int SHA_GetCurrentTime();
SHA_GetDefaultAppearanceType()[]
Returns the default appearance type of oPC. (It ignores any appearance
change by SetAppearance()).
Syntax:
int SHA_GetDefaultAppearanceType(object oPC);
NOTE:
oPC must be a player character in order for this to work.
LoadSubraceFromScript()[]
This will load scripts containing sub-races. You can use the Conditions parameter if you want to make the script load only if Leto is (or is not) enabled.
Syntax:
void LoadSubraceFromScript(string Script, int Conditions=SSE_SUBRACE_LOADER_CONDITION_ALWAYS_LOAD);
ApplySubrace()[]
Switch oTarget's subrace to Subrace
Takes approximately 12 - 15 seconds to complete.
Syntax:
void ApplySubrace(object oTarget, string Subrace);
Note:
this function does not do any checking, to see if oTarget meets any alignment or race criteria. Should
be used with caution.
SSE_ModuleLoadEvent()[]
Use this on the OnModuleLoad script to signal that the subraces has been loaded
and we are good to go. If you do not call this one, SSE will wait forever!
It has an internal delay and will wait up 30 seconds for other sub-race scripts to load.
doNWNXInit is used to call the NWNX Init "NWNX!INIT" with parameter "1".
set to TRUE if you do not have an external call to it and plan on using NWNX (Leto or NWNX database)
Syntax:
void SSE_ModuleLoadEvent(int doNWNXInit=FALSE);
NOTE:
After the first sub-race load has been detected, further 5 seconds are given to finish the loading. After that SSE will not wait any further! It is adviced to have all your subraces load within 5 seconds of each other! (If you use LoadSubraceFromScript(), you do not have to worry about this)
GetSubraceNameByAlias()[]
Use this to get the base race of the alias.
if Alias is the base race then it returns itself.
returns "" if the Alias is not valid/no such subrace exist
if Lowercase is TRUE it will return a lowercased string
Syntax:
string GetSubraceNameByAlias(string Alias, int Lowercase=FALSE);
GetSubraceNameByID()[]
Use this to get the race name of the ID.
returns "" if the Alias is not valid/no such subrace exist
if Lowercase is TRUE it will return a lowercased string
Syntax:
string GetSubraceNameByID(int ID, int Lowercase=FALSE);
GetPlayerSubraceID()[]
Returns the Player's Subrace ID.
Syntax:
int GetPlayerSubraceID(object Player);
SSE_Message_AddDisplayType()[]
This will add MessageType too the list of message types that is SSE may display
If no list is present, a new (empty) list will be created and the type will be added to it.
Syntax:
void SSE_Message_AddDisplayType(int MessageType);
NOTE:
Vital will ALWAYS be displayed and Log will ALWAYS be logged!
SSE_Message_RemoveDisplayType()[]
This will remove MessageType from the list of message types that is SSE may display
If no list is present, it is assumed you want to use the server default without this type!
Syntax:
void SSE_Message_RemoveDisplayType(int MessageType);
NOTE:
Vital will ALWAYS be displayed and Log will ALWAYS be logged!
SSE_Message_SetDisplayType()[]
Creates a new list of the Message types SSE that is allowed to display with MessageType as an entry
the old list will be deleted.
Syntax:
void SSE_Message_SetDisplayType(int MessageType);
NOTE:
Vital will ALWAYS be displayed and Log will ALWAYS be logged!
SSE_Message_GetDisplayType()[]
returns the list of message types SSE is allowed to display.
if no list is present, MESSAGE_TYPE_SERVER_DEFAULT or FALSE will be returned depending on DoNotReturnServerDefault
Syntax:
int SSE_Message_GetDisplayType(int DoNotReturnServerDefault=FALSE);
SSE_HorseAddHorseMenu()[]
Gives the 169 horse menu feat to oPC's hide.
Syntax:
void SSE_HorseAddHorseMenu(object oPC)