Verse Library verse

01 Fragment

Modifies a player's maximum health and shield values to create custom tank-like stat profiles.

verse-library/fortnite-per-player-maximum-hp-shield-manager/01-fragment.verse

using { /Fortnite.com/Game }
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This is our main script. It's like the Game Rules device.
# We attach it to a device in the world, like a Zone Trigger.
tank_mode_script := script()

# VARIABLES: These are our "Loot Slots."
# We store the values we want to apply.
var TargetMaxHealth := 300.0
var TargetMaxShield := 100.0

# FUNCTION: A reusable block of code.
# Think of this like a "Building Blueprint." You define it once, then use it whenever needed.
# This function takes a Player as an argument (the person we're buffing).
ApplyTankStats := func(player: Player): void =>
    # Get the Health Component from the player.
    # The Health Component is like the "Health Bar" UI and logic attached to the player.
    health_comp := player.GetHealthComponent()
    
    # If the component exists (player is alive/valid):
    if (health_comp != nil):
        # Set the Max Health. 
        # Note: In some UE versions, you might need to set current health too, 
        # but setting Max is the key for the "Tank" feel.
        health_comp.SetMaxHealth(TargetMaxHealth)

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