rollnw

class rollnw.Area

Area object

comments: str
creator_id: int
creatures: List[Creature]
doors: List[Door]
encounters: List[Encounter]
flags: AreaFlags
height: int
id: int
items: List[Item]
json_archive_version: ClassVar[int]
listen_check_mod: int
loadscreen: int
name: LocString
no_rest: int
object_type: ClassVar[int]
placeables: List[Placeable]
pvp: int
scripts: AreaScripts
shadow_opacity: int
skybox: int
sounds: List[Sound]
spot_check_mod: int
stores: List[Store]
tiles: List[AreaTile]
tileset_resref: str
triggers: List[Trigger]
version: int
waypoints: List[Waypoint]
weather: AreaWeather
width: int
flag rollnw.AreaFlags(value)

An enumeration.

Valid values are as follows:

none = <AreaFlags.none: 0>
interior = <AreaFlags.interior: 1>
underground = <AreaFlags.underground: 2>
natural = <AreaFlags.natural: 4>
class rollnw.AreaScripts

Area’s scripts

on_enter: str
on_exit: str
on_heartbeat: str
on_user_defined: str
class rollnw.AreaTile

Area tile

animloop1: int
animloop2: int
animloop3: int
height: int
id: int
mainlight1: int
mainlight2: int
orientation: int
srclight1: int
srclight2: int
class rollnw.AreaWeather

Area’s weather

chance_lightning: int
chance_rain: int
chance_snow: int
color_moon_ambient: int
color_moon_diffuse: int
color_moon_fog: int
color_sun_ambient: int
color_sun_diffuse: int
color_sun_fog: int
day_night_cycle: int
fog_clip_distance: int
fog_moon_amount: int
fog_sun_amount: int
is_night: int
lighting_scheme: int
moon_shadows: int
sun_shadows: int
wind_power: int
class rollnw.AttackData

Class aggregating attack data

Attributes:

armor_class: int
attack_bonus: int
attack_roll: int
attacker: Creature
concealment: int
is_ranged_attack: bool
iteration_penalty: int
multiplier: int
nth_attack: int
result: AttackResult
target: ObjectBase
target_is_creature: bool
target_state: int
threat_range: int
type: int
enum rollnw.AttackResult(value)

Attack Result Type

Member Type:

int

Valid values are as follows:

hit_by_auto_success = <AttackResult.hit_by_auto_success: 1>
hit_by_critical = <AttackResult.hit_by_critical: 2>
hit_by_roll = <AttackResult.hit_by_roll: 3>
miss_by_auto_fail = <AttackResult.miss_by_auto_fail: 4>
miss_by_concealment = <AttackResult.miss_by_concealment: 5>
miss_by_miss_chance = <AttackResult.miss_by_miss_chance: 6>
miss_by_roll = <AttackResult.miss_by_roll: 7>
class rollnw.BodyParts

Class containing references to creature’s body parts

belt: int
bicep_left: int
bicep_right: int
foot_left: int
foot_right: int
forearm_left: int
forearm_right: int
hand_left: int
hand_right: int
head: int
neck: int
pelvis: int
shin_left: int
shin_right: int
shoulder_left: int
shoulder_right: int
thigh_left: int
thigh_right: int
class rollnw.ClassEntry

Class level data

id: int
level: int
spells: SpellBook
class rollnw.CombatInfo

Class containing combat related data

ac_armor_base: int
ac_natural_bonus: int
ac_shield_base: int
combat_mode: int
size_ab_modifier: int
size_ac_modifier: int
target_state: int
class rollnw.Common

Class containing attributes common to all objects

comment: str
locals: LocalData
location: Location
name: LocString
palette_id: int
resref: str
tag: str
class rollnw.Creature

Class that represents a Creature object

appearance: CreatureAppearance
bodybag: int
chunk_death: int
common: Common
conversation: str

Dialog resref

cr: float
cr_adjust: int
decay_time: int
deity: str
description: LocString
disarmable: int
property equipment: Equips

Gets creatures equipped items

faction_id: int
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

gender: int
good_evil: int
property history: LevelHistory

Gets creatures level history

hp: int
hp_current: int
hp_max: int
immortal: int
interruptable: int
property inventory: Inventory

Gets creatures inventory

json_archive_version: ClassVar[int]
lawful_chaotic: int
levels: LevelStats
lootable: int
name_first: LocString
name_last: LocString
object_type: ClassVar[int]
pc: int
perception_range: float
plot: int
race: int
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

scripts: CreatureScripts
soundset: str
starting_package: int
stats: CreatureStats

Offensive and defensive stats.

subrace: str
walkrate: int
class rollnw.CreatureAppearance

