In our game, we give player a weapon when the game start/when they join the game using Item Granter. We notice an issue specifically on player join a running session, they might not have their weapon. (nvm, it is extremely rare, but I found a case on launching player)
At first, we thought it might be the player is not in a good state, so I did a check to make sure the player has agent and fort_character all accessible before we give them weapon. It doesn’t seem to take care of most of the cases. However, we are still seeing player not having a weapon in some occasion. In the test, we can verify that it did called GrantItemIndex, but the player does not have the weapon.
I am wondering if this is a bug in item_granter_device? Any help will be appreciated!
SetFirstItem(Player:player)<suspends>:void=
var successed : logic := false
loop:
if(FortChar := Player.GetFortCharacter[], ThisAgent := FortChar.GetAgent[]):
ItemGranters.GrantItemIndex(ThisAgent,0)
Print("someone got there first weapon")
set successed = true
if(successed = true):
break
Print("someone joined but not ready for first weapon")
Sleep(0.1)