Team Elimination Game tutorial error

Apparently there are two errors in the Team Elimination Game tutorial’s GiveNextWeapon function.

I dont know the language well enough to find a workaround.
Can any of you see what the issue is?

image

The line where they set WeaponTier is not allowed anymore, should be :

if(PlayerTeam := MaybePlayerTeam?, EliminatingPlayerTier:= TeamMap[PlayerTeam][EliminatingPlayer], set WeaponTier = EliminatingPlayerTier):

Same for the second one

I’m confused by what you mean the “same” for second one here. what does the second line look like when edited correctly? I’ve tried a few times and couldn’t work it out on my own.

Okay it took a second to understand but I have a version that compiles and seems to be working for the second line.

if(LowerPlayerTier := TeamMap[PlayerTeam][Teammate], WeaponTier = LowerPlayerTier):

If you’re struggling to understand it I highly recommend reading this article but I’ll do my best to give the TLDR;

This is the old code from part 5 of the tutorial:

 if(PlayerTeam := MaybePlayerTeam?, set WeaponTier = TeamMap[PlayerTeam][EliminatingPlayer]):
     for(Teammate -> TeammateTier : TeamMap[PlayerTeam], TeammateTier < WeaponTier):
         Print("Found a Teammate with a lower Tier at Tier {TeammateTier}")
         if(set WeaponTier = TeamMap[PlayerTeam][Teammate]):
             set MaybePlayerToGrant = option{Teammate}

And this is my updated code:

if(PlayerTeam := MaybePlayerTeam?, EliminatingPlayerTier:= TeamMap[PlayerTeam][EliminatingPlayer], set WeaponTier = EliminatingPlayerTier):

            for(Teammate -> TeammateTier : TeamMap[PlayerTeam], TeammateTier < WeaponTier):

                Print("Found a Teammate with a lower Tier at Tier {TeammateTier}")

                if(LowerPlayerTier := TeamMap[PlayerTeam][Teammate], WeaponTier = LowerPlayerTier):

                    set MaybePlayerToGrant = option{Teammate}

The difference you’ll see is that we’re not setting the weapon tier directly by accessing the TeamMap any longer.

In the original code block we see that we’re doing a set WeaponTier by going to the map and accessing the players team and players tier all in one statement. In the updated code we’re moving the failable code out of the set statement by creating a variable that accesses that same area so that if it fails the set statement doesn’t crash the program because set isn’t failable… at least that’s my best guess here. Please correct me if I’m wrong