Class containing creature’s appearance

body_parts: BodyParts

body_parts

colors: List[int]

Creature Body Part Colors

id: int

Index into appearance.2da

phenotype: int

phenotype

portrait_id: int

Index into portraits.2da

tail: int

tail

wings: int

wings

enum rollnw.CreatureColors(value)

An enumeration.

Valid values are as follows:

hair = <CreatureColors.hair: 1>
skin = <CreatureColors.skin: 2>
tatoo1 = <CreatureColors.tatoo1: 3>
tatoo2 = <CreatureColors.tatoo2: 4>
class rollnw.CreatureScripts

A class containing a creature’s script set.

on_attacked: str
on_blocked: str
on_conversation: str
on_damaged: str
on_death: str
on_disturbed: str
on_endround: str
on_heartbeat: str
on_perceived: str
on_rested: str
on_spawn: str
on_spell_cast_at: str
on_user_defined: str
class rollnw.CreatureStats

Implementation of a creature’s general attributes and stats

add_feat(feat: int) bool

Attempts to add a feat to a creature, returning true if successful

get_ability_score(id: int)

Gets an ability score

get_skill_rank(id: int)

Gets a skill rank

has_feat(feat: int) bool

Determines if creature has feat

remove_feat(feat: int)

Removes a feat

set_ability_score(id: int, value: int) bool

Sets an ability score, returning true if successful

set_skill_rank(id: int, value: int) bool

Sets a skill rank, returning true if successful

flag rollnw.DamageCategory(value)

Represents categories of damage with bitwise support.

Member Type:

int

Valid values are as follows:

none = <DamageCategory.none: 0>
penalty = <DamageCategory.penalty: 1>
critical = <DamageCategory.critical: 2>
unblockable = <DamageCategory.unblockable: 4>
class rollnw.Dialog
add() DialogPtr

Adds empty Dialog Pointer and Node

add_ptr(ptr: DialogPtr, is_link: bool = False) DialogPtr

Adds Dialog Pointer, if is_link is false no new pointer or node is created. if is_link is true a new pointer will created with the node copied from input pointer.

add_string(value: str, lang: LanguageID = LanguageID.english, feminine: bool = False) DialogPtr

Adds Dialog Pointer and Node with string value set

delay_entry: int = 0
delay_reply: int = 0
delete_ptr(ptr: DialogPtr)

Deletes a dialog pointer @warning ptr should be removed from / not added to a dialog prior to deletion

static from_file(path: str | Path) Dialog

Creates a dialog from a GFF or rollnw JSON file

json_archive_version: ClassVar[int]
prevent_zoom: bool = False
remove_ptr(ptr: DialogPtr)

Removes Dialog Ptr from underlying node

restype: ClassVar[ObjectType]
save(path: str)

Saves a dialog to file, valid extentions are “.dlg” and “.dlg.json”

script_abort: str
script_end: str
valid() bool

Checks id dialog was successfully parsed

word_count: int = 0
enum rollnw.DialogAnimation(value)

An enumeration.

Member Type:

int

Valid values are as follows:

default = <DialogAnimation.default: 0>
taunt = <DialogAnimation.taunt: 28>
greeting = <DialogAnimation.greeting: 29>
listen = <DialogAnimation.listen: 30>
worship = <DialogAnimation.worship: 33>
salute = <DialogAnimation.salute: 34>
bow = <DialogAnimation.bow: 35>
steal = <DialogAnimation.steal: 37>
talk_normal = <DialogAnimation.talk_normal: 38>
talk_pleading = <DialogAnimation.talk_pleading: 39>
talk_forceful = <DialogAnimation.talk_forceful: 40>
talk_laugh = <DialogAnimation.talk_laugh: 41>
victory_1 = <DialogAnimation.victory_1: 44>
victory_2 = <DialogAnimation.victory_2: 45>
victory_3 = <DialogAnimation.victory_3: 46>
look_far = <DialogAnimation.look_far: 48>
drink = <DialogAnimation.drink: 70>
read = <DialogAnimation.read: 71>
none = <DialogAnimation.none: 88>
class rollnw.DialogNode
animation: DialogAnimation = 0
comment: str
copy() DialogNode

Copies a Node

delay: int = -1
get_action_param(key: str) str | None

Gets action parameter if it exists

parent: Dialog
pointers: List[DialogPtr]
quest: str
quest_entry: int = -1
remove_action_param(key: str)

Removes action parameter by key

script_action: str
set_action_param(key: str, value: str)

Sets action parameter, if key does not exist key and value are appended

sound: str
speaker: str
text: LocString
type: DialogNodeType
enum rollnw.DialogNodeType(value)

