Verse Library verse

01 Fragment

Changes door color and prints a message when a player walks through it.

verse-library/using-residential-prefabs-in-fortnite-creative/01-fragment.verse

# This is a Verse script for a House Device
# It makes the door change color when someone walks in

# First, we define the door. 
# We call it "FrontDoor".
# It is a specific prop in our house.
FrontDoor := Device:Find("FrontDoor")

# Next, we define an Event.
# An Event is something that happens.
# Here, it is when a player touches the door.
OnPlayerTouch := FrontDoor:OnBeginOverlap()

# Now, we tell the game what to do.
# When the event happens, run this code.
OnPlayerTouch:Bind(
    func(Actor: Actor) -> None:
    (
        # Change the door color to red.
        # We use a function called SetMaterialScalarParameter.
        # This is like painting the door.
        FrontDoor.SetMaterialScalarParameter("DoorColor", Vector3(1.0, 0.0, 0.0))
        
        # Print a message to the screen.
        # This helps us know it worked.
        Print("Welcome home!")
    )
)

Comments

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