Verse Code Acting Differently In UEFN Session Then Published Code?

So I’ve been working on a “Rapid” game-mode where I use a custom round system instead of the built in Fortnite one. The issue is, I ran into potentially a bug (or my code is wrong) when I test the map out in a published version.

So how its supposed to work (and does work in the UEFN edit session) is when my “made up” round starts, I disable spawnpads so that eliminated players will spectate. When it ends, I re-enable the spawnpads and run code that respawns all of the players (Not just spectators):

    RespawnPlayers():void=
        AllPlayers := GetPlayspace().GetPlayers()
        for (TeamPlayer:AllPlayers):
            TeamPlayer.Respawn(vector3{X:=-43674.66103,Y:=-36654.716304,Z:=3189.238969}, rotation{})

The location that players respawn in is into an elimination zone. This is so that the “game” can respawn them itself. The reason why I do this is because it seems to be a work-around for a bug with spectating. If a player is respawned through verse and not the game, you can’t spectate them until the game respawns them itself.

So, this works all fine and great while testing in the UEFN edit session, no bugs at all! The issue comes when we publish the island and test it out on a private island code.

Here is a video showcasing what happens in the edit session vs published island code, the end shows it side by side: https://youtu.be/wIvTCgJaewM?si=hpz_VvP9VwXXV-5X

To summarize what happens, it seems like the Respawn code only runs for players who are still alive, which negates the whole point. Not only that, but everything runs delayed compared to the edit session.

Can anyone think of any solution for this? Is there something I did wrong or do you think its a bug? I appreciate any help!

I’m having the same problem, did you solve it?

Whoops! Completely forgot about this thread :sweat_smile: :sweat_smile:

The solution ended up being a few things:

First off is server latency. Edit sessions run faster then live servers/published codes. So for me, adding the suspends effect to the RespawnPlayers() function and then adding a slight delay was a contributing factor to solving it.

Second, in my case, was .Respawn itself. What I did wrong in my initial code was attempt to respawn everyone regardless of there status (Alive or Spectating). What helped here was only respawning Spectating players. The issue was, at least at the time, is that .IsSpectator was completely broken (Which BTW is why I attempted to just Respawn everyone as a solution). Instead, I checked if the player was active and only respawning them if they weren’t:

                if (FortCharacter.IsActive[]) {}
                else:
                    InAgent.Respawn(RiftTeamSelected.GetTransform().Translation, rotation{})

Hope this helps!

2 Likes

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