An enumeration.

Member Type:

int

Valid values are as follows:

entry = <DialogNodeType.entry: 0>
reply = <DialogNodeType.reply: 1>
class rollnw.DialogPtr
add() DialogPtr

Adds empty Dialog Pointer and Node

add_ptr(ptr: DialogPtr, is_link: bool = False) DialogPtr

Adds Dialog Pointer, if is_link is false no new pointer or node is created. if is_link is true a new pointer will created with the node copied from input pointer.

add_string(value: str, lang: LanguageID = LanguageID.english, feminine: bool = False) DialogPtr

Adds Dialog Pointer and Node with string value set

comment: str
copy() DialogPtr

Copies dialog pointer and all sub-nodes

get_condition_param(key: str) str | None

Gets condition parameter by key

is_start: bool
node: DialogNode
parent: Dialog
remove_condition_param(key: str)

Removes condition parameter by key

remove_ptr(ptr: DialogPtr)

Removes Dialog Ptr from underlying node

script_appears: str
set_condition_param(key: str, value: str)

Sets condition parameter, if key does not exist key and value are appended

type: DialogNodeType
class rollnw.DiceRoll

Dice roll

bonus: int
dice: int
sides: int
class rollnw.Door

Class that represents a Door object

animation_state: DoorAnimationState
appearance: int
conversation: str

Door’s conversation resref

description: LocString
faction: int
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

generic_type: int
hardness: int
hp: int
hp_current: int
interruptable: int
json_archive_version: ClassVar[int]
linked_to: str
linked_to_flags: int
loadscreen: int
lock: Lock
object_type: ClassVar[int]
plot: int
portrait_id: int
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

saves: Saves
scripts: DoorScripts
trap: Trap
enum rollnw.DoorAnimationState(value)

Door animation states

Valid values are as follows:

closed = <DoorAnimationState.closed: 1>
opened1 = <DoorAnimationState.opened1: 2>
opened2 = <DoorAnimationState.opened2: 3>
class rollnw.DoorScripts

Door’s scripts

on_click: str
on_closed: str
on_damaged: str
on_death: str
on_disarm: str
on_heartbeat: str
on_lock: str
on_melee_attacked: str
on_open: str
on_open_failure: str
on_spell_cast_at: str
on_trap_triggered: str
on_unlock: str
on_user_defined: str
class rollnw.Effect
clear()

Clears the effect such that it’s as if default constructed

get_float(index: int) float

Gets a floating point value

get_int(index: int) int

Gets an integer point value

get_string(index: int) str

Gets a string value

handle() EffectHandle

Gets the effect’s handle

id() EffectID

Gets the effect’s ID

set_float(index: int, value: float) None

Sets a floating point value

set_int(index: int, value: int) None

Sets an integer point value

set_string(index: int, value: str) None

Sets a string value

set_versus(vs) None

Sets the versus value

versus()

Gets the versus value

enum rollnw.EffectCategory(value)

Effect category

Member Type:

int

Valid values are as follows:

magical = <EffectCategory.magical: 1>
extraordinary = <EffectCategory.extraordinary: 2>
supernatural = <EffectCategory.supernatural: 3>
item = <EffectCategory.item: 4>
innate = <EffectCategory.innate: 5>
class rollnw.EffectHandle

Effect Handle

category: EffectCategory
creator: ObjectHandle
effect: Effect
spell_id: int
subtype: int
type: int
class rollnw.EffectID

Effect ID

index: int
version: int
class rollnw.Encounter

Class that represents an Encounter object

active: bool
creatures: List[SpawnCreature]
creatures_max: int
difficulty: int
difficulty_index: int
faction: int
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

geometry: List[Vector3]
player_only: bool
reset: bool
reset_time: int
respawns: int
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

scripts: EncounterScripts
spawn_option: int
spawn_points: List[SpawnPoint]
class rollnw.EncounterScripts

Encounter’s scripts

on_entered: str
on_exhausted: str
on_exit: str
on_heartbeat: str
on_user_defined: str
enum rollnw.EquipIndex(value)

An enumeration.

Member Type:

int

Valid values are as follows:

