Jump to content

Is there a way to handle event when an item is removed from an inventory/container?


Recommended Posts

I'm making a special container that will stop honey from perishing when put in. Thus, I need to stop honey from perishing when it's put in the container, and start perishing again when removed. The inventoryitem component allows me to do the put in one, but seems not to support the 'on removed' event. What I'm doing for now is wrapping and overwriting the OnRemoved function of inventoryitem for honey.

Does anyone know a better way to do so? If not, how to ask dev to support that? :(

Link to comment
Share on other sites

3 hours ago, renetta96 said:

I'm making a special container that will stop honey from perishing when put in. Thus, I need to stop honey from perishing when it's put in the container, and start perishing again when removed. The inventoryitem component allows me to do the put in one, but seems not to support the 'on removed' event. What I'm doing for now is wrapping and overwriting the OnRemoved function of inventoryitem for honey.

Does anyone know a better way to do so? If not, how to ask dev to support that? :(

there are other ways, yes. But if you overwrite that function, make sure to save the old funciton and call it within your new one. So you new function should only contain the preishness stuff and then simply call the old function. This way it is totally okay to overwrite the original function (cause you are calling the old one within yours new one).

The other way might be the "dropitem" event you see within container component. I see no reason why it should not work.
https://forums.kleientertainment.com/forums/topic/112777-need-help-with-wormhole-sanity-drain/?do=findComment&comment=1273080

 

Edited by Serpens
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
  • Create New...