Summary
After 44.00, item_component.ChangeInventoryEvent doesn’t fire when you drop an item. This is breaking for custom items & weapons, as custom components made for them do not trigger logic when the weapon is dropped. Here is the affected code, and the behavior in game. The code is supposed to print “InventoryChanged: custom_weapon_effects_component”.
using { /Verse.org/Presentation }
using { /Verse.org/SceneGraph }
using { /Verse.org/Simulation }
using { /Fortnite.com/Itemization }
custom_weapon_effects_component := class<final_super>(component) :
var InventoryEventHandler : ?cancelable = false
OnAddedToScene<override>():void =
if:
ItemComp:=Entity.GetComponent[item_component]
not InventoryEventHandler?
then:
set InventoryEventHandler = option{ItemComp.ChangeInventoryEvent.Subscribe(OnInventoryChanged)}
SetMaterialEffects(Status : float):void=
{}#Functional code removed on purpose, didn't affect the inventory changed issue
OnInventoryChanged(Result:change_inventory_result):void=
Print("InventoryChanged: custom_weapon_effects_component")
#Other functional code hidden on purpose
OnRemovingFromScene<override>():void ={}
# if(InventoryEventHandler?.Cancel()):
# set InventoryEventHandler = false
#Canceling the subscription was commented out because it was causing issues in the past.
Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Scene Graph
Steps to Reproduce
Copy my code, place the component into a custom item (possibly a weapon template), place the item in the level, pick it up, drop it.
Expected Result
The ChangeInventoryEvent fires both when picking up the item and dropping it.
Observed Result
The ChangeInventoryEvent only fires when picking up the item.
Platform(s)
windows
Island Code
1316-2698-6957
Video
Additional Notes
I don’t know if I’m doing something wrong in my code, this worked fine before 44.00. I even removed the subscription .Cancel because I was having issues in the past, so the subscription should fire correctly. If I add a fort_item_pickup_component instead of my custom interactable one, which stopped working, I can pickup the item, and when I do, the event fires correctly every time. But when I drop the item, it doesn’t.