# MoodFloor.v
using /Fortnite.com
using /Engine/Systems/PlayerDataSystem
# Define our floor entity
FloorEntity := FindEntity("MoodFloor")
# This function runs every time a player enters the trigger
OnPlayerEnter := func(Trigger: TriggerVolume, Player: Player) {
# 1. Get the player's health (0.0 to 1.0)
Health := Player.Get_health()
# 2. Determine the color
# If health is > 0.5, use Blue. Else, use Red.
# This is like a decision node in a flowchart.
NewColor := if (Health > 0.5) then Color(0.2, 0.4, 1.0) else Color(1.0, 0.2, 0.2)
# 3. Apply the color to the floor's material
# We use the SetMaterialParameter function from the Engine
# This updates the "Base Color" input of the material attached to FloorEntity
SetMaterialParameter(FloorEntity, "Base Color", NewColor)
# Optional: Print to debug
Print("Player {Player.Get_player_name()} has {Health} health. Floor is now {NewColor}")
}
# When the island starts, set up the event
Run := func() {
# Find the trigger volume in the editor named "HealthTrigger"
Trigger := FindEntity("HealthTrigger")
Verse Library
verse
02 Fragment
Updates a floor prop material color based on player health when entering a trigger volume.
verse-library/material-inputs/02-fragment.verse
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.