Verse Library verse

01 Fragment

Calculates and applies dynamic colors to props by iterating through connected player health values.

verse-library/material-inputs/01-fragment.verse

# MoodFloorController.v
# This script makes a floor change color based on the nearest player's health.

# 1. Import the necessary modules
using /Fortnite.com
using /Engine/Systems/PlayerDataSystem

# 2. Define the structure of our "Mood Floor"
# We need to know which object is the floor, and what its material looks like
struct MoodFloorData {
    FloorEntity: Entity
    TargetColor: Color
}

# 3. The main entry point
Run := func() {
    # Find the floor. In a real island, you'd tag this entity or find it by name.
    # For this demo, we'll assume we have a reference to the floor entity.
    # In practice, you'd use FindEntityByName or similar.
    # Let's assume we have a global reference or we find it via a trigger.
    
    # To keep it simple, let's say we have a "Trigger Volume" that detects players.
    # We'll link the player's health to the floor's material.
    
    # NOTE: Directly updating material parameters in Verse requires specific APIs.
    # The most common beginner-friendly way is to swap materials or use SetMaterialParameter.
    # Here is the pattern for updating a parameter:
    
    PlayerData := PlayerDataSystem.Get()

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