Thanks for the response, I can say that I tried it and it still didn’t want to change the variable, I’ll try to be more in depth this time, it’s not the best code but I tried:
StartGame is called here in the class countdown_timer:
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }
using { /Fortnite.com/Devices }
using { /Fortnite.com/UI }
using { /Verse.org/Colors }
MakeCountdownTimer<constructor><public>(MaxTime : float, InPlayer : agent) := countdown_timer:
RemainingTime := MaxTime
MaybePlayerUI := option{GetPlayerUI[player[InPlayer]]}
countdown_timer := class(creative_device):
@editable
GameInfo : game_info = game_info{}
RunCountdown<private>()<suspends> : void =
loop:
Sleep(TimerTickPeriod)
set RemainingTime -= TimerTickPeriod
UpdateUI()
var PlayerCount : int = 0
for (PlayerNumber : GetPlayspace().GetPlayers()):
set PlayerCount += 1
var Waiting : countdown_timer_global = countdown_timer_global{}
if (PlayerCount < 1):
set RemainingTime = 0.0
if (RemainingTime <= 0.0):
if (PlayerCount >= 1):
GameInfo.StartGame() #HERE
RemainingTimeTextBlock.SetText(GameStartedText())
Sleep(2.0)
Canvas.RemoveWidget(RemainingTimeTextBlock)
if (UI := MaybePlayerUI?):
UI.RemoveWidget(Canvas)
if (PlayerCount < 1):
Waiting.WaitingForPlayers()
Print("There are {PlayerCount} players, not enough to start the game.")
break
UpdateUI<private>() : void =
if (IntTime := Int[RemainingTime]):
RemainingTimeTextBlock.SetText(RemainingTimeText(IntTime))
The StartGame function now looks something like this: (it’s in the game_info class)
using { /Fortnite.com/Devices }
using { /Fortnite.com/Playspaces }
using { /Verse.org/Native }
using { /Verse.org/Random }
using { /Verse.org/Simulation }
using { /Fortnite.com/Game }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/Diagnostics }
game_info := class<concrete>(creative_device):
@editable
SpawnInfo : spawn_info = spawn_info{}
StartGame<public>() : void =
Print("Selecting Roles")
SelectRoles()
Print("Selecting Map")
Selection := GetRandomInt(0, 0)
Print("Teleporting the players to the Map")
SpawnInfo.TeleportToMap(Selection)
The TeleportToMap function is another class callled spawn_info and I already sent it but I’ll send it again:
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
spawn_info := class(creative_device):
var TeleportNow<public> : logic = false
var Map : int = 0
@editable
Spawns_Farm: []teleporter_device := array{}
OnBegin<override>()<suspends> : void =
loop:
Sleep(1.0)
if (TeleportNow = true):
Print("test3")
for (Index -> Player:GetPlayspace().GetPlayers()):
if (Map = 0):
if (Players := Player, Farm := Spawns_Farm[Index]):
Farm.Teleport(Players)
set TeleportNow = false
TeleportToMap<public>(SelectedMap:int) : void =
set Map = SelectedMap
set TeleportNow = true
if (TeleportNow = true):
Print("true")
else:
Print("false")
The code doesn’t get past the “if (TeleportNow = true)” because TeleportNow still remains false even tho TeleportToMap is in the same class, can it be a problem if it’s in on the OnBegin and in a loop? I’ve been trying to fix it for so long that I almost lost any hope