head = <EquipIndex.head: 0>
chest = <EquipIndex.chest: 1>
boots = <EquipIndex.boots: 2>
arms = <EquipIndex.arms: 3>
righthand = <EquipIndex.righthand: 4>
lefthand = <EquipIndex.lefthand: 5>
cloak = <EquipIndex.cloak: 6>
leftring = <EquipIndex.leftring: 7>
rightring = <EquipIndex.rightring: 8>
neck = <EquipIndex.neck: 9>
belt = <EquipIndex.belt: 10>
arrows = <EquipIndex.arrows: 11>
bullets = <EquipIndex.bullets: 12>
bolts = <EquipIndex.bolts: 13>
creature_left = <EquipIndex.creature_left: 14>
creature_right = <EquipIndex.creature_right: 15>
creature_bite = <EquipIndex.creature_bite: 16>
creature_skin = <EquipIndex.creature_skin: 17>
invalid = <EquipIndex.invalid: 4294967295>
flag rollnw.EquipSlot(value)

Equipment slot flags

Valid values are as follows:

head = <EquipSlot.head: 1>
chest = <EquipSlot.chest: 2>
boots = <EquipSlot.boots: 4>
arms = <EquipSlot.arms: 8>
righthand = <EquipSlot.righthand: 16>
lefthand = <EquipSlot.lefthand: 32>
cloak = <EquipSlot.cloak: 64>
leftring = <EquipSlot.leftring: 128>
rightring = <EquipSlot.rightring: 256>
neck = <EquipSlot.neck: 512>
belt = <EquipSlot.belt: 1024>
arrows = <EquipSlot.arrows: 2048>
bullets = <EquipSlot.bullets: 4096>
bolts = <EquipSlot.bolts: 8192>
creature_left = <EquipSlot.creature_left: 16384>
creature_right = <EquipSlot.creature_right: 32768>
creature_bite = <EquipSlot.creature_bite: 65536>
creature_skin = <EquipSlot.creature_skin: 131072>
class rollnw.Equips

Creature’s equipment

equips: List[str | Item]

len(equips) == 18

Type:

Note

instantiate()

Instantiates equipment by loading contained items from the resource manager

class rollnw.Erf(path: str)

Implementation of Erf file format

Parameters:

path (str) – Erf file to load

add(path)

Adds resources from path

erase(resource)

Removes resource

extract(pattern, output) int

Extract elements from a container by regex

extract_by_glob(glob: str, output: str) int

Extract elements from a container by glob pattern

merge(container: Erf)

Merges the contents of another rollnw.Erf

reload()

Reloads Erf

Notes

Erf:: working_directory() will not change

save()

Saves Erf to Erf:: path()

Notes

It’s probably best to call Erf:: reload after save.

save_as(path)

Saves Erf to different path

Notes

Current Erf unmodified, to load Erf at new path a new Erf must be constructed.

working_directory() str

Get container working directory

enum rollnw.GameVersion(value)

Game versions

Valid values are as follows:

v1_69 = <GameVersion.v1_69: 1>
vEE = <GameVersion.vEE: 2>
nwn2 = <GameVersion.nwn2: 3>
class rollnw.IVector4
w: int
x: int
y: int
z: int
class rollnw.Image(filename: str)

Loads an image

Parameters:

filename (str) – image file to load

channels() int

Gets BPP

data() bytes

Get raw data

height() int

Get height

valid() bool

Determine if successfully loaded.

width() int

Get width

write_to() None

Write Image to file

class rollnw.Ini(filename: str)

Loads an ini

Parameters:

filename (str) – ini file to load

get_float(key: str) float | None

Gets an INI value

get_int(key: str) int | None

Gets an INI value

get_str(key: str) str | None

Gets an INI value

valid()

Deterimes if Ini file was successfully parsed

class rollnw.Inventory

An Object’s inventory

add_item(item: Item) bool

Adds an item to an inventory.

add_page() bool

Adds a page to the inventory if it is growable (i.e. Stores)

can_add_item(item: Item) bool

Determines if an item can be added to an inventory.

debug() str

Creates a string debug grid of the inventory

instantiate()

Instantiates inventory by loading contained items from the resource manager

items() List[Item]

Gets all instantiated items

owner: ObjectBase
remove_item(item: Item) bool

Removes an item from an inventory.

size() int

Gets number of items in the inventory

class rollnw.InventoryItem

An inventory item

infinite: bool

Only applicable to stores

item: str | Item
x: int
y: int
class rollnw.Item

Class that represents an Item object

additional_cost: int
baseitem: int
charges: int
cost: int
cursed: bool
description: LocString

Description

description_id: LocString

Description after being identified.

static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

get_icon_by_part(part: ItemModelParts = ItemModelParts.model1, female: bool = False) Image

Generates image of icon by model part, constructing from PLT textures as necessary.

Note: Python owns the lifetime of the resulting image. Merging icons is also the responsibility of the caller.

identified: bool
inventory: Inventory
model_colors: List[int]
model_parts: List[int]
model_to_plt_colors() PltColors

Converts model colors to PLT colors

