Hi, @BrendannnD
What about adding the effect suspends ?
I need to use .await inside the “MainFunction”. Because I need to use a Countdown. Followed the tutorial for this
So I added but I end up with an error, that idk how to resolve. In line:
Zone.AreaIsScoredEvent.Subscribe(HandlerAreaIsScoredEvent{Device:=Self, Zone:=I}.HandlerFunction)
My code
var CountdownTimer : countdown_timer = countdown_timer{}
InitialCountdownTime : float = 30.0
HandlerAreaIsScoredEvent:= class() {
Device : Conquest
Zone : int
HandlerFunction(Agent : agent)<suspends> : void = {
Device.MainFunction(Agent, Zone)
}
}
OnBegin<override>()<suspends>:void=
for( I->Zone: Zones):
Zone.AreaIsScoredEvent.Subscribe(HandlerAreaIsScoredEvent{Device:=Self, Zone:=I}.HandlerFunction)
MainFunction(Agent: agent, Zone : int)<suspends> : void = {
StartCountdown()
StartCountdown()<suspends>: void =
Print("Starting countdown")
AllPlayers:[]player = GetPlayspace().GetPlayers()
for(Player:AllPlayers):
if(PlayerUI := GetPlayerUI[Player]):
set CountdownTimer = countdown_timer{MaybePlayerUI := option{PlayerUI}, RemainingTime := InitialCountdownTime}
CountdownTimer.StartCountdown()
CountdownTimer.CountdownEndedEvent.Await()