Verse Library verse

16 Spawning Functions For Characters On Game Start

Sets up player spawning events, initializes timers, and hides infiltrator agents.

extracted-snippets/documentation/en-us/uefn/triad-infiltration-6-blinking-player-visibility-on-damage-in-verse/16-spawning-functions-for-characters-on-game-start.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/triad-infiltration-6-blinking-player-visibility-on-damage-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/triad-infiltration-6-blinking-player-visibility-on-damage-in-verse.md
# Section:    Spawning Functions for Characters on Game Start
StartInvisibilityManager<public>(AllTeams:[]team, AllPlayers:[]player, Infiltrators:team):void=
    Logger.Print("Invisibility script started!")
    set Teams = GetPlayspace().GetTeamCollection().GetTeams()
    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")
            Teams[0] = 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")
Copy full snippet

Comments

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