How to keep my gold coins after each teleportation in Verse ?

Hey frero ! ahah

Here is my code :

EndRound1(TeleportedAgent: agent)<suspends> : void =
            # Calculer le seuil à atteindre
var ThresholdToReach: float = AllPlayersCount * 2.0
var PlayersTeleported1:float = PlayersTeleported * 1.0
var AllPlayers : []agent = GetPlayspace().GetPlayers()
var NonQualifiedPlayers : []player = array{}
            
if (PlayersTeleported1 >= ThresholdToReach):   
# Afficher le message HUD
   HUDMessageDevice.Show()
   TeleportDrop2.Disable()
   Sleep(7.0)  # Pause pour permettre au message d'être affiché
   set AllPlayers = AllPlayers


   set Teams = GetPlayspace().GetTeamCollection().GetTeams()
   var MaybeTeam4 : ?team = option{GetPlayspace().GetTeamCollection().GetTeams()[3]}

    if (ValidTeam4 := MaybeTeam4?):
        for (Player : GetPlayspace().GetPlayers()):
             MaybeFortCharacter : ?fort_character = option{Player.GetFortCharacter[]}
             if (ValidFortCharacter := MaybeFortCharacter?):
                MaybeAgent : ?agent = option{ValidFortCharacter.GetAgent[]}
                  if (ValidAgent := MaybeAgent?):
                     if (GetPlayspace().GetTeamCollection().IsOnTeam[ValidAgent , ValidTeam4]): 
                                       # Player is on Team4
                     TeleportDropR2_1.Teleport(Player)
                        else:
                     TeleportDropR2_2.Teleport(Player)

Please don’t judge my excessive indentation :pray: :laughing:

EDIT : No event biding on theses devices.

1 Like