rollnw.nwn1

rollnw.nwn1.add_known_spell(obj: Creature, class_: int, spell: int) bool

Adds a known spell

rollnw.nwn1.add_memorized_spell(obj: Creature, class_: int, spell: int, meta: int = 0) bool

Adds a memorized spell

rollnw.nwn1.add_special_ability(obj: Creature, ability: int, level: int = 0) None

Adds a special ability use

Since:

0.46

rollnw.nwn1.apply_effect(obj: ObjectBase, effect: Effect) bool

Applies an effect to an object.

Parameters:
  • obj – The object to which the effect is applied.

  • effect – The effect to apply.

Returns:

True if the effect was successfully applied, False otherwise.

Return type:

bool

rollnw.nwn1.attacks_per_second(obj: Creature, type, versus: ObjectBase) float

Number of attacks per second

rollnw.nwn1.base_attack_bonus(obj: Creature) int

Calculates base attack bonus

rollnw.nwn1.calculate_ac_versus(obj: ObjectBase, versus: ObjectBase | None = None, is_touch_attack: bool = False) int

Calculate Armor Class versus another object

rollnw.nwn1.calculate_challenge_rating(obj: Creature) float

Calculates a creatures challenge rating

Since:

0.46

rollnw.nwn1.calculate_item_ac(obj: Item) int

Calculates the armor class of a piece of armor

rollnw.nwn1.calculate_item_value(item: Item) float

Calculates the value of an item

Since:

0.46

rollnw.nwn1.can_equip_item(obj: Creature, item: Item, slot: int) bool

Determines if an item can be equipped

rollnw.nwn1.can_use_monk_abilities(obj: Creature) Tuple[bool, int]

Determines if monk class abilities are usable and monk class level

rollnw.nwn1.clear_special_ability(obj: Creature, ability: int) None

Clears all uses of a special ability

Since:

0.46

rollnw.nwn1.compute_total_spell_slots(obj: Creature, class_: int, spell_level: int) int

Computes available slots that are able to be prepared or castable

rollnw.nwn1.compute_total_spells_knowable(obj: Creature, class_: int, spell_level: int) int

Computes total knownable spells at spell_level

Since:

0.46

rollnw.nwn1.count_feats_in_range(obj: Creature, start: int, end: int) int

Counts the number of known feats in the range [start, end].

Parameters:
  • obj – The creature to check.

  • start – The starting feat in the range.

  • end – The ending feat in the range.

Returns:

The number of known feats in the range.

Return type:

int

rollnw.nwn1.create_object(resref: str, type: ObjectType) ObjectBase

Creates an object. Returns invalid object on failure.

Since:

0.46

rollnw.nwn1.destroy_object(obj: ObjectBase) None

Destroys an object, if valid.

Since:

0.46

rollnw.nwn1.effect_ability_modifier(ability: int, modifier: int) Effect

Creates an ability modifier effect.

rollnw.nwn1.effect_armor_class_modifier(type: int, modifier: int) Effect

Creates an armor class modifier effect.

rollnw.nwn1.effect_attack_modifier(attack: int, modifier: int) Effect

Creates an attack modifier effect.

rollnw.nwn1.effect_bonus_spell_slot(class_: int, spell_level: int) Effect

Creates a bonus spell slot effect.

rollnw.nwn1.effect_concealment(value: int, type: int = 0) Effect

Creates a concealment effect.

rollnw.nwn1.effect_damage_bonus(type: int, dice: ~rollnw.DiceRoll, cat: ~rollnw.DamageCategory = <DamageCategory.none: 0>) Effect

Creates a damage bonus effect.

rollnw.nwn1.effect_damage_immunity(type: int, value: int) Effect

Creates a damage immunity effect. Negative values create a vulnerability.

rollnw.nwn1.effect_damage_penalty(type: int, dice: DiceRoll) Effect

Creates a damage penalty effect.

rollnw.nwn1.effect_damage_reduction(value: int, power: int, max: int = 0) Effect

Creates a damage reduction effect.

rollnw.nwn1.effect_damage_resistance(type: int, value: int, max: int = 0) Effect

Creates a damage resistance effect.

rollnw.nwn1.effect_haste() Effect

Creates a haste effect.

rollnw.nwn1.effect_hitpoints_temporary(amount: int) Effect

Creates temporary hitpoints effect.

rollnw.nwn1.effect_miss_chance(value: int, type: int = 0) Effect

Creates a miss chance effect.

rollnw.nwn1.effect_save_modifier(save: int, modifier: int, vs: int = -1) Effect

Creates a save modifier effect.

rollnw.nwn1.effect_skill_modifier(skill: int, modifier: int) Effect

Creates a skill modifier effect.

rollnw.nwn1.equip_index_to_attack_type(equip)

Converts an equip index to an attack type

rollnw.nwn1.equip_item(obj: Creature, item: Item, slot: int) bool

Equip an item

rollnw.nwn1.get_ability_modifier(obj: Creature, ability, base: bool = False) int

Gets creatures ability modifier