model_type: ItemModelType
plot: bool

Is a plot item.

properties: List[ItemProperty]
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

stacksize: int
stolen: bool
enum rollnw.ItemColors(value)

An enumeration.

Valid values are as follows:

cloth1 = <ItemColors.cloth1: 1>
cloth2 = <ItemColors.cloth2: 2>
leather1 = <ItemColors.leather1: 3>
leather2 = <ItemColors.leather2: 4>
metal1 = <ItemColors.metal1: 5>
metal2 = <ItemColors.metal2: 6>
enum rollnw.ItemModelParts(value)

An enumeration.

Valid values are as follows:

model1 = <ItemModelParts.model1: 1>
model2 = <ItemModelParts.model2: 2>
model3 = <ItemModelParts.model3: 3>
armor_belt = <ItemModelParts.armor_belt: 4>
armor_lbicep = <ItemModelParts.armor_lbicep: 5>
armor_lfarm = <ItemModelParts.armor_lfarm: 6>
armor_lfoot = <ItemModelParts.armor_lfoot: 7>
armor_lhand = <ItemModelParts.armor_lhand: 8>
armor_lshin = <ItemModelParts.armor_lshin: 9>
armor_lshoul = <ItemModelParts.armor_lshoul: 10>
armor_lthigh = <ItemModelParts.armor_lthigh: 11>
armor_neck = <ItemModelParts.armor_neck: 12>
armor_pelvis = <ItemModelParts.armor_pelvis: 13>
armor_rbicep = <ItemModelParts.armor_rbicep: 14>
armor_rfarm = <ItemModelParts.armor_rfarm: 15>
armor_rfoot = <ItemModelParts.armor_rfoot: 16>
armor_rhand = <ItemModelParts.armor_rhand: 17>
armor_robe = <ItemModelParts.armor_robe: 18>
armor_rshin = <ItemModelParts.armor_rshin: 19>
armor_rshoul = <ItemModelParts.armor_rshoul: 20>
armor_rthigh = <ItemModelParts.armor_rthigh: 21>
armor_torso = <ItemModelParts.armor_torso: 22>
enum rollnw.ItemModelType(value)

An enumeration.

Valid values are as follows:

simple = <ItemModelType.simple: 1>
layered = <ItemModelType.layered: 2>
composite = <ItemModelType.composite: 3>
armor = <ItemModelType.armor: 4>
class rollnw.ItemProperty

An item property

cost_table: int
cost_value: int
param_table: int
param_value: int
subtype: int
type: int
class rollnw.Language
static encoding(language: LanguageID) str

Gets the encoding for a particular language

static from_string(string: str) LanguageID

Converts string (short or long form) to ID

static has_feminine(language: LanguageID) bool

Determines if language has feminine translations

static to_base_id(id: int) Tuple[LanguageID, bool]

Convert runtime language identifier to base language and bool indicating masc/fem.

static to_runtime_id(language: LanguageID, feminine: bool = False) int

Convert language ID to runtime identifier.

static to_string(language: LanguageID, long_name: bool = False) str

Converts language to string form

enum rollnw.LanguageID(value)

An enumeration.

Member Type:

int

Valid values are as follows:

invalid = <LanguageID.invalid: -1>
english = <LanguageID.english: 0>
french = <LanguageID.french: 1>
german = <LanguageID.german: 2>
italian = <LanguageID.italian: 3>
spanish = <LanguageID.spanish: 4>
polish = <LanguageID.polish: 5>
korean = <LanguageID.korean: 128>
chinese_traditional = <LanguageID.chinese_traditional: 129>
chinese_simplified = <LanguageID.chinese_simplified: 130>
japanese = <LanguageID.japanese: 131>
class rollnw.LevelHistory

Implements a creatures levelup history

entries: List[LevelUp]

Entries for levels

class rollnw.LevelStats

Implements a creatures level related stats

entries: List[ClassEntry]

Entries for levels

level() int

Gets total level

level_by_class(class_: int) int

Gets level by class

class rollnw.LevelUp

Level up data

ability: int

Ability score that was raised, if any. -1 if none

class_: int

Class the level was taken as

epic: bool

True if level is an epic level

feats: List[int]

Added feats

hitpoints: int

Hitpoints gained.

known_spells: List[Tuple[int, int]]

Level, Spell pair for gained spells

skillpoints: int

Roll over skill points

skills: List[Tuple[int, int]]

Skill and the amount increased

class rollnw.LocString(strref: int = -1)

Implements a localized string

Parameters:

strref (int) – String reference. (default -1)

add(language: LanguageID, string: str, feminine: bool = False)

Adds a localized string

