Running a script whenever the inventory of a unit changes

I am trying to run a script every time a unit's inventory changes.

I tried to create a lua ability and use the 'OnInventoryContentsChanged()' event, but that is not working. Before I post my attempt for scrutiny, I'd first like to affirm if 'OnInventoryContentsChanged()' even works, since in my research I found only one mention of it, and that was to say that it is 'gone', whatever that means.

If 'OnInventoryContentsChanged()' does not work, how would I accomplish what I want to do? Would I simply need to run a constant check of the unit's inventory every 0.01 seconds (or something equally dumb)?

Thank you for your time and feedback!

Comments