I'm trying to get players who have a custom item with item_component, but it's not working.
I want to know how to get players who have a custom item with item_component.
var InventoryToAgent : [inventory_component]agent = map{}
OnSimulate<override>()<suspends>:void =
if (Playspace := Entity.GetPlayspaceForEntity[]):
Players := Playspace.GetPlayers()
for(Player : Players, FC := Player.GetFortCharacter[]):
if(ItemComp := Entity.GetComponent[item_component]):
Print("ItemComp")
if(ParentInv := ItemComp.GetParentInventory[]):
Print("ParentInv")
if (Agent := InventoryToAgent[ParentInv]):
Print("Agent")
if(FC = Agent.GetFortCharacter[]):
Print("FC")