contains(language: LanguageID, feminine: bool = False)

Checks if a localized string is contained

static from_dict(data: dict)

Converts python dict to LocString

get(language: LanguageID, feminine: bool = False)

Gets a localized string

remove(language: LanguageID, feminine: bool = False)

Removes a localized string

set_strref(strref: int)

Sets string reference

size() int

Gets number of localized strings

strref() int

Gets string reference

to_dict() DefaultDict

Converts LocString to python dict

class rollnw.LocalData
clear(varname: str, type: int)

Clears local variable by type

clear_all(type: int)

Clears all variables by type

delete_float(varname: str)

Deletes float variable

delete_int(varname: str)

Deletes int variable

delete_location(varname: str)

Deletes location variable

delete_object(varname: str)

Deletes object variable

delete_string(varname: str)

Deletes string variable

get_float(varname: str)

Gets float variable

get_int(varname: str) int

Gets int variable

get_location(varname: str)

Gets location variable

get_object(varname: str)

Gets object variable

get_string(varname: str) str

Gets string variable

set_float(varname: str, value: float)

Sets float variable

set_int(varname: str, value: int)

Sets int variable

set_location(varname: str, value: Location)

Sets location variable

set_object(varname: str, value: ObjectHandle)

Sets object variable

set_string(varname: str, value: str)

Sets string variable

size()

Gets number of variables

class rollnw.Location

Class representing an objects location

area: int
orientation: Vector3
position: Vector3
class rollnw.Lock

Class representing a lock on an object

key_name: str
key_required: bool
lock_dc: int
lockable: bool
locked: bool
remove_key: bool
unlock_dc: int
class rollnw.Module

Class that represents a Module object

area_count() int

Gets number of areas in module

creator: int
dawn_hour: int
description: LocString
dusk_hour: int
entry_area: str
entry_orientation: Vector3
entry_position: Vector3
expansion_pack: int
get_area(index: int) Area | None

Gets number of areas in module

haks: List[str]
id: bytes
is_save_game: bool
locals: LocalData
min_game_version: int
minutes_per_hour: int
name: LocString
scripts: ModuleScripts
start_day: int
start_hour: int
start_month: int
start_movie: str
start_year: int
tag: str
tlk: str
property uuid: str

Gets modules UUID

version: int
xpscale: int
class rollnw.ModuleScripts

Module Scripts

on_client_enter: str
on_client_leave: str
on_cutsnabort: str
on_heartbeat: str
on_item_acquire: str
on_item_activate: str
on_item_unaquire: str
on_load: str
on_player_chat: str
on_player_death: str
on_player_dying: str
on_player_equip: str
on_player_level_up: str
on_player_rest: str
on_player_uneqiup: str
on_spawnbtndn: str
on_start: str
on_user_defined: str
class rollnw.ObjectBase
handle()

Gets object handle

class rollnw.ObjectHandle

Object handle

type: ObjectType

object type

enum rollnw.ObjectType(value)

Object types

Valid values are as follows:

invalid = <ObjectType.invalid: 1>
gui = <ObjectType.gui: 2>
tile = <ObjectType.tile: 3>
module = <ObjectType.module: 4>
area = <ObjectType.area: 5>
creature = <ObjectType.creature: 6>
item = <ObjectType.item: 7>
trigger = <ObjectType.trigger: 8>
projectile = <ObjectType.projectile: 9>
placeable = <ObjectType.placeable: 10>
door = <ObjectType.door: 11>
areaofeffect = <ObjectType.areaofeffect: 12>
waypoint = <ObjectType.waypoint: 13>
encounter = <ObjectType.encounter: 14>
store = <ObjectType.store: 15>
portal = <ObjectType.portal: 16>
sound = <ObjectType.sound: 17>
class rollnw.Palette

Abstracts NWNW Palettes (ITP)

children: List[PaletteTreeNode]
static from_dict(value: dict)

Constructs palette from python dict.

static from_file(path: str | Path)

Constructs palette from file. The file can be JSON or Gff.

is_skeleton() bool

Determines if palette is skeleton

resource_type: ResourceType

Resource type of the palette, note this is only set in skeletons

save(path: str, format: str = 'json') None

Saves palette to path in ‘gff’ or ‘json’ format

tileset: str

Tileset resref if restype is set

to_dict() dict

Converts palette to python dict, same layout as json

valid() bool

Determines if palette was loaded properly

enum rollnw.PaletteNodeType(value)

An enumeration.

Member Type:

int

Valid values are as follows:

branch = <PaletteNodeType.branch: 1>
category = <PaletteNodeType.category: 2>
blueprint = <PaletteNodeType.blueprint: 3>
class rollnw.PaletteTreeNode

