GetAbilityScore

From NWN Lexicon
Jump to navigationJump to search

GetAbilityScore(object, int, int)

Get the ability score of a specific type for a creature.

int GetAbilityScore(
    object oCreature,
    int nAbilityType,
    int nBaseAbilityScore = FALSE
);

Parameters

oCreature

The creature whose ability score is sought.

nAbilityType

ABILITY_*

nBaseAbilityScore

If set to TRUE will return the base ability score without bonuses (e.g. ability bonuses granted from equipped items). If nothing entered, defaults to FALSE.

Description

Returns the ability score of type nAbilityType for oCreature (otherwise 0).

Note that this will always return the ability score with racial bonuses or penalties (i.e. the score seen in the character sheet); the parameter nBaseAbilityScore only disapplies bonuses from items, spells and so on. The 'raw' ability score (with no bonuses or racial effects applied) can be obtained via a NWNX function. Note also that attempting to modify ability scores using, for example, the Debug/DM commands ##dm_setCHA/STR/CON etc., sets the 'raw' ability score (i.e. the score without any racial bonuses applied).

Known Bugs

Doesn't work and returns 0 before player execute the OnClientEnter event; that is in OnAcquire and OnEquip events for items the character wear.

Version

1.67

See Also

functions: 

GetWisdom

constants: 

ABILITY_* Constants


 author: Kristian Markon, editor: Mistress