How to end a round of Game with end_game_device on Verse?

Hi,

I would like to question how to use end_game_device on Verse code.
Please see the following code:

prop_teleport := class(creative_device):

    @editable
    EndRound<public> : end_game_device = end_game_device{}

    OnBegin<override>()<suspends>:void=
        Playspace: fort_playspace = GetPlayspace()
        AllPlayers: []player = Playspace.GetPlayers()

       for (Agent : AllPlayers):
            EndARound(Agent)

    EndARound<private>(Agent:agent)<suspends> : void =
        EndRound.Activate(Agent)

In my test, if the first playter exit this game, other player’s round never end (Maybe because the first player exit, the first loop of for cause Error and the later process is not executed.

How can I end a round even if any player in this game exit during Game playing?

Regards,

You’re trying to end the round as soon as the game begins… I’m not sure if the EGD is even properly instantiated at that point.

Either way, you wouldn’t put it in a loop, you’d find the player you want to be the agent to activate the device and then use just that one player. If there was only one player in the game and you ran that loop (not in the OnBegin) then it should end the round/game if you have hooked up the EGD in your editables and device.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.