A node in a palette

children: List[PaletteTreeNode]
clear() None

Clears node returning it to default constructed state

cr: float

Only if restype == ResourceType:: utc

display: int

Very rarely used, controls the visibility of category nodes. 0 - Display only if not empty. 1 - Never display (in Toolset) 2 - Display in a custom blueprint palette, when creating a blueprint, and assigning a palette category

faction: str
id: int
name: str
resref: str

Extra data dependent on palette resource type, the game appears to handle this with inheritance, but no thanks. Note that in the case of Tilesets, the node ID of the category, determines what the resref is referring to. There are a couple special tileset nodes that will not have a resref at all: Eraser and Raise/Lower

strref: int
type: PaletteNodeType
class rollnw.Placeable

Class that represents a Placeable object

animation_state: PlaceableAnimationState
appearance: int
bodybag: int
common: Common
conversation: str
description: LocString
faction: int
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

hardness: int
has_inventory: bool
hp: int
hp_current: int
interruptable: bool
inventory: Inventory
json_archive_version: ClassVar[int]
lock: Lock
object_type: ClassVar[int]
plot: bool
portrait_id: int
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

saves: Saves
scripts: PlaceableScripts
static: bool
trap: Trap
useable: bool
enum rollnw.PlaceableAnimationState(value)

An enumeration.

Valid values are as follows:

none = <PlaceableAnimationState.none: 1>
open = <PlaceableAnimationState.open: 2>
closed = <PlaceableAnimationState.closed: 3>
destroyed = <PlaceableAnimationState.destroyed: 4>
activated = <PlaceableAnimationState.activated: 5>
deactivated = <PlaceableAnimationState.deactivated: 6>
class rollnw.PlaceableScripts

Placeable’s scripts

on_click: str
on_closed: str
on_damaged: str
on_death: str
on_disarm: str
on_heartbeat: str
on_inventory_disturbed: str
on_lock: str
on_melee_attacked: str
on_open: str
on_spell_cast_at: str
on_trap_triggered: str
on_unlock: str
on_used: str
on_user_defined: str
class rollnw.Player

Player character

Warning

This is very incomplete

save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

class rollnw.Plt

Implementation of PLT file format

height()
pixels()
valid()
width()
class rollnw.PltColors

Plt Color Array

Notes

This would be the colors that a player would select

colors: List[int]
enum rollnw.PltLayer(value)

Plt layers

Member Type:

int

Valid values are as follows:

plt_layer_skin = <PltLayer.plt_layer_skin: 0>
plt_layer_hair = <PltLayer.plt_layer_hair: 1>
plt_layer_metal1 = <PltLayer.plt_layer_metal1: 2>
plt_layer_metal2 = <PltLayer.plt_layer_metal2: 3>
plt_layer_cloth1 = <PltLayer.plt_layer_cloth1: 4>
plt_layer_cloth2 = <PltLayer.plt_layer_cloth2: 5>
plt_layer_leather1 = <PltLayer.plt_layer_leather1: 6>
plt_layer_leather2 = <PltLayer.plt_layer_leather2: 7>
plt_layer_tattoo1 = <PltLayer.plt_layer_tattoo1: 8>
plt_layer_tattoo2 = <PltLayer.plt_layer_tattoo2: 9>
class rollnw.PltPixel

Plt pixel

color
layer
class rollnw.ResourceData

Resource data

name
Type:

str

bytes
Type:

bytes

class rollnw.Saves

An objects saves

fort: int
reflex: int
will: int
class rollnw.Sound

Class that represents a Sound object

active: bool
common: Common
continuous: bool
distance_max: float
distance_min: float
elevation: float
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

generated_type: int
hours: int
interval: int
interval_variation: int
json_archive_version: ClassVar[int]
looping: bool
object_type: ClassVar[int]
pitch_variation: float
positional: bool
priority: int
random: bool
random_position: bool
random_x: float
random_y: float
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

sounds: List[str]
times: int
volume: int
volume_variation: int
class rollnw.SpawnCreature

Encounter creature spawn

appearance: int
cr: int
resref: str
single_spawn: bool
class rollnw.SpawnPoint

A spawn point

orientation: Vector3
position: Vector3
class rollnw.SpecialAbility

Special Ability

flags: SpellFlags
level: int
spell: int
class rollnw.SpellBook

Implements a spell casters spellbook

add_known_spell(level: int, entry: SpellEntry)

Adds a known spell at level

add_memorized_spell(level: int, entry: SpellEntry)

Adds a memorized spell at level

clear_memorized_spell(level: int, spell: int) None

