To save an int in beteween rounds the best I can come up with is at the end of a round grant all players some item, like a plant or crystal. Go in the round settings device and set Keep items in between rounds.
WHen the new round starts use conditional buttons to check which item the player has.
This method only works if you want to save a small int, like <50. Because you would need 50 conditional buttons and 50 item granters for this
Unfortunately the score manager doesn’t keep track of the score between rounds (I assume that’s what you were referencing to)
And the workflow with conditional buttons is an interesting one, but that’ll be a bit too much to manage.
Oh well, I’ll keep digging ideas on how I can achieve this result.
Thanks again
Then I don’t think you can save an int in between rounds. I have tried many things like using a tracker or timer but did not work, so went back to the old days of using the conditional buttons like we did years ago.
I did not refer the the score manager. I mean you can save the score in a save point device, and load it in the next round. But I dont know if the save point works in UEFN
The save point is a disallowed object. How would you make it so all items can be dropped but the item used for tracking? and when a player dies in the game, how would they drop everything but the item used for tracking?
# Track round number for this session
var RoundNumberMap : weak_map(session, int) = map{}
OnBegin<override>()<suspends>:void=
# Set round number for each session
Session := GetSession()
if(RoundNumber := RoundNumberMap[Session]):
if(set RoundNumberMap[Session] += 1):
Print("Current Round Number: {RoundNumber+1}", ?Duration := 5.0)
else:
if(set RoundNumberMap[Session] = 1):
Print("Initialize Round Number to 1", ?Duration := 5.0)
However, you cannot save the player variable in the global variable. You will encounter Verse runtime error if you try to retrieve the player variable in the next round. That means there is no way to know which data belongs to which player. Hope this helps.
I was trying out this code, but it still seems to forget value after a round. Any additional insights you can share?
I’m trying to make a scoreboard that increments on elimination and consistent between rounds.
The score increases correctly, but after a round, the score is reset again
var ScoreTeamOne : weak_map(session, int) = map{}
var ScoreTeamTwo : weak_map(session, int) = map{}
HUDScoreboard := class(creative_device):
@editable EM_eliminationManager_TeamOne :elimination_manager_device = elimination_manager_device {}
@editable EM_eliminationManager_TeamTwo :elimination_manager_device = elimination_manager_device {}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
Print("TEST DEVICE")
EM_eliminationManager_TeamOne.EliminatedEvent.Subscribe(PlayerEliminatedTeamOne)
EM_eliminationManager_TeamTwo.EliminatedEvent.Subscribe(PlayerEliminatedTeamTwo)
PlayerEliminatedTeamOne(Agent : agent) : void =
X := if (Y := ScoreTeamOne[GetSession()]) then Y + 1 else 1
if:
set ScoreTeamOne[GetSession()] = X
Print("Elminated Team 1: {X}")
PlayerEliminatedTeamTwo(Agent : agent) : void =
X := if (Y := ScoreTeamTwo[GetSession()]) then Y + 1 else 1
if:
set ScoreTeamTwo[GetSession()] = X
Print("Elminated Team 2: {X}")
A session is specific to a round and not persistent over rounds.
Type for which there is a single instance per round. Use GetSession to get the current round’s session instance. May be used with weak_map to implement global variables. Note: may be changed in a future release to a single instance per game. Round-local behavior should not be relied upon.