This expression in the right operand of ‘set … = …’ can fail, but the meaning of failure here will change in a future version of Verse. To preserve the current meaning of this code in future versions of Verse, you should move the expression that can fail outside the ‘set’.
For example, if you have the expression:
set Variable = ExpressionThatMightFail,
you can change it to the following two expressions to preserve the meaning:
Value := ExpressionThatMightFail
set Variable = Value
We are having the issue with the .Length part of the code. Do you know how I could rewrite this to make it work?
BalanceTeams() : void =
AllPlayers := GetPlayspace().GetPlayers()
for (TeamPlayer : AllPlayers, CurrentTeam := GetPlayspace().GetTeamCollection().GetTeam[TeamPlayer]):
# Assign Players to a new team if teams are unbalanced
var TeamSize:int = 0
if(set TeamSize = GetPlayspace().GetTeamCollection().GetAgents[CurrentTeam].Length):
Print("Size of this player's starting team is {TeamSize}")