Verse Library verse

05 Creating The Invisibility Manager

Initializes visibility tracking, hooks player spawns, and hides characters marked as infiltrators.

extracted-snippets/documentation/en-us/fortnite/triad-infiltration-making-players-invisible-in-verse/05-creating-the-invisibility-manager.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/fortnite/triad-infiltration-making-players-invisible-in-verse
# Local doc:  epic-docs/documentation/en-us/fortnite/triad-infiltration-making-players-invisible-in-verse.md
# Section:    Creating the Invisibility Manager
# Starts the invisibility manager logic. Called from triad_infiltration class after team balancing finishes
StartInvisibilityManager<public>(AllTeams:[]team, Players:[]player, Infiltrators:team):void=
Logger.Print("Invisibility script started!")
set Teams = AllTeams
for(PlayerSpawner:PlayersSpawners):
PlayerSpawner.SpawnedEvent.Subscribe(OnPlayerSpawn)
# For each player, if they spawned on the infiltrator team, spawn an OnInfiltratorDamaged function for that
# player. Then make their character invisible.
for(TeamPlayer:AllPlayers):
if:
FortCharacter:fort_character = TeamPlayer.GetFortCharacter[]
CurrentTeam := GetPlayspace().GetTeamCollection().GetTeam[TeamPlayer]
Logger.Print("Got this player's current team")
Infiltrators = CurrentTeam
set PlayerVisibilitySeconds[TeamPlayer] = 0.0
Logger.Print("Added player to PlayerVisibilitySeconds")
then:
spawn{OnInfiltratorDamaged(TeamPlayer)}
Logger.Print("Player spawned as an infiltrator, making them invisible")
FortCharacter.Hide()
else:
Logger.Print("This player isn't an infiltrator")

Comments

    Sign in to vote, comment, or suggest an edit. Sign in