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 | |
@note This event does not run on login as the base game OnPlayerEquipItem event does. (Because this event hooks CNWSCreature::RunEquip which calls CNWSCreature::EquipItem. When the player character is first loaded, EquipItem is called directly.)
@note If the goal is to prevent items from being equiped under certain conditions, and since this event does not run on login, it could be helpful to additionally use NWNX_Creature_RunUnequip() in the OnClientEnter (or similar) event.
_______________________________________
## 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 | |
_______________________________________
## Item Merge Events
- NWNX_ON_ITEM_MERGE_BEFORE
- NWNX_ON_ITEM_MERGE_AFTER
`OBJECT_SELF` = The player attempting to merge an item
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
TARGET_OBJECT_ID | object | Convert to object with StringToObject(), only in SET events
TARGET_POSITION_X | float | Only in SET events
TARGET_POSITION_Y | float | Only in SET events
TARGET_POSITION_Z | float | Only in SET events
NEEDS_TO_MOVE | int | TRUE/FALSE, only in _BEFORE events (not ENTER), if TRUE another _BEFORE event will be fired before the actual interaction with the trap
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 |
@warning RESULT in NWNX_ON_STORE_REQUEST_BUY_AFTER only fails if it's due to lack of gold. It will not fail if item does not fit in player's inventory. If you want to check and fail on that condition, you can do something like this in the NWNX_ON_STORE_REQUEST_BUY_AFTER event:
```c
if (!GetBaseItemFitsInInventory(GetBaseItemType(oItem), oPlayer))
PROJECTILE_PATH_TYPE | int | @nwn{Projectile_path_type,PROJECTILE_PATH_TYPE_*} |
@note This event fires for all projectiles. It's recommended to use ID whitelists with this event. You can whitelist the event by the projectile type, spell id, or both:
`TARGET_OBJECT_ID` will be `OBJECT_INVALID` if the projectile is cast at a location
_______________________________________
## Broadcast Attack of Opportunity Events
- NWNX_ON_BROADCAST_ATTACK_OF_OPPORTUNITY_BEFORE
- NWNX_ON_BROADCAST_ATTACK_OF_OPPORTUNITY_AFTER
`OBJECT_SELF` = The creature broadcasting the Attack of Opportunity event
Event Data Tag | Type | Notes
----------------------|--------|-------
TARGET_OBJECT_ID | object | A single object the attack of opportunity is being broadcast to. Convert to object with StringToObject() |
MOVEMENT | int | Whether this attack of opportunity is being triggered from movement |
_______________________________________
## Combat Attack of Opportunity Events
- NWNX_ON_COMBAT_ATTACK_OF_OPPORTUNITY_BEFORE
- NWNX_ON_COMBAT_ATTACK_OF_OPPORTUNITY_AFTER
`OBJECT_SELF` = The creature performing the Attack of Opportunity against the broadcasting target.
Event Data Tag | Type | Notes
----------------------|--------|-------
TARGET_OBJECT_ID | object | The target of the attack of opportunity. Convert to object with StringToObject() |
@note If the BEFORE event is skipped the broadcasting creature will still make a tumble skill roll if moving.
_______________________________________
## Area Play Battle Music Events
- NWNX_ON_AREA_PLAY_BATTLE_MUSIC_BEFORE
- NWNX_ON_AREA_PLAY_BATTLE_MUSIC_AFTER
`OBJECT_SELF` = The area playing or stopping the battle music.
Event Data Tag | Type | Notes
----------------------|--------|-------
PLAY | int | TRUE if the area is starting to play battle music, FALSE if stopping. |
_______________________________________
## Combat Attack Target Change Events
- NWNX_ON_ATTACK_TARGET_CHANGE_BEFORE
- NWNX_ON_ATTACK_TARGET_CHANGE_AFTER
`OBJECT_SELF` = The creature changing the target its attacking.
Event Data Tag | Type | Notes
----------------------|--------|-------
OLD_TARGET_OBJECT_ID | object | The old attack target. OBJECT_INVALID if there was no old target. Old target may be dead/invalid. Convert to object with StringToObject() |
NEW_TARGET_OBJECT_ID | object | The new attack target. OBJECT_INVALID if there is no new target. Convert to object with StringToObject() |
AUTOMATIC_CHANGE | int | TRUE if the game automatically decided on the new target, FALSE if explicitly chosen |
RETARGETABLE | int | TRUE if the new target can be changed using NWNX_Events_SetEventResult() (Only in BEFORE) |
_______________________________________
## Creature Tile Change Events
- NWNX_ON_CREATURE_TILE_CHANGE_BEFORE
- NWNX_ON_CREATURE_TILE_CHANGE_AFTER
`OBJECT_SELF` = The creature changing tile positions.
Event Data Tag | Type | Notes
----------------------|--------|-------
OLD_TILE_INDEX | int | The index of the old tile. |
OLD_TILE_X | int | The tile grid x position of the old tile. |
OLD_TILE_Y | int | The tile grid y position of the old tile. |
NEW_TILE_INDEX | int | The index of the new tile. |
NEW_TILE_X | int | The tile grid x position of the new tile. |
NEW_TILE_Y | int | The tile grid y position of the new tile. |
_______________________________________
## Creature Jump To Point Events
- NWNX_ON_CREATURE_JUMP_TO_POINT_BEFORE
- NWNX_ON_CREATURE_JUMP_TO_POINT_AFTER
`OBJECT_SELF` = The creature jumping.
Event Data Tag | Type | Notes
----------------------|--------|-------
TARGET_AREA | object | The target area. Convert to object with StringToObject() |
POS_X | float | The x position the target is being moved to |
POS_Y | float | The y position the target is being moved to |
POS_Z | float | The z position the target is being moved to |
_______________________________________
## Creature Jump To Object Events
- NWNX_ON_CREATURE_JUMP_TO_OBJECT_BEFORE
- NWNX_ON_CREATURE_JUMP_TO_OBJECT_AFTER
`OBJECT_SELF` = The creature jumping.
Event Data Tag | Type | Notes
----------------------|--------|-------
OBJECT | object | The object the creature is jumping to. Convert to object with StringToObject() |
_______________________________________
## Item Property Effect Apply/Remove Events
- NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_BEFORE
- NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_AFTER
- NWNX_ON_ITEMPROPERTY_EFFECT_REMOVED_BEFORE
- NWNX_ON_ITEMPROPERTY_EFFECT_REMOVED_AFTER
`OBJECT_SELF` = The item source of the item property.
Event Data Tag | Type | Notes
----------------------|--------|-------
CREATURE | object | The creature to which Convert to object with StringToObject() |
LOADING_GAME | int | TRUE if the itemproperty is being applied when loading into the game and not due to equipping the item. |
INVENTORY_SLOT | int | The INVENTORY_SLOT_* the item is (un)equipped to/from. |
PROPERTY | int | The ITEM_PROPERTY_* type. |
SUBTYPE | int | The subtype of the itemproperty. |
TAG | string | The optional tag set by TagItemProperty() |
COST_TABLE | int | The index into iprp_costtable.2da |
COST_TABLE_VALUE | int | The index into the 2da pointed at by COST_TABLE |
PARAM1 | int | The index into iprp_paramtable.2da |
PARAM1_VALUE | int | The index into the 2da pointed at by PARAM1 |
@note These events fire when the game applies or removes the effects from an itemproperty.
Skipping NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_BEFORE will stop the basegame effects for that itemproperty to not be applied.
If you skip the application of ITEM_PROPERTY_BONUS_SPELL_SLOT_OF_LEVEL_N or ITEM_PROPERTY_UNLIMITED_AMMUNITION you must also skip its removal event.
@note Any non-DURATION_TYPE_INSTANT effects applied to the creature in NWNX_ON_ITEMPROPERTY_EFFECT_APPLIED_BEFORE **must** be of type DURATION_TYPE_EQUIPPED
See the `NWNX_EFFECT_EXTEND_DURATION_TYPE` environment variable in NWNX_Effect on how to enable this duration type.
@note See the NWNX_Events README.md for an example script!
@note The whitelist is enabled by default for these events, to whitelist a particular itemproperty, do the following:
/// - NWNX_ON_BROADCAST_SAFE_PROJECTILE -> NWNX_ON_BROADCAST_SAFE_PROJECTILE_TYPE for ProjectileType, NWNX_ON_BROADCAST_SAFE_PROJECTILE_SPELL for SpellID