I’ve made a revive HUD that I display when my players are dead, they can revive using a specific item if they have it.
Problem is that calling GetItemCount()
on a dead player seem to always return -1
I think this is the same issue that prevents you from calling conditional_button_device.Activate()
that should consume an item on a dead player but won’t actually consume it (despite being able to grant items to them)
UPDATE: Calling it the exact frame the player dies seem to work, for example :
# OnBegin
team_settings_and_inventory_device.TeamMemberEliminatedEvent.Subscribe(OnPlayerEliminated)
OnPlayerEliminated(Agent: agent) : void =
spawn:
CountItemsEachFrame(Agent)
CountItemsEachFrame(Agent: agent)<suspends>:void=
Print("{CanReviveConditionalButton.GetItemCount(Agent, 0)}") # Works
Sleep(0.0)
Print("{CanReviveConditionalButton.GetItemCount(Agent, 0)}") # -1
Sleep(0.0)
Print("{CanReviveConditionalButton.GetItemCount(Agent, 0)}") # -1
Sleep(0.0)
Print("{CanReviveConditionalButton.GetItemCount(Agent, 0)}") # -1
Sleep(0.0)