rollnw.nwn1.get_ability_score(obj: Creature, ability, base: bool = False) int

Gets creatures ability score

rollnw.nwn1.get_all_available_feats(obj: Creature) List[int]

Gets all feats for which requirements are met.

Parameters:

obj – The creature to check.

Returns:

A list of feats for which requirements are met.

Return type:

list

rollnw.nwn1.get_available_spell_slots(obj: Creature, class_: int, spell_level: int) int

Gets the number of available slots at a particular spell level

rollnw.nwn1.get_available_spell_uses(obj: Creature, class_: int, spell: int, min_spell_level: int = 0, meta: int = 0) int

Gets available spell uses

rollnw.nwn1.get_caster_level(obj: Creature, class_: int) int

Gets creatures caster level

rollnw.nwn1.get_current_hitpoints(obj: ObjectBase) int

Gets objects current hitpoints

rollnw.nwn1.get_dex_modifier(obj: Creature) int

Gets creatures dexterity modifier as modified by armor, etc.

rollnw.nwn1.get_equipped_item(obj: Creature, slot) Item

Gets an equipped item

rollnw.nwn1.get_has_special_ability(obj: Creature, ability: int) bool

Determines if a creature has a special ability

Since:

0.46

rollnw.nwn1.get_knows_spell(obj: Creature, class_: int, spell: int) bool

Determines if creature knows a spell

rollnw.nwn1.get_max_hitpoints(obj: ObjectBase) int

Gets objects maximum hit points.

rollnw.nwn1.get_skill_rank(obj: Creature, skill: int, versus: ObjectBase | None = None, base: bool = False)

Determines creatures skill rank

rollnw.nwn1.get_special_ability_level(obj: Creature, ability: int) int

Determines the caster level of a special ability

Since:

0.46

rollnw.nwn1.get_special_ability_uses(obj: Creature, ability: int) int

Determines how many uses a creature has of a special ability

Since:

0.46

rollnw.nwn1.get_spell_dc(obj: Creature, class_: int, spell: int) int

Gets spell DC

rollnw.nwn1.get_weapon_by_attack_type(obj: Creature, type) Item

Gets an equipped weapon by attack type

rollnw.nwn1.has_effect_applied(obj: ObjectBase, type: int, subtype: int = -1) bool

Determines if an effect type is applied to an object.

Parameters:
  • obj – The object to check.

  • type – The type of the effect.

  • subtype – The subtype of the effect. Defaults to -1.

Returns:

True if the effect type is applied, False otherwise.

Return type:

bool

rollnw.nwn1.has_feat_successor(obj: Creature, feat: int) Tuple[int, int]

Gets the highest known successor feat.

Parameters:
  • obj – The creature to check.

  • feat – The feat to find a successor for.

Returns:

A pair of the highest successor feat and an int representing that the feat is the nth successor. Returns (-1, 0) if no successor exists.

Return type:

tuple

rollnw.nwn1.highest_feat_in_range(obj: Creature, start: int, end: int) int

Gets the highest known feat in range [start, end].

Parameters:
  • obj – The creature to check.

  • start – The starting feat in the range.

  • end – The ending feat in the range.

Returns:

The highest known feat in the range.

Return type:

int

rollnw.nwn1.is_flanked(target: Creature, attacker: Creature) bool
rollnw.nwn1.item_has_property(item: Item, type: int, subtype: int = -1) bool

Determines if an item has a particular item property.

Parameters:
  • item – The item to check.

  • type – The type of the property.

  • subtype – The subtype of the property. Defaults to -1.

Returns:

True if the item has the property, False otherwise.

Return type:

bool

rollnw.nwn1.itemprop_ability_modifier(ability, modifier) ItemProperty

Creates ability modifier item property

rollnw.nwn1.itemprop_armor_class_modifier(value) ItemProperty

Creates armor modifier item property

rollnw.nwn1.itemprop_attack_modifier(value) ItemProperty

Creates attack modifier item property

rollnw.nwn1.itemprop_bonus_spell_slot(class_: int, spell_level: int) ItemProperty

Creates bonus spell slot property

rollnw.nwn1.itemprop_damage_bonus(type: int, value: int) ItemProperty

Creates damage bonus item property

rollnw.nwn1.itemprop_enhancement_modifier(value: int) ItemProperty

Creates enhancement modifier item property

rollnw.nwn1.itemprop_haste() ItemProperty

Creates haste item property

rollnw.nwn1.itemprop_keen() ItemProperty

Creates keen item property

rollnw.nwn1.itemprop_save_modifier(type: int, modifier: int) ItemProperty

Creates save modifier item property

rollnw.nwn1.itemprop_save_vs_modifier(type: int, modifier: int) ItemProperty

Creates save versus modifier item property

rollnw.nwn1.itemprop_skill_modifier(skill, modifier) ItemProperty

Creates skill modifier item property

rollnw.nwn1.itemprop_to_string(ip: ItemProperty) str

Converts an item property to an in-game style string.

Parameters:

ip – The item property to convert.

Returns:

