Verse Library verse

01 Fragment

Creates a script that locates a target prop and moves it back and forth between defined waypoints.

verse-library/moving-target/01-fragment.verse

# We are defining a script that runs on our island.
# Think of this as the "Game Rules" book.
script MovingTargetScript is not runable
    # This is a "Variable".
    # In Fortnite terms: This is like your "Health Bar".
    # It changes during the game. Here, it stores the target object.
    Target: object = none

    # This is another "Variable" for the speed.
    # In Fortnite terms: This is like the "Storm Damage" setting.
    # It's a number we can tweak to make the game harder or easier.
    MoveSpeed: float = 5.0

    # This is a "Function".
    # In Fortnite terms: This is like a "Device Trigger" that runs when the game starts.
    OnBegin<override>()<suspends>: void =
        # First, we need to find our target.
        # We look for a prop named "TargetProp" in the island.
        if (Prop := FindProp("TargetProp")):
            Target = Prop
            # Start the movement loop
            StartPatrol()
        else:
            # If we can't find the prop, print an error to the debug console.
            # Like getting a "Connection Lost" error.
            Print("Error: Could not find TargetProp!")

    # This function handles the movement logic.
    StartPatrol()<suspends>: void =
        # Define the two points the target will visit.

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