Maris Posted April 12, 2015 Share Posted April 12, 2015 Let's talk about events in inventoryitem component. There are 4 events: pickup, drop, activeitem and putininventory. When they are triggered?OnPutInInventory OnDropped OnActiveItem OnPickup, OnPutInInventory (first Pickup, then PutInInventory) OnPickup, OnPutInInventory, OnActiveItem OnPickup, OnDropped, OnPutInInventory, OnActiveItemSo when?OnPutInInventoryWhen item is moved to container, inventory or backpackWhen item is equippedWhen item is moved to mouse cursor except moving directly from equipped slot OnDropped When item is dropped on the ground (obvious) When item is picked up from the ground in mouse cursor (if no free cell in inventory)OnActiveItem Only when item is moved to cursorOnPickup When item is moved to inventory (not backpack), obvious When item is moved to cursor, except moving directly from equipped slotWhen item is moved to container, except moving directly from cursor Thank you for reading. Link to comment Share on other sites More sharing options...
Maris Posted July 13, 2015 Author Share Posted July 13, 2015 Notice that any backpack is a container! So if you put item to backpack, OnPutInInventory occurs.But OnPutInInventory function is taking backpack instance as parameter (not character instance).And if character drops the backpack, there are no events for the item. Link to comment Share on other sites More sharing options...
DarkXero Posted July 13, 2015 Share Posted July 13, 2015 OnPutInInventory is what OnPickup should be. OnPickup is useless for items that can be equipped on pickup..OnPutInInventory beats OnPickup on this. OnDropped and OnPickup should destroy/change the item if they have positive effects because then it would be exploitable.Like +5 sanity on pickup. Drop/pickup for free sanity. Flowers destroy themselves and give the player petals. OnActiveItem is pretty much useless.There is not a single prefab that uses SetOnActiveItemFn, or that changes activeitemfn. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now