ASSOCIATE_OBJECT_ID | object | Convert to object with StringToObject()
_______________________________________
## Stealth Events
- NWNX_ON_STEALTH_ENTER_BEFORE
- NWNX_ON_STEALTH_ENTER_AFTER
- NWNX_ON_STEALTH_EXIT_BEFORE
- NWNX_ON_STEALTH_EXIT_AFTER
`OBJECT_SELF` = The creature entering or exiting stealth.
@note NWNX_ON_{ENTER|EXIT}_STEALTH_{BEFORE|AFTER} has been deprecated. Please use these new event names.
_______________________________________
## Detect Events
- NWNX_ON_DETECT_ENTER_BEFORE
- NWNX_ON_DETECT_ENTER_AFTER
- NWNX_ON_DETECT_EXIT_BEFORE
- NWNX_ON_DETECT_EXIT_AFTER
`OBJECT_SELF` = The creature entering or exiting detect mode.
_______________________________________
## Examine Events
- NWNX_ON_EXAMINE_OBJECT_BEFORE
- NWNX_ON_EXAMINE_OBJECT_AFTER
`OBJECT_SELF` = The player examining the object
Event Data Tag | Type | Notes
----------------------|--------|-------
EXAMINEE_OBJECT_ID | object | Convert to object with StringToObject()
TRAP_EXAMINE_SUCCESS | int | For trap examine only, whether the examine succeeded
_______________________________________
## Faction Events
- NWNX_ON_SET_NPC_FACTION_REPUTATION_BEFORE
- NWNX_ON_SET_NPC_FACTION_REPUTATION_AFTER
`OBJECT_SELF` = The module
Event Data Tag | Type | Notes
----------------------|--------|-------
FACTION_ID | int | Not the STANDARD_FACTION_* constants. See nwnx_creature->GetFaction().
SUBJECT_FACTION_ID | int | Not the STANDARD_FACTION_* constants. See nwnx_creature->GetFaction().
PREVIOUS_REPUTATION | int |
NEW_REPUTATION | int | Not yet clamped between 0-100. In the AFTER event, this will equal the EventResult set in the BEFORE event.
_______________________________________
## Validate Use Item Events
- NWNX_ON_VALIDATE_USE_ITEM_BEFORE
- NWNX_ON_VALIDATE_USE_ITEM_AFTER
`OBJECT_SELF` = The creature using the item
Event Data Tag | Type | Notes |
------------------------|--------|-------|
ITEM_OBJECT_ID | object | Convert to object with StringToObject()|
BEFORE_RESULT | int | TRUE/FALSE, only in _AFTER events|
@note The event result should be one of:
"0" - Equip denied
"1" - Equip okay
"2" - Swap currently equipped item
"3" - Unequip items in both hands before equipping
@note Setting the result of this event will NOT prevent the item from being equipped, only used (e.g. scrolls/wands). See the "NWNX_ON_VALIDATE_ITEM_EQUIP_*" events to control equip behaviour.
@note If the BEFORE event is not skipped, BEFORE_RESULT is the value of running the function normally. Otherwise, this is the set result value.
_______________________________________
## Use Item Events
- NWNX_ON_USE_ITEM_BEFORE
- NWNX_ON_USE_ITEM_AFTER
`OBJECT_SELF` = The creature using the item
Event Data Tag | Type | Notes |
------------------------|--------|-------|
ITEM_OBJECT_ID | object | Convert to object with StringToObject()|
TARGET_OBJECT_ID | object | Convert to object with StringToObject()|
ITEM_PROPERTY_INDEX | int | |
ITEM_SUB_PROPERTY_INDEX | int | |
TARGET_POSITION_X | float | |
TARGET_POSITION_Y | float | |
TARGET_POSITION_Z | float | |
USE_CHARGES | int | |
@note You can set the event result to "0" (send feedback to the client that the item cannot be used, default)
or "1" to suppress that feedback.
_______________________________________
## Item Container Events
- NWNX_ON_ITEM_INVENTORY_OPEN_BEFORE
- NWNX_ON_ITEM_INVENTORY_OPEN_AFTER
- NWNX_ON_ITEM_INVENTORY_CLOSE_BEFORE
- NWNX_ON_ITEM_INVENTORY_CLOSE_AFTER
`OBJECT_SELF` = The container
Event Data Tag | Type | Notes
----------------------|--------|-------
OWNER | object |Convert to object with StringToObject()
_______________________________________
## Ammunition Reload Events
- NWNX_ON_ITEM_AMMO_RELOAD_BEFORE
- NWNX_ON_ITEM_AMMO_RELOAD_AFTER
`OBJECT_SELF` = The creature whose inventory we're searching for the item type
Event Data Tag | Type | Notes
----------------------|------|-------
BASE_ITEM_ID | int | The base item type being sought (arrow, bolt, bullet)
BASE_ITEM_NTH | int | Find the Nth instance of this item
ACTION_RESULT | int | The object that was determined in BEFORE (only in after)
_______________________________________
## Scroll Learn Events
- NWNX_ON_ITEM_SCROLL_LEARN_BEFORE
- NWNX_ON_ITEM_SCROLL_LEARN_AFTER
`OBJECT_SELF` = The creature learning the scroll
Event Data Tag | Type | Notes
----------------------|--------|-------
SCROLL | object | Convert to object with StringToObject()
RESULT | int | Returns TRUE in the _AFTER if the learning was successful, FALSE otherwise
_______________________________________
## Validate Item Equip Events
- NWNX_ON_VALIDATE_ITEM_EQUIP_BEFORE
- NWNX_ON_VALIDATE_ITEM_EQUIP_AFTER
`OBJECT_SELF` = The creature trying to equip the item
Event Data Tag | Type | Notes |
----------------------|--------|-------|
ITEM_OBJECT_ID | object | Convert to object with StringToObject()|
SLOT | int | INVENTORY_SLOT_* Constant|
BEFORE_RESULT | int | TRUE/FALSE, only in _AFTER events|
@note Manually setting the result of this event will skip all game checks for item slot validity. The client will block incompatible types (weapons into armor slots) in the GUI, but this will work using ActionEquipItem().
@note To show this item as unusable to the PC (red in the inventory), use in combination with the "NWNX_ON_VALIDATE_USE_ITEM_*" events.
@note If the BEFORE event is not skipped, BEFORE_RESULT is the value of running the function normally. Otherwise, this is the set result value.
_______________________________________
## Item Equip Events
- NWNX_ON_ITEM_EQUIP_BEFORE
- NWNX_ON_ITEM_EQUIP_AFTER
`OBJECT_SELF` = The creature equipping the item
Event Data Tag | Type | Notes |
----------------------|--------|-------|
ITEM | object | Convert to object with StringToObject()|
SLOT | int | |
_______________________________________
## Item Unequip Events
- NWNX_ON_ITEM_UNEQUIP_BEFORE
- NWNX_ON_ITEM_UNEQUIP_AFTER
`OBJECT_SELF` = The creature unequipping the item
Event Data Tag | Type | Notes
----------------------|--------|-------
ITEM | object | Convert to object with StringToObject()
@note These events do not trigger when equipment is replaced by equipping another item.
_______________________________________
## Item Destroy Events
- NWNX_ON_ITEM_DESTROY_OBJECT_BEFORE
- NWNX_ON_ITEM_DESTROY_OBJECT_AFTER
- NWNX_ON_ITEM_DECREMENT_STACKSIZE_BEFORE
- NWNX_ON_ITEM_DECREMENT_STACKSIZE_AFTER
`OBJECT_SELF` = The item triggering the event
@note Use of `NWNX_ON_ITEM_(DESTROY_OBJECT|DECREMENT_STACKSIZE)_*` conflicts with object event handler profiling
_______________________________________
## Item Use Lore To Identify Events
- NWNX_ON_ITEM_USE_LORE_BEFORE
- NWNX_ON_ITEM_USE_LORE_AFTER
`OBJECT_SELF` = The player attempting to identify an item with their lore skill
Event Data Tag | Type | Notes
----------------------|--------|-------
ITEM | object |Convert to object with StringToObject()
_______________________________________
## Item Pay To Identify Events
- NWNX_ON_ITEM_PAY_TO_IDENTIFY_BEFORE
- NWNX_ON_ITEM_PAY_TO_IDENTIFY_AFTER
`OBJECT_SELF` = The player attempting to pay to identify an item
Event Data Tag | Type | Notes
----------------------|--------|-------
ITEM | object | Convert to object with StringToObject()
STORE | object | Convert to object with StringToObject()
_______________________________________
## Item Split Events
- NWNX_ON_ITEM_SPLIT_BEFORE
- NWNX_ON_ITEM_SPLIT_AFTER
`OBJECT_SELF` = The player attempting to split an item
Event Data Tag | Type | Notes|
----------------------|--------|-------|
ITEM | object | Convert to object with StringToObject()|
NUMBER_SPLIT_OFF | int | |
_______________________________________
## Acquire Item Events
- NWNX_ON_ITEM_ACQUIRE_BEFORE
- NWNX_ON_ITEM_ACQUIRE_AFTER
`OBJECT_SELF` = The creature trying to acquire the item
Event Data Tag | Type | Notes |
----------------------|--------|-------|
ITEM | object | Convert to object with StringToObject() (May be OBJECT_INVALID in the AFTER event) |
GIVER | object | Convert to object with StringToObject() (will be INVALID if picked up from ground)|
RESULT | int | Returns TRUE in the _AFTER if the acquisition was successful, FALSE otherwise
@note This event currently only works with creatures
_______________________________________
## Feat Use Events
- NWNX_ON_USE_FEAT_BEFORE
- NWNX_ON_USE_FEAT_AFTER
`OBJECT_SELF` = The object using the feat
Event Data Tag | Type | Notes |
----------------------|--------|-------|
FEAT_ID | int | |
SUBFEAT_ID | int | |
TARGET_OBJECT_ID | object | Convert to object with StringToObject() |
AREA_OBJECT_ID | object | Convert to object with StringToObject() |
TARGET_POSITION_X | float | |
TARGET_POSITION_Y | float | |
TARGET_POSITION_Z | float | |
ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events
_______________________________________
## Has Feat Events
- NWNX_ON_HASFEAT_BEFORE
- NWNX_ON_HAS_FEAT_AFTER
`OBJECT_SELF` = The player being checked for the feat
Event Data Tag | Type | Notes |
----------------------|--------|-------|
FEAT_ID | int | |
HAS_FEAT | int | Whether they truly have the feat or not |
@note This event should definitely be used with the Event ID Whitelist, which is turned on by default
for this event. Until you add your Feat ID to the whitelist on module load this event will not function.
For example if you wish an event to fire when nwn is checking if the creature has Epic Dodge you would perform
If you want to skip this, you need to make sure oWeaponOld != oWeaponNew
_______________________________________
## Effect Applied/Removed Events
- NWNX_ON_EFFECT_APPLIED_BEFORE
- NWNX_ON_EFFECT_APPLIED_AFTER
- NWNX_ON_EFFECT_REMOVED_BEFORE
- NWNX_ON_EFFECT_REMOVED_AFTER
`OBJECT_SELF` = The target of the effect
Event Data Tag | Type | Notes |
----------------------|--------|-------|
UNIQUE_ID | int | |
CREATOR | object | Convert to object with StringToObject() |
TYPE | int | The effect type, does not match NWScript constants See: https://github.com/nwnxee/unified/blob/master/NWNXLib/API/Constants/Effect.hpp#L8 |
SUB_TYPE | int | SUBTYPE_* |
DURATION_TYPE | int | DURATION_TYPE_* |
DURATION | float | |
SPELL_ID | int | |
CASTER_LEVEL | int | |
CUSTOM_TAG | string | |
INT_PARAM_* | int | * = 1-8 |
FLOAT_PARAM_* | float | * = 1-4 |
STRING_PARAM_* | string | * = 1-6 |
OBJECT_PARAM_* | object | * = 1-4, Convert to object with StringToObject() |
@note Only fires for Temporary or Permanent effects, does not include VisualEffects or ItemProperty effects.
_______________________________________
## Quickchat Events
- NWNX_ON_QUICKCHAT_BEFORE
- NWNX_ON_QUICKCHAT_AFTER
`OBJECT_SELF` = The player using the quick chat command
Event Data Tag | Type | Notes
----------------------|--------|-------
QUICKCHAT_COMMAND | int | `VOICE_CHAT_*` constants
_______________________________________
## Inventory Open Events
- NWNX_ON_INVENTORY_OPEN_BEFORE
- NWNX_ON_INVENTORY_OPEN_AFTER
`OBJECT_SELF` = The player opening the inventory
Event Data Tag | Type | Notes
----------------------|--------|-------
TARGET_INVENTORY | object | Pretty sure this is always the player
_______________________________________
## Inventory Select Panel Events
- NWNX_ON_INVENTORY_SELECT_PANEL_BEFORE
- NWNX_ON_INVENTORY_SELECT_PANEL_AFTER
`OBJECT_SELF` = The player changing inventory panels
Event Data Tag | Type | Notes
----------------------|--------|-------
CURRENT_PANEL | int | The current panel, index starts at 0
SELECTED_PANEL | int | The selected panel, index starts at 0
_______________________________________
## Barter Start Events
- NWNX_ON_BARTER_START_BEFORE
- NWNX_ON_BARTER_START_AFTER
`OBJECT_SELF` = The player who initiated the barter
Event Data Tag | Type | Notes
----------------------|--------|-------
BARTER_TARGET | object | The other player involved in the barter
_______________________________________
## Barter End Events
- NWNX_ON_BARTER_END_BEFORE
- NWNX_ON_BARTER_END_AFTER
`OBJECT_SELF` = The player who initiated the barter
Event Data Tag | Type | Notes
------------------------------|--------|-------
BARTER_TARGET | object | The other player involved in the barter
BARTER_COMPLETE | int | TRUE/FALSE - whether the barter completed successfully
BARTER_INITIATOR_ITEM_COUNT | int | How many items the initiator traded away, only in _BEFORE events
BARTER_TARGET_ITEM_COUNT | int | How many items the target traded away, only in _BEFORE events
BARTER_INITIATOR_ITEM_* | object | Convert to object with StringToObject(), only in _BEFORE events
BARTER_TARGET_ITEM_* | object | Convert to object with StringToObject(), only in _BEFORE events
_______________________________________
## Trap Events
- NWNX_ON_TRAP_DISARM_BEFORE
- NWNX_ON_TRAP_DISARM_AFTER
- NWNX_ON_TRAP_ENTER_BEFORE
- NWNX_ON_TRAP_ENTER_AFTER
- NWNX_ON_TRAP_EXAMINE_BEFORE
- NWNX_ON_TRAP_EXAMINE_AFTER
- NWNX_ON_TRAP_FLAG_BEFORE
- NWNX_ON_TRAP_FLAG_AFTER
- NWNX_ON_TRAP_RECOVER_BEFORE
- NWNX_ON_TRAP_RECOVER_AFTER
- NWNX_ON_TRAP_SET_BEFORE
- NWNX_ON_TRAP_SET_AFTER
`OBJECT_SELF` = The creature performing the trap action
Event Data Tag | Type | Notes
----------------------|--------|-------
TRAP_OBJECT_ID | object | Convert to object with StringToObject()
TRAP_FORCE_SET | int | TRUE/FALSE, only in ENTER events
ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events (not ENTER)
_______________________________________
## Timing Bar Events
- NWNX_ON_TIMING_BAR_START_BEFORE
- NWNX_ON_TIMING_BAR_START_AFTER
- NWNX_ON_TIMING_BAR_STOP_BEFORE
- NWNX_ON_TIMING_BAR_STOP_AFTER
- NWNX_ON_TIMING_BAR_CANCEL_BEFORE
- NWNX_ON_TIMING_BAR_CANCEL_AFTER
`OBJECT_SELF` = The player the timing bar is for
Event Data Tag | Type | Notes
----------------------|--------|-------
EVENT_ID | int | The type of timing bar, see constants below, only in _START_ events
DURATION | int | Length of time (in milliseconds) the bar is set to last, only in _START_ events
_______________________________________
## Webhook Events
- NWNX_ON_WEBHOOK_SUCCESS
- NWNX_ON_WEBHOOK_FAILURE
`OBJECT_SELF` = The module object
Event Data Tag | Type | Notes |
----------------------|--------|-------|
STATUS | int | The return code after posting to the server |
MESSAGE | string | The full constructed message sent |
HOST | string | |
PATH | string | |
RATELIMIT_LIMIT | int | Discord: The number of requests that can be made in a limited period |
RATELIMIT_REMAINING | int | Discord: The number of remaining requests that can be made before rate limited |
RATELIMIT_RESET | int | Discord: Timestamp when the rate limit resets |
RETRY_AFTER | float | Milliseconds until another webhook is allowed when rate limited |
FAIL_INFO | string | The reason the hook failed aside from rate limits |
@note Requires @ref webhook "NWNX_WebHook" plugin to work.
PLAYER_NAME | string | Player name of the connecting client
CDKEY | string | Public cdkey of the connecting client
LEGACY_CDKEY | string | Public cdkey from earlier versions of NWN
IS_DM | int | Whether the client is connecting as DM (1/0)
@note Skipping the _BEFORE event will cause no player names to be accepted unless you SetEventResult("1")
_______________________________________
## Server Character Save Events
- NWNX_ON_SERVER_CHARACTER_SAVE_BEFORE
- NWNX_ON_SERVER_CHARACTER_SAVE_AFTER
`OBJECT_SELF` = The player character being saved.
@note This is called once for every character when the server is exiting and when the server is saved, or when ExportSingleCharacter() & ExportAllCharacters() is called.
_______________________________________
## Export Character Events
- NWNX_ON_CLIENT_EXPORT_CHARACTER_BEFORE
- NWNX_ON_CLIENT_EXPORT_CHARACTER_AFTER
`OBJECT_SELF` = The player
Note: This event runs when the player clicks the "Save Character" button in the options menu to export their character to their localvault.
_______________________________________
## Levelling Events
- NWNX_ON_LEVEL_UP_BEFORE
- NWNX_ON_LEVEL_UP_AFTER
- NWNX_ON_LEVEL_UP_AUTOMATIC_BEFORE
- NWNX_ON_LEVEL_UP_AUTOMATIC_AFTER
- NWNX_ON_LEVEL_DOWN_BEFORE
- NWNX_ON_LEVEL_DOWN_AFTER
`OBJECT_SELF` = The creature levelling up or down, automatic is for henchmen levelling
_______________________________________
## Container Change Events
- NWNX_ON_INVENTORY_ADD_ITEM_BEFORE
- NWNX_ON_INVENTORY_ADD_ITEM_AFTER
- NWNX_ON_INVENTORY_REMOVE_ITEM_BEFORE
- NWNX_ON_INVENTORY_REMOVE_ITEM_AFTER
@note NWNX_ON_INVENTORY_REMOVE_ITEM_* is not skippable
`OBJECT_SELF` = The container
Event Data Tag | Type | Notes
----------------------|--------|-------
ITEM | object | Convert to object with StringToObject()
_______________________________________
## Gold Events
- NWNX_ON_INVENTORY_ADD_GOLD_BEFORE
- NWNX_ON_INVENTORY_ADD_GOLD_AFTER
- NWNX_ON_INVENTORY_REMOVE_GOLD_BEFORE
- NWNX_ON_INVENTORY_REMOVE_GOLD_AFTER
`OBJECT_SELF` = The creature gaining or losing gold
Event Data Tag | Type | Notes
----------------------|--------|-------
GOLD | int | The amount of gold added or removed
@warning While these events are skippable, you should be very careful about doing so.
It's very easy to create situations where players can dupe their gold or worse.
_______________________________________
## PVP Attitude Change Events
- NWNX_ON_PVP_ATTITUDE_CHANGE_BEFORE
- NWNX_ON_PVP_ATTITUDE_CHANGE_AFTER
`OBJECT_SELF` = The player performing the attitude change
Event Data Tag | Type | Notes
----------------------|--------|-------
TARGET_OBJECT_ID | object | Convert to object with StringToObject()
ATTITUDE | int | 0 = Dislike, 1 = Like
_______________________________________
## Input Walk To Events
- NWNX_ON_INPUT_WALK_TO_WAYPOINT_BEFORE
- NWNX_ON_INPUT_WALK_TO_WAYPOINT_AFTER
`OBJECT_SELF` = The player clicking somewhere to move
Event Data Tag | Type | Notes |
----------------------|--------|-------|
AREA | object | Convert to object with StringToObject() |
POS_X | float | |
POS_Y | float | |
POS_Z | float | |
RUN_TO_POINT | int | TRUE if player is running, FALSE if player is walking (eg when shift clicking) |
_______________________________________
## Material Change Events
- NWNX_ON_MATERIALCHANGE_BEFORE
- NWNX_ON_MATERIALCHANGE_AFTER
`OBJECT_SELF` = The creature walking on a different surface material
Event Data Tag | Type | Notes
----------------------|--------|-------
MATERIAL_TYPE | int | See surfacemat.2da for values
@note: After a PC transitions to a new area, a surface material change event
won't fire until after the PC moves.
_______________________________________
## Input Attack Events
- NWNX_ON_INPUT_ATTACK_OBJECT_BEFORE
- NWNX_ON_INPUT_ATTACK_OBJECT_AFTER
`OBJECT_SELF` = The creature attacking
Event Data Tag | Type | Notes
----------------------|--------|-------
TARGET | object | Convert to object with StringToObject()
PASSIVE | int | TRUE / FALSE
CLEAR_ALL_ACTIONS | int | TRUE / FALSE
ADD_TO_FRONT | int | TRUE / FALSE
_______________________________________
## Input Force Move To Events
- NWNX_ON_INPUT_FORCE_MOVE_TO_OBJECT_BEFORE
- NWNX_ON_INPUT_FORCE_MOVE_TO_OBJECT_AFTER
`OBJECT_SELF` = The creature forcibly moving
Event Data Tag | Type | Notes
----------------------|--------|-------
TARGET | object | Convert to object with StringToObject()
_______________________________________
## Input Cast Spell Events
- NWNX_ON_INPUT_CAST_SPELL_BEFORE
- NWNX_ON_INPUT_CAST_SPELL_AFTER
`OBJECT_SELF` = The creature casting a spell
Event Data Tag | Type | Notes
----------------------|--------|-------
TARGET | object | Convert to object with StringToObject()
SPELL_ID | int |
MULTICLASS | int |
DOMAIN_LEVEL | int |
META_TYPE | int |
INSTANT | int | TRUE / FALSE
PROJECTILE_PATH | int |
SPONTANEOUS | int | TRUE / FALSE
FAKE | int | TRUE / FALSE
FEAT | int | -1 when not cast from a feat
CASTER_LEVEL | int |
IS_AREA_TARGET | int | TRUE / FALSE
POS_X | float |
POS_Y | float |
POS_Z | float |
@note This event runs the moment a creature starts casting
_______________________________________
## Input Keyboard Events
- NWNX_ON_INPUT_KEYBOARD_BEFORE
- NWNX_ON_INPUT_KEYBOARD_AFTER
`OBJECT_SELF` = The player
Event Data Tag | Type | Notes
----------------------|--------|-------
KEY | string | The key pressed by the player, one of the following: W A S D Q E
@note To stop the player from moving you can do something like below, since normal immobilizing effects stop the client
PAUSE_STATE | int | TRUE = Pausing, FALSE = Unpausing
@note This event also fires when a non-dm player presses the spacebar.
_______________________________________
## Object Lock Events
- NWNX_ON_OBJECT_LOCK_BEFORE
- NWNX_ON_OBJECT_LOCK_AFTER
`OBJECT_SELF` = The object doing the locking
Event Data Tag | Type | Notes
----------------------|--------|-------
DOOR | object | Convert to object with StringToObject()
ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events
_______________________________________
## Object Unlock Events
- NWNX_ON_OBJECT_UNLOCK_BEFORE
- NWNX_ON_OBJECT_UNLOCK_AFTER
`OBJECT_SELF` = The object doing the unlocking
Event Data Tag | Type | Notes
----------------------|--------|-------
DOOR | object | Convert to object with StringToObject()
THIEVES_TOOL | object | Convert to object with StringToObject()
ACTIVE_PROPERTY_INDEX | int |
ACTION_RESULT | int | TRUE/FALSE, only in _AFTER events
_______________________________________
## UUID Collision Events
- NWNX_ON_UUID_COLLISION_BEFORE
- NWNX_ON_UUID_COLLISION_AFTER
`OBJECT_SELF` = The object that caused the UUID collision
Event Data Tag | Type | Notes
----------------------|--------|-------
UUID | string | The UUID
Note: To get the existing object with `UUID` you can use GetObjectByUUID(), be aware that this event runs before the
object is added to the world which means many functions (for example `GetArea(OBJECT_SELF)`) will not work.
_______________________________________
## Resource Events
- NWNX_ON_RESOURCE_ADDED
- NWNX_ON_RESOURCE_REMOVED
- NWNX_ON_RESOURCE_MODIFIED
`OBJECT_SELF` = The module
Event Data Tag | Type | Notes
----------------------|--------|-------
ALIAS | string | NWNX for /nwnx, DEVELOPMENT for /development. Also supports valid aliases from the Custom Resman Definition File
RESREF | string | The ResRef of the file
TYPE | int | The type of the file, see NWNX_UTIL_RESREF_TYPE_*
Note: These events fire when a file gets added/removed/modified in resource folders like /nwnx, /development and those defined in the Custom Resman Definition File
_______________________________________
## ELC Events
- NWNX_ON_ELC_VALIDATE_CHARACTER_BEFORE
- NWNX_ON_ELC_VALIDATE_CHARACTER_AFTER
`OBJECT_SELF` = The player
Note: NWNX_ELC must be loaded for these events to work. The `_AFTER` event only fires if the character successfully
completes validation.
_______________________________________
## Quickbar Events
- NWNX_ON_QUICKBAR_SET_BUTTON_BEFORE
- NWNX_ON_QUICKBAR_SET_BUTTON_AFTER
`OBJECT_SELF` = The player
Event Data Tag | Type | Notes
----------------------|--------|-------
BUTTON | int | The quickbar button slot, 0-35
TYPE | int | The type of quickbar button set, see NWNX_PLAYER_QBS_TYPE_* in nwnx_player_qbs.nss
Note: Skipping the event does not prevent the client from changing the button clientside, the change won't however
be saved to the bic file.
_______________________________________
## Calendar Events
- NWNX_ON_CALENDAR_HOUR
- NWNX_ON_CALENDAR_DAY
- NWNX_ON_CALENDAR_MONTH
- NWNX_ON_CALENDAR_YEAR
- NWNX_ON_CALENDAR_DAWN
- NWNX_ON_CALENDAR_DUSK
`OBJECT_SELF` = The module
Event Data Tag | Type | Notes
----------------------|--------|-------
OLD | int | The (Hour/Day/Month/Year) before the change. Not available in DAWN/DUSK.
NEW | int | The (Hour/Day/Month/Year) after the change. Not available in DAWN/DUSK.
_______________________________________
## Broadcast Spell Cast Events
- NWNX_ON_BROADCAST_CAST_SPELL_BEFORE
- NWNX_ON_BROADCAST_CAST_SPELL_AFTER
`OBJECT_SELF` = The creature casting the spell
Event Data Tag | Type | Notes |
----------------------|--------|-------|
SPELL_ID | int | |
MULTI_CLASS | int | |
FEAT | int | 65535 if a feat wasn't used, otherwise the feat ID |
_______________________________________
## RunScript Debug Event
- NWNX_ON_DEBUG_RUN_SCRIPT_BEFORE
- NWNX_ON_DEBUG_RUN_SCRIPT_AFTER
`OBJECT_SELF` = The player executing the RunScript debug command
Event Data Tag | Type | Notes |
----------------------|--------|-------|
SCRIPT_NAME | string | The script to execute |
TARGET | object | The target to run the script on. Convert to object with StringToObject() |
@note This event also runs for players that do not have permission to execute the command.
_______________________________________
## RunScriptChunk Debug Event
- NWNX_ON_DEBUG_RUN_SCRIPT_CHUNK_BEFORE
- NWNX_ON_DEBUG_RUN_SCRIPT_CHUNK_AFTER
`OBJECT_SELF` = The player executing the RunScriptChunk debug command
Event Data Tag | Type | Notes |
----------------------|--------|-------|
SCRIPT_CHUNK | string | The script chunk |
TARGET | object | The target to run the script chunk on. Convert to object with StringToObject() |
WRAP_INTO_MAIN | int | TRUE if the WrapIntoMain checkbox is checked, otherwise FALSE |
@note This event also runs for players that do not have permission to execute the command.
_______________________________________
## Buy/Sell Store Events
- NWNX_ON_STORE_REQUEST_BUY_BEFORE
- NWNX_ON_STORE_REQUEST_BUY_AFTER
- NWNX_ON_STORE_REQUEST_SELL_BEFORE
- NWNX_ON_STORE_REQUEST_SELL_AFTER
`OBJECT_SELF` = The creature buying or selling an item
Event Data Tag | Type | Notes |
----------------------|--------|-------|
ITEM | object | The item being bought or sold. Convert to object with StringToObject() |
STORE | object | The store the item is being sold to or bought from. Convert to object with StringToObject() |
PRICE | int | The buy or sell price |
RESULT | int | TRUE/FALSE whether the request was successful. Only in *_AFTER events.
_______________________________________
## Server Send Area Events
- NWNX_ON_SERVER_SEND_AREA_BEFORE
- NWNX_ON_SERVER_SEND_AREA_AFTER
`OBJECT_SELF` = The player
Event Data Tag | Type | Notes
----------------------|--------|-------
AREA | object | The area the server is sending. Convert to object with StringToObject() |
PLAYER_NEW_TO_MODULE | int | TRUE if it's the player's first time logging into the server since a restart |
_______________________________________
## Journal Open/Close Events
- NWNX_ON_JOURNAL_OPEN_BEFORE
- NWNX_ON_JOURNAL_OPEN_AFTER
- NWNX_ON_JOURNAL_CLOSE_BEFORE
- NWNX_ON_JOURNAL_CLOSE_AFTER
`OBJECT_SELF` = The player
Event Data Tag | Type | Notes
----------------------|--------|-------
_______________________________________
## Input Emote Event
- NWNX_ON_INPUT_EMOTE_BEFORE
- NWNX_ON_INPUT_EMOTE_AFTER
`OBJECT_SELF` = The creature using a radial menu emote
Event Data Tag | Type | Notes
----------------------|--------|-------
ANIMATION | int | An engine animation constant, convent to NWScript animation constant with NWNX_Consts_TranslateEngineAnimation() |
@note Some emotes have a voiceline that will still play when the event is skipped. These voicelines can be skipped in the NWNX_ON_QUICKCHAT_* event.
_______________________________________
*/
/*
const int NWNX_EVENTS_OBJECT_TYPE_CREATURE = 5;
const int NWNX_EVENTS_OBJECT_TYPE_ITEM = 6;
const int NWNX_EVENTS_OBJECT_TYPE_TRIGGER = 7;
const int NWNX_EVENTS_OBJECT_TYPE_PLACEABLE = 9;
const int NWNX_EVENTS_OBJECT_TYPE_WAYPOINT = 12;
const int NWNX_EVENTS_OBJECT_TYPE_ENCOUNTER = 13;
const int NWNX_EVENTS_OBJECT_TYPE_PORTAL = 15;
*/
/*
const int NWNX_EVENTS_TIMING_BAR_TRAP_FLAG = 1;
const int NWNX_EVENTS_TIMING_BAR_TRAP_RECOVER = 2;
const int NWNX_EVENTS_TIMING_BAR_TRAP_DISARM = 3;
const int NWNX_EVENTS_TIMING_BAR_TRAP_EXAMINE = 4;
const int NWNX_EVENTS_TIMING_BAR_TRAP_SET = 5;
const int NWNX_EVENTS_TIMING_BAR_REST = 6;
const int NWNX_EVENTS_TIMING_BAR_UNLOCK = 7;
const int NWNX_EVENTS_TIMING_BAR_LOCK = 8;
const int NWNX_EVENTS_TIMING_BAR_CUSTOM = 10;
*/
/// @brief Scripts can subscribe to events.
///
/// Some events are dispatched via the NWNX plugin (see NWNX_EVENTS_EVENT_* constants).
/// Others can be signalled via script code via NWNX_Events_SignalEvent().
/// @param evt The event name.
/// @param script The script to call when the event fires.