Verse Library verse

01 Device

Manages boss health values and dynamically updates a material instance to display a visual health bar.

verse-library/create-interactive-materials-in-unreal-editor-for-fortnite/01-device.verse

using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /UnrealEngine.com/Temporary/UI }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Simulation }

# This is our Boss Device. It holds the health logic.
boss_device := class(creative_device):

    # VARIABLE: Health is a number that changes.
    # Think of this like the Storm Timer. It starts high and goes down.
    var Current_Health : float = 100.0
    Max_Health : float = 100.0

    # CONSTANT: The damage amount.
    # Like a fixed damage value on a shotgun pellet.
    Damage_Per_Tick : float = 10.0

    # REFERENCE: A prop_manipulator_device placed in the editor whose
    # StaticMeshComponent carries the health-bar Material Instance.
    # Wire this in the UEFN editor's Details panel.
    @editable
    Health_Bar_Prop : creative_prop = creative_prop{}

    # EVENT: When the game starts.
    OnBegin<override>()<suspends> : void =
        # Set initial health
        set Current_Health = Max_Health
        # Update the visual immediately so it starts full
        Update_Health_Visual()

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

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