The in-game style string representation of the item property.

Return type:

str

rollnw.nwn1.knows_feat(obj: Creature, feat: int) bool

Checks if an entity knows a given feat.

Parameters:
  • obj – The creature to check.

  • feat – The feat to check.

Returns:

True if the creature knows the feat, False otherwise.

Return type:

bool

rollnw.nwn1.recompute_all_availabe_spell_slots(obj: Creature) None

Recomputes all available spell slots

rollnw.nwn1.remove_effect(obj: ObjectBase, effect: Effect, destroy: bool = True) bool

Removes an effect from an object.

Parameters:
  • obj – The object from which the effect is removed.

  • effect – The effect to remove.

  • destroy – Whether to destroy the effect after removal. Defaults to True.

Returns:

True if the effect was successfully removed, False otherwise.

Return type:

bool

rollnw.nwn1.remove_effects_by(obj: ObjectBase, creator: ObjectHandle) int

Removes effects by creator.

Parameters:
  • obj – The object from which the effects are removed.

  • creator – The creator of the effects.

Returns:

The number of effects removed.

Return type:

int

rollnw.nwn1.remove_known_spell(obj: Creature, class_: int, spell: int) None

Removes a known spell and any preparations thereof.

rollnw.nwn1.remove_special_ability(obj: Creature, ability: int) None

Removes a special ability use

Since:

0.46

rollnw.nwn1.resolve_attack(obj: Creature, type, versus: ObjectBase)

Resolves an attack

rollnw.nwn1.resolve_attack_bonus(obj: Creature, type, versus: ObjectBase | None = None) int

Calculates attack bonus

rollnw.nwn1.resolve_attack_damage(obj: Creature, versus: ObjectBase, data: AttackData) int

Resolves damage from an attack

rollnw.nwn1.resolve_concealment(obj: ObjectBase, type, target: ObjectBase, vs_ranged: bool) Tuple[int, bool]

Resolves an concealment - i.e. the highest of concealment and miss chance

rollnw.nwn1.resolve_critical_multiplier(obj: Creature, type, versus: ObjectBase | None = None) int

Resolves critical multiplier

rollnw.nwn1.resolve_critical_threat(obj: Creature, type) int

Resolves critical multiplier

rollnw.nwn1.resolve_damage_immunity(obj: ObjectBase, dmg_type, versus: ObjectBase | None = None) int

Resolves damage immunity

rollnw.nwn1.resolve_damage_modifiers(obj: Creature, versus: ObjectBase, data: AttackData) None

Resolves resistance, immunity, and reduction

rollnw.nwn1.resolve_damage_reduction(obj: ObjectBase, power: int, versus: ObjectBase | None = None) Tuple[int, Effect]

Resolves damage reduction

rollnw.nwn1.resolve_damage_resistance(obj: ObjectBase, dmg_type, versus: ObjectBase | None = None) Tuple[int, Effect]

Resolves damage resistance

rollnw.nwn1.resolve_dual_wield_penalty(obj: Creature) Tuple[int, int]

Resolves dual wield attack bonus penalty

rollnw.nwn1.resolve_iteration_penalty(obj: Creature, attack_type)

Resolves iteration attack bonus penalty

rollnw.nwn1.resolve_number_of_attacks(obj: Creature, offhand: bool = False) Tuple[int, int]

Calculates number of attacks

rollnw.nwn1.resolve_saving_throw(obj: ObjectBase, type: int, dc: int, type_vs: int = -1, versus: ObjectBase | None = None) bool

Resolves saving throw

rollnw.nwn1.resolve_skill_check(obj: Creature, skill: int, dc: int, versus: ObjectBase | None = None) bool

Resolves skill check

rollnw.nwn1.resolve_target_state(obj: Creature, versus: ObjectBase)

Resolves damage from an attack

rollnw.nwn1.resolve_unarmed_damage(obj: Creature) DiceRoll

Resolves unarmed damage

rollnw.nwn1.resolve_weapon_damage(obj: Creature, weapon: Item) DiceRoll

Resolves weapon damage

rollnw.nwn1.resolve_weapon_power(obj: Creature, weapon: Item) int

Resolves weapon power

rollnw.nwn1.saving_throw(obj: ObjectBase, type: int, type_vs: int = -1, versus: ObjectBase | None = None) int

Determines saving throw

rollnw.nwn1.set_special_ability_level(obj: Creature, ability: int, level: int) None

Sets the caster level of a special ability, iff its a spell ability

Since:

0.46

rollnw.nwn1.set_special_ability_uses(obj: Creature, ability: int, uses: int, level: int = 0) None

Sets the number of uses of a special ability

Since:

0.46

rollnw.nwn1.unequip_item(obj: Creature, slot: int) Item

Unequips an item

rollnw.nwn1.weapon_is_finessable(obj: Creature, weapon: Item) bool

Determines if a weapon is finessable

rollnw.nwn1.weapon_iteration(obj: Creature, weapon: Item) int

Calculates weapon iteration, e.g. 5 or 3 for monk weapons