Dodgeball with Props: The Moving Target Tutorial
Dodgeball with Props: The Moving Target Tutorial
Stop building static targets that are easier to hit than a sniper scope in a foggy bus. In this tutorial, we’re going to create a Moving Target system using Verse. Think of it like the Storm, but instead of killing you, it just makes your aim practice significantly harder. You’ll learn how to make a prop zip back and forth across the map, turning your island from a "shoot the wall" simulator into an actual skill-check arena.
What You'll Learn
- Variables as State: How to track where a prop is currently standing (like checking your health bar).
- Loops as Repetition: Using a
forloop to make a prop visit multiple spots in sequence (like a patrol route). - Events as Triggers: Listening for when a player hits the target to award points (like getting an elimination).
- Prop Movement: The specific Verse functions that make objects glide smoothly across the map.
How It Works
Imagine you’re playing a custom mode where a loot box doesn’t just sit there waiting to be opened. It runs away from you. Or better yet, it patrols a specific route, like a turret that isn't a turret.
In Verse, we treat the Scene Graph like the physical island in Creative. Every prop is an Entity (a thing that exists). To move it, we don't just teleport it; we tell it to travel from Point A to Point B over a set amount of time. This is called Interpolation.
Here is the game-mechanic analogy for the code we’re about to write:
- The Target (Entity): This is your movable prop. It’s like a player character, but controlled by the game, not a human.
- The Waypoints (Variables): These are specific coordinates on the map. Think of them like the "Set Start" and "Set Finish" lines in a race.
- The Loop (Control Flow): This is the rule that says, "Go to Waypoint 1, then Waypoint 2, then Waypoint 1 again." It’s the patrol logic.
- The Hit Event (Listener): This is like the "Elimination" counter. When a bullet touches the target, the game needs to know "Hey, someone hit this!" so it can play a sound and add to the score.
We aren't just making things move; we're making things move predictably so players can learn the pattern and then react to it.
Let's Build It
We are going to build a Patrolling Target. It will move between two invisible points in the air. When a player shoots it, it plays a "hit" effect.
Step 1: Set Up Your Island
- Open UEFN (Unreal Editor for Fortnite).
- Place a Customizable Target device (or any prop you like, like a barrel or a sphere) in the middle of your map. Let's call this
TargetProp. - Place two Point Light devices or just mark two spots in the editor where you want the target to go. Let's call them
Waypoint1andWaypoint2. - Add a Script device to your island. This is where our Verse code lives.
Step 2: The Verse Code
Copy this code into your Script device. Don't worry, we’ll break it down line by line.
# 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.
# These are "World Locations" (X, Y, Z coordinates).
# Think of these as the "Set Start" and "Set Finish" positions.
PointA := vector(0, 0, 200)
PointB := vector(200, 0, 200)
# This is a "While Loop".
# In Fortnite terms: This is like a "Respawn Timer" that never ends.
# It keeps running forever until we stop it.
loop:
# Move from A to B
MoveTo(PointA, PointB)
# Move from B to A
MoveTo(PointB, PointA)
# This function handles the actual movement between two points.
MoveTo(From: vector, To: vector)<suspends>: void =
# Check if the target actually exists before trying to move it.
if (Target):
# This is the "Magic Line".
# It tells the prop to slide from 'From' to 'To' over time.
# It uses "Ease" which means it starts slow, speeds up, then slows down.
# Like a vehicle accelerating and braking.
Target.MoveToEase(To, MoveSpeed, ease_type.Linear, animation_mode.OneShot)
# Wait until the movement is finished before moving again.
# Without this, the target would teleport instantly.
# This is like waiting for the "Elimination" sound to finish before spawning the next wave.
Wait(1.0 / MoveSpeed)
Code Walkthrough
script ... is not runable: This tells Verse this script doesn't run on its own. It needs to be attached to a device (like our Script device) to work. It’s like a blueprint that needs a builder.Target: object = none: We declare a variable calledTarget. It starts asnone(empty). Later, we fill it with our prop.FindProp("TargetProp"): This searches the entire island for a prop with the exact name "TargetProp". If it finds it, it assigns it to ourTargetvariable.loop:: This creates an infinite cycle. The target will go A->B, then B->A, then A->B, forever.MoveToEase: This is the heavy lifter. It takes the target's current position and smoothly interpolates it to the new position over the duration we specified.Wait(...): This pauses the script. If we didn't have this, the script would try to move the target to Point B, then immediately to Point A, then immediately to Point B again, all in the same frame. The result? The target would just vibrate or teleport. TheWaitensures we see the movement.
Try It Yourself
Now that you have a basic moving target, try these challenges to level up your code:
- Add a Third Waypoint: Modify the
StartPatrolfunction to include aPointC. Make the target visit A -> B -> C -> A. - Change the Speed: Create a new variable
FastSpeedand make the target move faster when it hits a specific zone (hint: you'll need to add an event listener for when a player enters a zone, but for now, just try changing theMoveSpeedvariable and see how the animation feels). - The "Hit" Effect: Currently, our code doesn't handle hits. Try adding a
HitEventlistener. When the target is hit, make it flash red or play a sound. (Look upProp.OnHitin the Verse documentation).
Hint for Challenge 3: You’ll need to define a function that runs when HitEvent fires. Inside that function, you can change the target's material or play a sound. Remember, events are like "Elimination" notifications—they tell you when something happened, not how to handle it. You write the handling code.
Recap
You’ve just built a dynamic, moving target system. You learned how to:
- Use Variables to store game objects and settings.
- Use Loops to create continuous behavior (patrolling).
- Use Functions to encapsulate logic (moving between points).
- Use Prop Movement APIs to make objects glide smoothly.
Your island is no longer static. It’s alive. Now go make those players work for their eliminations.
References
- https://dev.epicgames.com/documentation/en-us/uefn/animating-prop-movement-6-combining-movement-rotation-and-scale-in-verse
- https://dev.epicgames.com/documentation/en-us/uefn/animating-prop-movement-3-translating-props-in-verse
- https://dev.epicgames.com/community/snippets/9VQ/fortnite-digests-release-24-20-cl-24939793
- https://dev.epicgames.com/documentation/en-us/fortnite/shootem-up-knockem-down-in-fortnite-creative
- https://dev.epicgames.com/documentation/en-us/fortnite/animating-prop-movement-6-combining-movement-rotation-and-scale-in-verse
Verse source files
- 01-fragment.verse · fragment
Turn this into a guided course
Add Moving Target to your free study plan — we'll suggest related pages and stitch the lot into one compile-checked, self-guided lesson with worked examples and quizzes.
References
Original tutorial generated by Verse Island from the Verse/UEFN knowledge base, with references to the Epic Games sources above. Code is validated against the knowledge base.