VerseIsland
FeedLearnLeaderboardGuidesReferenceExploreSearchDocsVerse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Browse Community Snippets›Devices·Up to Community Snippets · Devices·38 of 70 in Devices

Simple Health Manager Using Triggers

85,587 Views

Report

  • using { /Fortnite.com/Devices }
    using { /Verse.org/Simulation }
    using { /Fortnite.com/Characters }
    using { /Fortnite.com/Game }
    
    
    MODIFICATIONTYPE := enum{Add,Set,Remove}
    HPTYPE := enum{Health,Shield}
    
    
    health_manager := class(creative_device):
        @editable DeviceSettings : DefaultSettingsClass = DefaultSettingsClass{} # Compacted all Settings into a class so when exposed into the editor it will be collapsable and not take much space 
        var SaveHP :logic=true 
        var ReGrantTime : float = 10.0
        var DefaultHP : HPAmounts = HPAmounts{}
    
        var SavedSubscriptions : [agent]?cancelable = map{} # ?cancelable is a subscription that is saved in a map per player so when a player leaves the subscription that was running can be cancelled
    
        @editable HPTriggers : []HPDeviceClass = array{} # Holds all the individual triggers along with how much HP and how to affect it 
        OnBegin<override>()<suspends>:void=
            set SaveHP = DeviceSettings.SaveHP;set ReGrantTime = DeviceSettings.ReGrantTime;set DefaultHP = DeviceSettings.DefaultHP # This syncs the Settings from the DeviceSettingsClass to the ones in this device
            for(HPClass:HPTriggers){HPClass.Init(Self,SaveHP)} # Initializes all the Triggers placed in the world
            if(DeviceSettings.SaveHP?):
                if(TeamSettings:=DeviceSettings.Optional_TeamSettingDevice?,TeamSettings.GetTransform().Translation.X<>0.0): # This checks for the validity of the Team Settings Device
                    TeamSettings.TeamMemberSpawnedEvent.Subscribe(PlayerSpawned) # If a Team Settings Device is provided it uses that instead of the alternative Detection for spawning
                else:
                    for(Player:GetPlayspace().GetPlayers()). PlayerAdded(Player) # This just runs the PlayerAdded Function for all players who already were in the game
                    GetPlayspace().PlayerAddedEvent().Subscribe(PlayerAdded) # Handles Players Joining the game and assigns the PlayerEliminatedEvent to Re-Grant the Modified HP
                    GetPlayspace().PlayerRemovedEvent().Subscribe(PlayerRemoved) # Handles Players Leaving the game and cancels any subscriptions linked to the players who left

You're reading a preview

The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.

Sign in with Discord — free for members Read the original at Epic Games documentation

Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.

Guided course

Add this to your free study plan — we’ll suggest related material and stitch it into one compile-checked lesson.

Keep exploring
More in Devices · 38 of 70
Prev
fortnite simple custom player counter w hud message device
Next
fortnite build reset devices collection

Source

Epic Games documentation

View original

Last updated 2026-07-26T12:21:42.415235+00:00

VerseIsland· an archipelago of Verse & UEFN knowledge
🗺️ Island atlasLearnGuidesHistoryAbout & PressSources & LicensingPrivacy PolicyTermsStatus

Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

🦜

Scout · your island guide

The Isle of Verse