using { /Fortnite.com/Devices }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /Fortnite.com/Characters }
using { /Fortnite.com/FortPlayerUtilities }
using { /Fortnite.com/Teams }
using { /Fortnite.com/Game }
using { /Verse.org/Simulation }
using { /Verse.org/Simulation/Tags }
using { /Verse.org/Random }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { VotingModule }
using { BossRoomModule }
Teams := enum:
Runner
Trappers
MinigameStruct := struct:
@editable
Voting : voting_system_device = voting_system_device{}
GameSettings := struct:
@editable
TrapperTeam : int = 1
@editable
RunnerTeam : int = 2
@editable
MaxTrappers : int = 1
@editable
StartMinigameOnVoteFinished : logic = false
@editable
SetRunnerOnJoin : logic = true
@editable
RoundStartDelay : float = 5.0
@editable
ApplyTrapperHealth : logic = true
@editable
TrapperCustomHealth : float = 150.0
@editable
MaxCheckpointRespawns : int = 3
@editable
RespawnDelay : float = 3.0
GameDevices := struct:
@editable
TrapperWinTrigger : trigger_device = trigger_device{}
@editable
RunnerWinTrigger : trigger_device = trigger_device{}
@editable
RoundSettingsDevice : round_settings_device = round_settings_device{}
@editable
EndGameDevice : end_game_device = end_game_device{}
@editable
EndGameDevice2 : end_game_device = end_game_device{}
@editable
SignalRemoteManager : signal_remote_manager_device = signal_remote_manager_device{}
@editable
Zones : \[\]mutator_zone_device = array{}
@editable
LevelTeleports : \[\]teleporter_device = array{}
GameTrapper := struct:
@editable
Traps : \[\]TrapClass = array{}
@editable
Teleports : \[\]teleporter_device = array{}
respawn_hud_messages := struct:
@editable
ThreeRespawnsLeft : hud_message_device = hud_message_device{}
@editable
TwoRespawnsLeft : hud_message_device = hud_message_device{}
@editable
OneRespawnLeft : hud_message_device = hud_message_device{}
@editable
NoRespawnsLeft : hud_message_device = hud_message_device{}
checkpoint_data := struct:
@editable
CheckpointPad : ?player_checkpoint_device = false
@editable
CheckpointZone : ?mutator_zone_device = false
@editable
CheckpointIndex : int = 0
map_checkpoint_config := struct:
@editable
MapName : string = ""
@editable
Checkpoints : \[\]checkpoint_data = array{}
@editable
MaxRespawnsForThisMap : int = 3
GameManager := class(creative_device):
@editable
Devices : GameDevices = GameDevices{}
@editable
Trapper : GameTrapper = GameTrapper{}
@editable
Voting : voting_system_device = voting_system_device{}
@editable
Minigame : ?MinigameStruct = false
@editable
Settings : GameSettings = GameSettings{}
@editable
CheckpointHudMessages : respawn_hud_messages = respawn_hud_messages{}
@editable
LobbyDetectionZone : mutator_zone_device = mutator_zone_device{}
@editable
MinigameCompletionTimers : \[\]timer_device = array{}
@editable
MinigameCompletionZones : \[\]mutator_zone_device = array{}
@editable
CandyBossRoomTeleporterA : teleporter_device = teleporter_device{}
@editable
CandyBossRoomTeleporterB : teleporter_device = teleporter_device{}
@editable
MartBossRoomTeleporterA : teleporter_device = teleporter_device{}
@editable
MartBossRoomTeleporterB : teleporter_device = teleporter_device{}
@editable
PyramidsBossRoomTeleporterA : teleporter_device = teleporter_device{}
@editable
PyramidsBossRoomTeleporterB : teleporter_device = teleporter_device{}
@editable
Map1_CheckpointConfig : map_checkpoint_config = map_checkpoint_config{MapName := "Map 1"}
@editable
Map2_CheckpointConfig : map_checkpoint_config = map_checkpoint_config{MapName := "Map 2"}
@editable
Map3_CheckpointConfig : map_checkpoint_config = map_checkpoint_config{MapName := "Map 3"}
var CurrentLevel : int = -1
var CurrentTrap : int = 0
var CurrentMode : string = "Freerun"
var AlivePlayers : \[\]agent = array{}
var CurrentChoice : ?VotingModule.vote_choice = false
var TeamThatWon : ?tuple(Teams, agent) = false
var CurrentMinigame : ?BossRoomModule.minigame_with_boss = false
var HasTeleportedToBossRoom : logic = false
var HasSubscribedToMinigameVoting : logic = false
var CurrentMapName : string = ""
var IsInBossRoom : logic = false
var ShuffledAgentsForTeleport : \[\]agent = array{}
var AllGameAgents : \[\]agent = array{}
var RoundNumber : int = 0
var CurrentTeleportArea : ?VotingModule.teleport_area = false
var LateTeleportActive : logic = false
var PlayersInLobbyZone : \[agent\]logic = map{}
var PlayersTeleportedThisRound : \[agent\]logic = map{}
var ActiveRoundID : int = 0
var LastRoundTrappers : \[\]agent = array{}
var PlayersInCurrentRound : \[agent\]logic = map{}
var PlayerLastCheckpoint : \[agent\]int = map{}
var PlayerCheckpointRespawns : \[agent\]int = map{}
var PlayerPendingRespawn : \[agent\]logic = map{}
var PlayersInSuddenDeath : \[agent\]logic = map{}
var IsInMinigamePhase : logic = false
var ActiveCheckpointConfig : ?map_checkpoint_config = false
var ActiveCheckpoints : \[\]checkpoint_data = array{}
var ActiveMaxRespawns : int = 3
OnBegin<override>()<suspends>:void=
Print("=== GAMEMANAGER V134 - FORCED RE-ELIMINATION ===")
Print("⚡ V134: Monitors sudden death players for unwanted respawns")
Print("💀 V134: Re-eliminates players if checkpoint auto-respawns them")
Print("🚫 V134: Prevents any respawn after end zone")
Print("🔄 V134: Continuous monitoring loop ensures death stays permanent")
if (SetManager\[Self\]){}
for (Zone : Devices.Zones):
spawn{ ListenToZone(Zone) }
for (Index -> Trap : Trapper.Traps):
Trap.Save()
Trap.Button.InteractedWithEvent.SubscribeTrap( OnTrapActivated, Index )
for (Player : GetPlayspace().GetParticipants()):
OnJoin(Player)
spawn{ SubscribeToPlayerElimination(Player) }
Voting.OnVoteFinished( StartRound )
Devices.SignalRemoteManager.PrimarySignalEvent.Subscribe( OnTrapTeleportRequest )
spawn{ InitializeCheckpointSystem() }
spawn{ MonitorLobbyZone() }
spawn{ InitializeAllGameAgents() }
spawn{ AutoStartVotingAfterDelay() }
spawn{ ListenToStartVote() }
\# 🆕 V134: Monitor and re-eliminate sudden death players
spawn{ MonitorSuddenDeathRespawns() }
\# 🆕 V134: Monitor sudden death players and re-eliminate if checkpoint respawns them
MonitorSuddenDeathRespawns()<suspends>: void =
Print("🔍 V134: Starting sudden death respawn monitor...")
loop:
Sleep(0.1) # Check very frequently
for (Agent -> IsInSuddenDeath : PlayersInSuddenDeath):
if (IsInSuddenDeath?):
\# Check if this sudden death player is alive (shouldn't be)
if (Character := Agent.GetFortCharacter\[\]):
if (Character.IsActive\[\]):
Print("⚠️ V134: Sudden death player was respawned by checkpoint - re-eliminating!")
\# Immediately eliminate them again
Character.Damage(99999.0)
\# 🆕 V133: Subscribe to character elimination events (faster than polling)
SubscribeToPlayerElimination(Agent: agent)<suspends>: void =
loop:
if (Character := Agent.GetFortCharacter\[\]):
Character.EliminatedEvent().Subscribe(OnPlayerEliminatedEvent)
Print("✅ V134: Subscribed to elimination event for player")
break
Sleep(0.5)
\# 🆕 V133: Handle elimination event (called immediately when player dies)
OnPlayerEliminatedEvent(Result: elimination_result): void =
if (Agent := Result.EliminatedCharacter.GetAgent\[\]):
Print("💀 V134: Elimination event triggered instantly")
spawn{ OnPlayerEliminated(Agent) }
InitializeCheckpointSystem()<suspends>: void =
Print("🎯 V129: Initializing checkpoint system for 3 maps...")
var Map1ValidCount : int = 0
for (CheckpointData : Map1_CheckpointConfig.Checkpoints):
if (CheckpointData.CheckpointZone?):
set Map1ValidCount += 1
Print("📍 V129: Map 1 '{Map1_CheckpointConfig.MapName}' - {Map1ValidCount} checkpoints")
for (Index -> CheckpointData : Map1_CheckpointConfig.Checkpoints):
spawn{ ListenToCheckpoint(CheckpointData, Index) }
var Map2ValidCount : int = 0
for (CheckpointData : Map2_CheckpointConfig.Checkpoints):
if (CheckpointData.CheckpointZone?):
set Map2ValidCount += 1
Print("📍 V129: Map 2 '{Map2_CheckpointConfig.MapName}' - {Map2ValidCount} checkpoints")
for (Index -> CheckpointData : Map2_CheckpointConfig.Checkpoints):
spawn{ ListenToCheckpoint(CheckpointData, Index) }
var Map3ValidCount : int = 0
for (CheckpointData : Map3_CheckpointConfig.Checkpoints):
if (CheckpointData.CheckpointZone?):
set Map3ValidCount += 1
Print("📍 V129: Map 3 '{Map3_CheckpointConfig.MapName}' - {Map3ValidCount} checkpoints")
for (Index -> CheckpointData : Map3_CheckpointConfig.Checkpoints):
spawn{ ListenToCheckpoint(CheckpointData, Index) }
Print("✅ V129: All checkpoint systems initialized")
LoadCheckpointConfigForMap(MapName: string): void =
Print("🗺️ V129: Loading checkpoint config for: '{MapName}'")
if (MapName = Map1_CheckpointConfig.MapName):
set ActiveCheckpointConfig = option{Map1_CheckpointConfig}
set ActiveCheckpoints = Map1_CheckpointConfig.Checkpoints
set ActiveMaxRespawns = Map1_CheckpointConfig.MaxRespawnsForThisMap
Print("✅ V129: Map 1 - {ActiveMaxRespawns} respawns")
return
if (MapName = Map2_CheckpointConfig.MapName):
set ActiveCheckpointConfig = option{Map2_CheckpointConfig}
set ActiveCheckpoints = Map2_CheckpointConfig.Checkpoints
set ActiveMaxRespawns = Map2_CheckpointConfig.MaxRespawnsForThisMap
Print("✅ V129: Map 2 - {ActiveMaxRespawns} respawns")
return
if (MapName = Map3_CheckpointConfig.MapName):
set ActiveCheckpointConfig = option{Map3_CheckpointConfig}
set ActiveCheckpoints = Map3_CheckpointConfig.Checkpoints
set ActiveMaxRespawns = Map3_CheckpointConfig.MaxRespawnsForThisMap
Print("✅ V129: Map 3 - {ActiveMaxRespawns} respawns")
return
Print("⚠️ V129: No matching map - using defaults")
set ActiveCheckpointConfig = false
set ActiveCheckpoints = array{}
set ActiveMaxRespawns = Settings.MaxCheckpointRespawns
ListenToCheckpoint(CheckpointData: checkpoint_data, CheckpointIndex: int)<suspends>: void =
if (Zone := CheckpointData.CheckpointZone?):
loop:
Agent := Zone.AgentEntersEvent.Await()
OnCheckpointActivated(Agent, CheckpointIndex, CheckpointData)
OnCheckpointActivated(Agent: agent, CheckpointIndex: int, CheckpointData: checkpoint_data)<suspends>: void =
TeamCollection := GetPlayspace().GetTeamCollection()
if:
RunnerTeam := GetTeamFromIndex\[Settings.RunnerTeam\]
not TeamCollection.IsOnTeam\[Agent, RunnerTeam\]
then:
return
if (StoredCheckpoint := PlayerLastCheckpoint\[Agent\]):
CurrentCheckpoint := StoredCheckpoint - 1
if (CurrentCheckpoint = CheckpointIndex):
return
else:
if (set PlayerCheckpointRespawns\[Agent\] = 0) {}
if (set PlayerLastCheckpoint\[Agent\] = CheckpointIndex + 1) {}
Print("✅ V129: Checkpoint {CheckpointIndex} saved")
Sleep(0.0)
ShowRespawnHudMessage(Player: player, RespawnsRemaining: int): void =
if (RespawnsRemaining = 3):
CheckpointHudMessages.ThreeRespawnsLeft.Show(Player)
else if (RespawnsRemaining = 2):
CheckpointHudMessages.TwoRespawnsLeft.Show(Player)
else if (RespawnsRemaining = 1):
CheckpointHudMessages.OneRespawnLeft.Show(Player)
else if (RespawnsRemaining <= 0):
CheckpointHudMessages.NoRespawnsLeft.Show(Player)
KeepPlayerEliminated(Agent: agent)<suspends>: void =
Print("💀 V134: Keeping player eliminated (sudden death mode)...")
if (Player := player\[Agent\]):
ShowRespawnHudMessage(Player, 0)
Print("📺 V134: 'No Respawns' HUD shown")
Print("✅ V134: Player will stay eliminated - monitor will catch respawns")
OnPlayerEliminated<public>(EliminatedPlayer: agent)<suspends>: void =
Print("💀 V134: ========== PLAYER ELIMINATED ==========")
if (set PlayerPendingRespawn\[EliminatedPlayer\] = true) {}
Print("🔍 V134: Checking sudden death status...")
var PlayerIsInSuddenDeath : logic = false
if (SuddenDeathValue := PlayersInSuddenDeath\[EliminatedPlayer\]):
Print("🔍 V134: Found sudden death entry for player")
if (SuddenDeathValue = true):
Print("✅ V134: Sudden death value = TRUE")
set PlayerIsInSuddenDeath = true
else:
Print("⚠️ V134: Sudden death entry exists but value is NOT TRUE")
else:
Print("🔍 V134: No sudden death entry found for player")
if (PlayerIsInSuddenDeath?):
Print("💀 V134: ========== SUDDEN DEATH CONFIRMED ==========")
Print("🚫 V134: NO RESPAWN - Player stays eliminated")
Print("🚫 V134: Player entered end zone - permanent elimination")
Print("🔄 V134: Monitor will re-eliminate if checkpoint respawns them")
if (set PlayerPendingRespawn\[EliminatedPlayer\] = false) {}
spawn{ KeepPlayerEliminated(EliminatedPlayer) }
Print("💀 V134: ========== ELIMINATION PERMANENT ==========")
return
Print("✅ V134: Player NOT in sudden death - checking other conditions...")
if (IsInMinigamePhase?):
Print("🎮 V134: MINIGAME PHASE - player stays eliminated")
if (set PlayerPendingRespawn\[EliminatedPlayer\] = false) {}
return
if (StoredCheckpoint := PlayerLastCheckpoint\[EliminatedPlayer\]):
CheckpointIndex := StoredCheckpoint - 1
var RespawnsUsed : int = 0
if (UsedCount := PlayerCheckpointRespawns\[EliminatedPlayer\]):
set RespawnsUsed = UsedCount
if (RespawnsUsed < ActiveMaxRespawns):
Print("✅ V134: Respawning at checkpoint {CheckpointIndex}")
if (set PlayerCheckpointRespawns\[EliminatedPlayer\] = RespawnsUsed + 1) {}
RespawnsRemaining := ActiveMaxRespawns - (RespawnsUsed + 1)
spawn{ ManuallyRespawnAndShowHUD(EliminatedPlayer, CheckpointIndex, RespawnsRemaining) }
else:
Print("❌ V134: No respawns remaining - keeping eliminated")
if (set PlayerPendingRespawn\[EliminatedPlayer\] = false) {}
spawn{ KeepPlayerEliminated(EliminatedPlayer) }
else:
Print("❌ V134: No checkpoint - keeping eliminated")
if (set PlayerPendingRespawn\[EliminatedPlayer\] = false) {}
spawn{ KeepPlayerEliminated(EliminatedPlayer) }
Print("💀 V134: ========== END ELIMINATION CHECK ==========")
ManuallyRespawnAndShowHUD(Agent: agent, CheckpointIndex: int, RespawnsRemaining: int)<suspends>: void =
Sleep(Settings.RespawnDelay)
if (CheckpointIndex >= 0 and CheckpointIndex < ActiveCheckpoints.Length):
if (CheckpointData := ActiveCheckpoints\[CheckpointIndex\]):
var RespawnPos : vector3 = vector3{X := 0.0, Y := 0.0, Z := 0.0}
var RespawnRot : rotation = IdentityRotation()
if (CheckpointPad := CheckpointData.CheckpointPad?):
Transform := CheckpointPad.GetTransform()
set RespawnPos = Transform.Translation
set RespawnRot = Transform.Rotation
else if (CheckpointZone := CheckpointData.CheckpointZone?):
Transform := CheckpointZone.GetTransform()
set RespawnPos = Transform.Translation
set RespawnRot = Transform.Rotation
else:
if (set PlayerPendingRespawn\[Agent\] = false) {}
return
if (Player := player\[Agent\]):
Player.Respawn(RespawnPos, RespawnRot)
Sleep(1.0)
if (Character := Agent.GetFortCharacter\[\]):
if (Character.IsActive\[\]):
if (set PlayerPendingRespawn\[Agent\] = false) {}
ShowRespawnHudMessage(Player, RespawnsRemaining)
else:
if (set PlayerPendingRespawn\[Agent\] = false) {}
else:
if (set PlayerPendingRespawn\[Agent\] = false) {}
else:
if (set PlayerPendingRespawn\[Agent\] = false) {}
ResetPlayerCheckpoints(Agent: agent): void =
if (set PlayerLastCheckpoint\[Agent\] = 0) {}
if (set PlayerCheckpointRespawns\[Agent\] = 0) {}
if (set PlayerPendingRespawn\[Agent\] = false) {}
ResetAllCheckpoints(): void =
Print("🔄 V129: Resetting checkpoints - {ActiveMaxRespawns} respawns per player")
set PlayerLastCheckpoint = map{}
set PlayerCheckpointRespawns = map{}
set PlayerPendingRespawn = map{}
DisableCheckpointRespawnsForPlayer(Agent: agent): void =
Print("💀 V134: ========== REMOVING ALL RESPAWNS (END ZONE) ==========")
var RespawnsUsed : int = 0
if (UsedCount := PlayerCheckpointRespawns\[Agent\]):
set RespawnsUsed = UsedCount
RespawnsRemaining := ActiveMaxRespawns - RespawnsUsed
Print("🚫 V134: Player had {RespawnsRemaining} respawns - ALL REMOVED")
if (set PlayerLastCheckpoint\[Agent\] = 0) {}
if (set PlayerCheckpointRespawns\[Agent\] = ActiveMaxRespawns + 999) {}
if (set PlayerPendingRespawn\[Agent\] = false) {}
Print("✅ V134: Player checkpoint data disabled (logic-based)")
if (Player := player\[Agent\]):
ShowRespawnHudMessage(Player, 0)
Print("📺 V134: 'No Respawns' HUD shown")
Print("✅ V134: SUDDEN DEATH ACTIVE - monitor will catch respawns")
Print("💀 V134: ========== END ZONE PROCESSING COMPLETE ==========")
AutoStartVotingAfterDelay()<suspends>: void =
Sleep(3.0)
Voting.OnVoteStartTriggered(false)
InitializeAllGameAgents()<suspends>: void =
Sleep(2.0)
ParticipantsFromPlayspace := GetPlayspace().GetParticipants()
AgentsFromTeams := GetAllAgentsFromTeams()
if (AgentsFromTeams.Length > ParticipantsFromPlayspace.Length):
set AllGameAgents = AgentsFromTeams
else:
set AllGameAgents = ParticipantsFromPlayspace
OnTrapTeleportRequest(Player: agent): void =
if (TrapperTeleport := Trapper.Teleports\[CurrentTrap\]):
TrapperTeleport.Teleport( Player )
else if (TrapperTeleport := Trapper.Teleports\[CurrentTrap-1\]):
TrapperTeleport.Teleport(Player)
OnTrapActivated(Player: agent, TrapIndex: int): void =
if (Trap := Trapper.Traps\[TrapIndex\]):
spawn{ Trap.Activate(Player) }
GetWinningTeam()<transacts>: int ={
if (GetAliveRunners() > 0 and GetAliveTrappers() <= 0):
return Settings.RunnerTeam
else if (GetAliveTrappers() > 0 and GetAliveRunners() <= 0):
return Settings.TrapperTeam
return 0
}
IsRoundOver()<decides><transacts>: void = GetAliveRunners() <= 0 or GetAliveTrappers() <= 0
CleanupRound(): void =
set PlayersInCurrentRound = map{}
set LateTeleportActive = false
set PlayersTeleportedThisRound = map{}
set PlayersInLobbyZone = map{}
set PlayersInSuddenDeath = map{}
set IsInMinigamePhase = false
ResetAllCheckpoints()
OnWon(Player: agent, WinningTeam: Teams)<suspends>: void =
CleanupRound()
case(WinningTeam):
Teams.Runner => block:
Devices.RunnerWinTrigger.Trigger(Player)
Devices.RoundSettingsDevice.EndRound(Player)
Sleep(0.5)
Devices.EndGameDevice.Activate(Player)
Teams.Trappers => block:
Devices.TrapperWinTrigger.Trigger(Player)
Devices.RoundSettingsDevice.EndRound(Player)
Sleep(0.5)
Devices.EndGameDevice2.Activate(Player)
ForceEndRound(): void =
if (Player := GetPlayspace().GetPlayers()\[0\]):
Devices.RoundSettingsDevice.EndRound(Player)
SubscribeToWin()<suspends>: void =
Sleep(2.0)
spawn{ MonitorEndZone() }
spawn{ MonitorAliveChecks() }
MonitorEndZone()<suspends>: void =
if (CurrentMap := CurrentChoice?):
Agent := CurrentMap.EndMutator.AgentEntersEvent.Await()
Print("🎯 V134: ========== PLAYER REACHED END ZONE ==========")
if (set PlayersInSuddenDeath\[Agent\] = true) {}
Print("✅ V134: Sudden death flag SET")
if (VerifyValue := PlayersInSuddenDeath\[Agent\]):
if (VerifyValue = true):
Print("✅ V134: VERIFIED - Sudden death flag is TRUE")
else:
Print("⚠️ V134: WARNING - Sudden death flag set but value is NOT TRUE")
else:
Print("❌ V134: ERROR - Sudden death flag NOT found after setting!")
DisableCheckpointRespawnsForPlayer(Agent)
if (MiniGame := Minigame?):
set HasSubscribedToMinigameVoting = true
set TeamThatWon = option{Teams.Runner, Agent}
MiniGame.Voting.OnVoteStartTriggered(option{Agent})
MiniGame.Voting.OnVoteFinished( StartMinigame )
else:
OnWon(Agent, Teams.Runner)
MonitorAliveChecks()<suspends>: void =
if:
Runners := GetTeamFromIndex\[Settings.RunnerTeam\]
Trappers := GetTeamFromIndex\[Settings.TrapperTeam\]
then:
loop:
Sleep(0.8)
var AliveRunnerCount : int = 0
var AliveTrapperCount : int = 0
var AliveTrapperAgent : ?agent = false
var AliveRunnerAgent : ?agent = false
if (RunnerAgents := Runners.GetAgents\[\]):
for (Agent : RunnerAgents):
if (WasInRound := PlayersInCurrentRound\[Agent\]):
if (WasInRound?):
var IsPendingRespawn : logic = false
if (PendingStatus := PlayerPendingRespawn\[Agent\]):
if (PendingStatus?):
set IsPendingRespawn = true
if (Character := Agent.GetFortCharacter\[\]):
if (Character.IsActive\[\] or IsPendingRespawn?):
set AliveRunnerCount += 1
if (AliveRunnerAgent = false):
set AliveRunnerAgent = option{Agent}
if (TrapperAgents := Trappers.GetAgents\[\]):
for (Agent : TrapperAgents):
if (WasInRound := PlayersInCurrentRound\[Agent\]):
if (WasInRound?):
var IsPendingRespawn : logic = false
if (PendingStatus := PlayerPendingRespawn\[Agent\]):
if (PendingStatus?):
set IsPendingRespawn = true
if (Character := Agent.GetFortCharacter\[\]):
if (Character.IsActive\[\] or IsPendingRespawn?):
set AliveTrapperCount += 1
if (AliveTrapperAgent = false):
set AliveTrapperAgent = option{Agent}
if (AliveRunnerCount <= 0 and AliveTrapperCount > 0):
if (WinningAgent := AliveTrapperAgent?):
OnWon(WinningAgent, Teams.Trappers)
return
if (AliveTrapperCount <= 0 and AliveRunnerCount > 0):
if (WinningAgent := AliveRunnerAgent?):
OnWon(WinningAgent, Teams.Runner)
return
StartMinigame(WinningChoice: VotingModule.vote_choice): void =
MapTeleport := WinningChoice.Teleport
if (ChosenMinigame := WinningChoice.Minigame?):
set CurrentMinigame = option{ChosenMinigame}
set HasTeleportedToBossRoom = false
set HasSubscribedToMinigameVoting = false
set CurrentMapName = WinningChoice.Name
set IsInMinigamePhase = true
Print("🎮 V134: MINIGAME PHASE ACTIVE - no respawns allowed")
AllAgents := GetPlayspace().GetParticipants()
TeamCollection := GetPlayspace().GetTeamCollection()
MinigameTeleports := ChosenMinigame.Teleport
spawn{ RespawnDeadRunnersForMinigame(MinigameTeleports) }
for (Agent : AllAgents):
if (Character := Agent.GetFortCharacter\[\]):
if:
TrapperTeam := GetTeamFromIndex\[Settings.TrapperTeam\]
TeamCollection.IsOnTeam\[Agent, TrapperTeam\]
then:
MinigameTeleports.TrapperTeleporter.Teleport(Agent)
else if:
RunnerTeam := GetTeamFromIndex\[Settings.RunnerTeam\]
TeamCollection.IsOnTeam\[Agent, RunnerTeam\]
then:
MinigameTeleports.RunnerTeleporter.Teleport(Agent)
else:
MinigameTeleports.RunnerTeleporter.Teleport(Agent)
else:
MinigameTeleports.RunnerTeleporter.Teleport(Agent)
RespawnSpectatorsWithTeams(MinigameTeleports)
for (Index -> Timer : MinigameCompletionTimers):
spawn{ ListenToMinigameTimer(Timer, Index) }
for (Index -> Zone : MinigameCompletionZones):
spawn{ ListenToMinigameEndZone(Zone, Index) }
spawn{ AwaitTriggered(ChosenMinigame.End) }
RespawnDeadRunnersForMinigame(MinigameTeleports: VotingModule.teleport_area)<suspends>: void =
Print("🔄 V134: Checking which dead runners to respawn...")
TeamCollection := GetPlayspace().GetTeamCollection()
if (RunnerTeam := GetTeamFromIndex\[Settings.RunnerTeam\]):
if (RunnerAgents := TeamCollection.GetAgents\[RunnerTeam\]):
for (Agent : RunnerAgents):
var PlayerIsInSuddenDeath : logic = false
if (SuddenDeathValue := PlayersInSuddenDeath\[Agent\]):
Print("🔍 V134: Found sudden death entry for agent")
if (SuddenDeathValue = true):
Print("💀 V134: CONFIRMED - Agent is in sudden death")
set PlayerIsInSuddenDeath = true
else:
Print("⚠️ V134: Sudden death entry exists but value is NOT TRUE")
else:
Print("🔍 V134: No sudden death entry for agent")
if (not PlayerIsInSuddenDeath?):
Print("✅ V134: Agent NOT in sudden death - checking if needs respawn...")
var NeedsRespawn : logic = false
if (Character := Agent.GetFortCharacter\[\]):
if (not Character.IsActive\[\]):
set NeedsRespawn = true
else:
set NeedsRespawn = true
if (NeedsRespawn?):
Print("🔄 V134: Respawning runner for minigame")
SpawnTransform := MinigameTeleports.RunnerTeleporter.GetTransform()
TeleportPos := SpawnTransform.Translation
TeleportRot := SpawnTransform.Rotation
if (Player := player\[Agent\]):
var Attempt : int = 0
loop:
set Attempt += 1
if (Attempt > 5):
break
if (RespawnedChar := Player.GetFortCharacter\[\]):
if (RespawnedChar.IsActive\[\]):
break
Player.Respawn(TeleportPos, TeleportRot)
Sleep(0.2)
Sleep(0.1)
MinigameTeleports.RunnerTeleporter.Teleport(Player)
else:
var TeleportAttempt : int = 0
loop:
set TeleportAttempt += 1
if (TeleportAttempt > 8):
break
Sleep(0.2)
if (NewCharacter := Agent.GetFortCharacter\[\]):
if (NewCharacter.IsActive\[\]):
MinigameTeleports.RunnerTeleporter.Teleport(Agent)
break
MinigameTeleports.RunnerTeleporter.Teleport(Agent)
else:
Print("✅ V134: Agent alive - no respawn needed")
else:
Print("💀 V134: Skipping sudden death player - stays eliminated for minigame")
AwaitTriggered(trigger: trigger_device)<suspends>: void =
trigger.TriggeredEvent.Await()
if (data := TeamThatWon?):
CurrentTeam := data(0)
Agent := data(1)
case(CurrentTeam):
Teams.Runner => block:
Devices.RunnerWinTrigger.Trigger(Agent)
Devices.RoundSettingsDevice.EndRound(Agent)
Teams.Trappers => block:
Devices.TrapperWinTrigger.Trigger(Agent)
Devices.RoundSettingsDevice.EndRound(Agent)
else:
if (RandomPlayer := GetPlayspace().GetPlayers()\[0\]):
Devices.RoundSettingsDevice.EndRound(RandomPlayer)
ListenToZone(Zone: mutator_zone_device)<suspends>: void =
loop:
Agent := Zone.AgentEntersEvent.Await()
if (FortChar := Agent.GetFortCharacter\[\], FortChar.IsActive\[\]):
Agent.OnZoneEntered()
ListenToStartVote()<suspends>: void =
loop:
MaybePlayer := Voting.VoteStartTrigger.TriggeredEvent.Await()
Voting.OnVoteStartTriggered(false)
break
ListenToMinigameTimer(Timer: timer_device, Index: int)<suspends>: void =
Timer.SuccessEvent.Await()
TeleportPlayersToBossRoom()
ListenToMinigameEndZone(Zone: mutator_zone_device, Index: int)<suspends>: void =
Zone.AgentEntersEvent.Await()
TeleportPlayersToBossRoom()
TeleportPlayersToBossRoom(): void =
if (HasTeleportedToBossRoom = false):
set HasTeleportedToBossRoom = true
set IsInBossRoom = true
var TeleporterA : ?teleporter_device = false
var TeleporterB : ?teleporter_device = false
var IsCandyMap : logic = false
var IsMartMap : logic = false
var IsPyramidsMap : logic = false
if (CurrentMapName = "Candy Land" or CurrentMapName = "candy land" or CurrentMapName = "CandyLand" or CurrentMapName = "candyland" or CurrentMapName = "CANDY LAND"):
set IsCandyMap = true
if (CurrentMapName = "Super Duper Mart" or CurrentMapName = "super duper mart" or CurrentMapName = "SuperDuperMart" or CurrentMapName = "superdupermart" or CurrentMapName = "SUPER DUPER MART" or CurrentMapName = "Mart" or CurrentMapName = "mart"):
set IsMartMap = true
if (CurrentMapName = "Pyramids" or CurrentMapName = "pyramids" or CurrentMapName = "PYRAMIDS" or CurrentMapName = "Pyramid" or CurrentMapName = "pyramid"):
set IsPyramidsMap = true
if (IsCandyMap?):
set TeleporterA = option{CandyBossRoomTeleporterA}
set TeleporterB = option{CandyBossRoomTeleporterB}
else if (IsMartMap?):
set TeleporterA = option{MartBossRoomTeleporterA}
set TeleporterB = option{MartBossRoomTeleporterB}
else if (IsPyramidsMap?):
set TeleporterA = option{PyramidsBossRoomTeleporterA}
set TeleporterB = option{PyramidsBossRoomTeleporterB}
else:
return
TeamCollection := GetPlayspace().GetTeamCollection()
AllTeams := TeamCollection.GetTeams()
if:
ValidTeleporterA := TeleporterA?
ValidTeleporterB := TeleporterB?
then:
if (Team1 := AllTeams\[0\]):
if (Agents1 := TeamCollection.GetAgents\[Team1\]):
for (Agent : Agents1):
ValidTeleporterA.Teleport(Agent)
if (Team2 := AllTeams\[1\]):
if (Agents2 := TeamCollection.GetAgents\[Team2\]):
for (Agent : Agents2):
ValidTeleporterB.Teleport(Agent)
RespawnSpectatorsWithTeams(MinigameTeleports: VotingModule.teleport_area): void =
var SpectatorsToRespawn : \[\]player = array{}
for (Index -> Player : GetPlayspace().GetPlayers()):
Spectators := Player.GetPlayersSpectating()
for (Spectator : Spectators):
set SpectatorsToRespawn += array{Spectator}
if (SpectatorsToRespawn.Length > 0):
spawn{ RespawnAllSpectators(SpectatorsToRespawn, MinigameTeleports) }
RespawnAllSpectators(Spectators: \[\]player, MinigameTeleports: VotingModule.teleport_area)<suspends>: void =
for (Spectator : Spectators):
TeleportPos := MinigameTeleports.RunnerTeleporter.GetTransform().Translation
loop:
var bShouldBreak : logic = false
if (Character := Spectator.GetFortCharacter\[\]):
if (Character.IsActive\[\]):
MinigameTeleports.RunnerTeleporter.Teleport(Spectator)
set bShouldBreak = true
if (bShouldBreak?):
break
Spectator.Respawn(TeleportPos, IdentityRotation())
Sleep(0.3)
Sleep(0.1)
MinigameTeleports.RunnerTeleporter.Teleport(Spectator)
RespawnSpectators(?MaybeTeleport: ?teleporter_device = false): void =
if (Teleport := MaybeTeleport?):
defer{ ForceAllTo(Teleport) }
for (Index -> Player : GetPlayspace().GetPlayers()):
for (Spectator : Player.GetPlayersSpectating()):
spawn{ Spectator.ForceRespawn() }
ForceAllTo(Teleport: teleporter_device): void =
for (Player : GetPlayspace().GetPlayers()):
Teleport.Teleport(Player)
OnJoin(Player: agent): void =
if (Settings.SetRunnerOnJoin?):
Voting.RunnerTeamSelector.ChangeTeamAndClass(Player)
TeleportTeammates(Exclude: agent): void =
TeamCollection := GetPlayspace().GetTeamCollection()
for (Index -> Team : TeamCollection.GetTeams(), Index = Settings.RunnerTeam-1):
for (Teammate : TeamCollection.GetAgents\[Team\], Teammate <> Exclude, Teleport := Devices.LevelTeleports\[CurrentLevel\]):
Teleport.Teleport( Teammate )
SetMode(Player: agent, Mode: string): void = set CurrentMode = Mode
GetTeamFromIndex(I:int)<decides><transacts>: team =
AllTeams := GetPlayspace().GetTeamCollection().GetTeams()
if (I > 0 and I <= AllTeams.Length):
AllTeams\[I-1\]
else:
if (AllTeams.Length > 0):
AllTeams\[0\]
else:
AllTeams\[0\]
(t: team).GetAgents()<decides><transacts>: \[\]agent = GetPlayspace().GetTeamCollection().GetAgents\[t\]
(t: team).Length()<decides><transacts>: int = t.GetAgents\[\].Length
(t: team).GreaterThan(A: int)<decides><transacts>: void = t.Length\[\] > A
(t: team).GreaterThanZero()<decides><transacts>: void = t.GreaterThan\[0\]
(t: team).IsNone()<decides><transacts>: void = t.Length\[\] <= 0
GetAliveCountForTeam(TeamIndex: int)<transacts>: int =
if (TeamAgents := GetTeamFromIndex\[TeamIndex\].GetAgents\[\]):
var Alive : int = 0
for (Agent : TeamAgents, Character := Agent.GetFortCharacter\[\], Character.IsActive\[\]):
set Alive += 1
Alive
else:
0
GetAliveTrappers()<transacts>: int = GetAliveCountForTeam(Settings.TrapperTeam)
GetAliveRunners()<transacts>: int = GetAliveCountForTeam(Settings.RunnerTeam)
GetAllAgentsFromTeams()<transacts>: \[\]agent =
var AllAgents : \[\]agent = array{}
TeamCollection := GetPlayspace().GetTeamCollection()
for (Team : TeamCollection.GetTeams()):
if (TeamAgents := TeamCollection.GetAgents\[Team\]):
for (Agent : TeamAgents):
set AllAgents += array{Agent}
return AllAgents
MonitorLobbyZone()<suspends>: void =
spawn{ ListenLobbyEnters() }
spawn{ ListenLobbyExits() }
ListenLobbyEnters()<suspends>: void =
loop:
Agent := LobbyDetectionZone.AgentEntersEvent.Await()
if (set PlayersInLobbyZone\[Agent\] = true) {}
ListenLobbyExits()<suspends>: void =
loop:
Agent := LobbyDetectionZone.AgentExitsEvent.Await()
if (set PlayersInLobbyZone\[Agent\] = false) {}
ApplyTrapperHealthModifier(RoundID: int)<suspends>: void =
if (not Settings.ApplyTrapperHealth?):
return
Sleep(1.5)
if (ActiveRoundID <> RoundID):
return
TeamCollection := GetPlayspace().GetTeamCollection()
if (TrapperTeam := GetTeamFromIndex\[Settings.TrapperTeam\]):
if (TrapperAgents := TeamCollection.GetAgents\[TrapperTeam\]):
for (Agent : TrapperAgents):
if (ActiveRoundID <> RoundID):
return
if (FortCharacter := Agent.GetFortCharacter\[\]):
FortCharacter.SetMaxHealth(Settings.TrapperCustomHealth)
FortCharacter.SetHealth(Settings.TrapperCustomHealth)
Sleep(0.05)
StartRound(data: VotingModule.vote_choice): void =
set ActiveRoundID += 1
ThisRoundID := ActiveRoundID
set RoundNumber += 1
set LateTeleportActive = false
set CurrentChoice = option{data}
set HasSubscribedToMinigameVoting = false
set IsInBossRoom = false
set CurrentMapName = data.Name
set IsInMinigamePhase = false
LoadCheckpointConfigForMap(CurrentMapName)
set CurrentTeleportArea = option{data.Teleport}
set PlayersInLobbyZone = map{}
set PlayersTeleportedThisRound = map{}
set PlayersInCurrentRound = map{}
set PlayersInSuddenDeath = map{}
ResetAllCheckpoints()
CurrentParticipants := GetPlayspace().GetParticipants()
if (CurrentParticipants.Length < 2):
return
var ActualMaxTrappers : int = Settings.MaxTrappers
if (Settings.MaxTrappers > CurrentParticipants.Length):
set ActualMaxTrappers = CurrentParticipants.Length - 1
for (Agent : CurrentParticipants):
if (set PlayersInCurrentRound\[Agent\] = true) {}
TrapperCandidates := SelectTrappersWithRotation(CurrentParticipants, ThisRoundID, ActualMaxTrappers)
AssignTeamsWithRotation(data.Teleport, CurrentParticipants, TrapperCandidates, ThisRoundID)
spawn{ ApplyTrapperHealthModifier(ThisRoundID) }
spawn{ StartLateTeleportationMonitor(data.Teleport, ThisRoundID) }
spawn{ DelayedSubscribeToWin(ThisRoundID) }
SelectTrappersWithRotation(CurrentPlayers: \[\]agent, RoundID: int, ValidatedMaxTrappers: int): \[\]agent =
var TrapperCandidates : \[\]agent = array{}
var EligiblePlayers : \[\]agent = array{}
for (Agent : CurrentPlayers):
var WasLastRoundTrapper : logic = false
for (LastTrapperAgent : LastRoundTrappers):
if (Agent = LastTrapperAgent):
set WasLastRoundTrapper = true
if (not WasLastRoundTrapper?):
set EligiblePlayers += array{Agent}
if (EligiblePlayers.Length < ValidatedMaxTrappers):
set EligiblePlayers = CurrentPlayers
ShuffledEligible := Shuffle(EligiblePlayers)
var TrappersSelected : int = 0
loop:
if (TrappersSelected >= ValidatedMaxTrappers):
break
if (TrappersSelected >= ShuffledEligible.Length):
break
if (SelectedAgent := ShuffledEligible\[TrappersSelected\]):
set TrapperCandidates += array{SelectedAgent}
set TrappersSelected += 1
set LastRoundTrappers = TrapperCandidates
return TrapperCandidates
AssignTeamsWithRotation(TeleportArea: VotingModule.teleport_area, AllPlayers: \[\]agent, TrapperList: \[\]agent, RoundID: int): void =
TeamCollection := GetPlayspace().GetTeamCollection()
for (Agent : AllPlayers):
if (ActiveRoundID <> RoundID):
return
spawn{ SubscribeToPlayerElimination(Agent) }
var IsSelectedTrapper : logic = false
for (TrapperAgent : TrapperList):
if (Agent = TrapperAgent):
set IsSelectedTrapper = true
if (IsSelectedTrapper?):
Voting.TrapperTeamSelector.ChangeTeamAndClass(Agent)
else:
Voting.RunnerTeamSelector.ChangeTeamAndClass(Agent)
for (Agent : AllPlayers):
if (ActiveRoundID <> RoundID):
return
if:
TrapperTeam := GetTeamFromIndex\[Settings.TrapperTeam\]
TeamCollection.IsOnTeam\[Agent, TrapperTeam\]
then:
TeleportArea.TrapperTeleporter.Teleport(Agent)
if (set PlayersTeleportedThisRound\[Agent\] = true) {}
else if:
RunnerTeam := GetTeamFromIndex\[Settings.RunnerTeam\]
TeamCollection.IsOnTeam\[Agent, RunnerTeam\]
then:
TeleportArea.RunnerTeleporter.Teleport(Agent)
if (set PlayersTeleportedThisRound\[Agent\] = true) {}
else:
TeleportArea.RunnerTeleporter.Teleport(Agent)
if (set PlayersTeleportedThisRound\[Agent\] = true) {}
StartLateTeleportationMonitor(TeleportAreaForThisRound: VotingModule.teleport_area, RoundID: int)<suspends>: void =
set LateTeleportActive = true
Sleep(3.0)
PopulateInitialLobbyTracking()
var CycleCount : int = 0
loop:
if (CycleCount >= 10):
break
if (ActiveRoundID <> RoundID):
return
if (not LateTeleportActive?):
return
Sleep(2.0)
CheckAndTeleportLobbyPlayers(TeleportAreaForThisRound, RoundID)
set CycleCount += 1
set LateTeleportActive = false
PopulateInitialLobbyTracking(): void =
CurrentParticipants := GetPlayspace().GetParticipants()
for (Agent : CurrentParticipants):
if (set PlayersInLobbyZone\[Agent\] = true) {}
CheckAndTeleportLobbyPlayers(TeleportArea: VotingModule.teleport_area, RoundID: int): void =
if (ActiveRoundID <> RoundID):
return
TeamCollection := GetPlayspace().GetTeamCollection()
var AgentsToTeleport : \[\]agent = array{}
for (Agent -> IsInLobby : PlayersInLobbyZone):
if (IsInLobby?):
var ShouldTeleport : logic = true
if (AlreadyTeleported := PlayersTeleportedThisRound\[Agent\]):
if (AlreadyTeleported?):
set ShouldTeleport = false
if (ShouldTeleport?):
set AgentsToTeleport += array{Agent}
for (Agent : AgentsToTeleport):
var IsTrapper : logic = false
if:
TrapperTeam := GetTeamFromIndex\[Settings.TrapperTeam\]
then:
if (TeamCollection.IsOnTeam\[Agent, TrapperTeam\]):
set IsTrapper = true
if (IsTrapper?):
TeleportArea.TrapperTeleporter.Teleport(Agent)
else:
TeleportArea.RunnerTeleporter.Teleport(Agent)
if (set PlayersTeleportedThisRound\[Agent\] = true) {}
if (set PlayersInLobbyZone\[Agent\] = false) {}
DelayedSubscribeToWin(RoundID: int)<suspends>: void =
Sleep(Settings.RoundStartDelay)
if (ActiveRoundID <> RoundID):
return
spawn{ SubscribeToWin() }
(Player: agent).OnZoneEntered(): void =
set CurrentLevel += 1
TeleportTeammates(Player)
RespawnSpectators()
(Player: player).ForceRespawn()<suspends>: void =
TeamCollection := GetPlayspace().GetTeamCollection()
if (Teleport := Devices.LevelTeleports\[CurrentLevel\]):
for (i := 0..3, not Player.GetFortCharacter\[\].IsActive\[\]):
if (TeamCollection.IsOnTeam\[Player, GetTeamFromIndex\[Settings.RunnerTeam\]\]):
Player.Respawn( Teleport.GetTransform().Translation , IdentityRotation() )
Sleep(0.1)
Teleport.Teleport(Player)
( Connectable : listenable(agent) ).SubscribeTrap( Function : tuple(agent, t)->void, Parameters : t where t:type ) : cancelable =
Wrapped := PlayerWrappedEvent(t){
Parameters := Parameters
Send := Function
}
Connectable.Subscribe(Wrapped.Pass)
PlayerWrappedEvent( t : type ) := class():
Pass(Param : agent):void = Send(Param, Parameters)
Send : tuple(agent, t) -> void
Parameters : t
GetTaggedObjects(Tag: tag, SubType: subtype(creative_object)): SubType =
for ( Tagged : GetManager\[\].FindCreativeObjectsWithTag(Tag), Object := SubType\[Tagged\] ):
Object