nwnxee / unified

Binaries available under the Releases tab on Github
https://nwnxee.github.io/unified
GNU General Public License v3.0
131 stars 92 forks source link

Retrieve adding/removing object for NWNX_ON_INVENTORY_ADD/REMOVE events #826

Closed rinehardt closed 4 years ago

rinehardt commented 4 years ago

I've been experimenting with these 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 NWNX_Object_StringToObject()

And I was wondering if it would be possible to have the object that has added or removed the item in addition to the 'ITEM' parameter. It would make the events far more useful.

Daztek commented 4 years ago

Does GetItemPossessor(NWNX_Object_StringToObject(NWNX_Events_GetEventData("ITEM"))); in the _BEFORE event return anything useful?

rinehardt commented 4 years ago

Ah, that does seem to work. I thought I had already tried that function, but I was using the wrong one. Thanks.