Clears memorized spell

get_known_spell(level: int, index: int)

Gets a known spell entry

get_known_spell_count(level: int)

Gets the number of known at a given level

get_memorized_spell(level: int, index: int)

Gets a memorized spell entry

get_memorized_spell_count(level: int)

Gets the number of memorized at a given level

remove_known_spell(level: int, entry: SpellEntry)

Removes a known spell entry

class rollnw.SpellEntry

An entry in a spellbook

flags: SpellFlags
meta: int
spell: int
flag rollnw.SpellFlags(value)

An enumeration.

Valid values are as follows:

none = <SpellFlags.none: 0>
readied = <SpellFlags.readied: 1>
spontaneous = <SpellFlags.spontaneous: 2>
unlimited = <SpellFlags.unlimited: 4>
class rollnw.StaticTwoDA(filename: str)

Implementation of 2da file format, but faster

Parameters:

filename (str) – 2da file to load

static from_string(string: str) StaticTwoDA
get(row: int, column: int | str)

Gets a TwoDA value

Parameters:
  • row (int) – Row number

  • column (int | str) – Column number or label

Returns:

An int | float | string depending on the underlying value

class rollnw.Store

Class that represents a Store object

armor: Inventory
blackmarket: bool
blackmarket_markdown: int
static from_dict(value: dict) Store

Constructs object from python dict.

static from_file(path: str) Store

Constructs object from file. The file can be JSON or Gff.

gold: int
identify_price: int
json_archive_version: ClassVar[int]
markdown: int
markup: int
max_price: int
miscellaneous: Inventory
object_type: ClassVar[int]
potions: Inventory
rings: Inventory
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

scripts: StoreScripts
weapons: Inventory
class rollnw.StoreScripts

A Store’s scripts

on_closed: str
on_opened: str
class rollnw.Tlk(init: str | LanguageID)

Implementation of the TLK file format

Parameters:

init (str | LanguageID) – if passed a string, init will be treated as a path to a TLK file, if passed a LanguageID, default constructs with the TLKs language set to init.

get(strref: int) str

Gets a tlk entry.

language_id()

Gets the language ID

modified()

Is Tlk modfied

save()

Writes TLK to file

save_as(path: str)

Writes TLK to file

set(strref: int, string: str)

Sets a localized string

size()

Gets the highest set strref

valid()

Gets if successfully parsed

class rollnw.Trap

Class representing a trap on an object

detect_dc: int
detectable: bool
disarm_dc: int
disarmable: bool
is_trapped: bool
one_shot: bool
type: int
class rollnw.Trigger

Class that represents a Trigger object

cursor: int
faction: int
static from_dict(value: dict) Trigger

Constructs object from python dict.

static from_file(path: str) Trigger

Constructs object from file. The file can be JSON or Gff.

geometry: List[Vector3]
highlight_height: float
linked_to: str
linked_to_flags: int
loadscreen: int
portrait: int
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

scripts: TriggerScripts
trap: Trap
type: int
class rollnw.TriggerScripts

A trigger’s scripts

on_click: str
on_disarm: str
on_enter: str
on_exit: str
on_heartbeat: str
on_trap_triggered: str
on_user_defined: str
class rollnw.TwoDA(filename: str)

Implementation of 2da file format

Parameters:

filename (str) – 2da file to load

add_column(name: str) bool

Adds a new column to the 2da, if not already extent, and initializes with ****

column_names() List[str]

Gets column names

static from_string(string: str) TwoDA
get(row: int, column: int | str)

Gets a TwoDA value

Parameters:
  • row (int) – Row number

  • column (int | str) – Column number or label

Returns:

An int | float | string depending on the underlying value

set(row: int, column: int | str, value: int | float | str)

Sets a TwoDA value

Parameters:
  • row (int) – Row number

  • column (int | str) – Column number or label

  • value (int | float | str) – New value

class rollnw.Vector2
x: float
y: float
class rollnw.Vector3
x: float
y: float
z: float
class rollnw.Vector4
W: float
x: float
y: float
z: float
class rollnw.Waypoint

Class that represents a Waypoint object

appearance: int
description: LocString
static from_dict(value: dict)

Constructs object from python dict.

static from_file(path: str)

Constructs object from file. The file can be JSON or Gff.

has_map_note: bool

Has a map note

linked_to: str

Tag of linked object

map_note: LocString
map_note_enabled: bool
save(path: str, format: str = 'json') None

Saves object to path in ‘gff’ or ‘json’ format

rollnw.decode_plt_color(plt: Plt, colors: PltColors, x: int, y: int) int

Decodes PLT and user selected colors to RBGA