Put Out the Fire: How to Extinguish Flames in Verse
Tutorial beginner

Put Out the Fire: How to Extinguish Flames in Verse

Updated beginner

Put Out the Fire: How to Extinguish Flames in Verse

Imagine you are building a cozy campsite in Fortnite. You light a campfire. It is warm and nice. But what if the fire gets too close to the trees? It could start a big forest fire! That would be bad for your island.

We need a way to put the fire out safely. We can use code to do this. In this tutorial, we will learn how to use the Extinguish command. This command stops fire from spreading. It is like a magic water bucket for your game. Let’s make your island safe and fun!

What You'll Learn

  • What the Extinguish command does.
  • How to use it with a Campfire Device.
  • How to trigger the fire to go out when a player presses a button.
  • How to keep your game world safe from accidental fires.

How It Works

Think of a fire like a stubborn candle. It keeps burning until you blow it out. In Verse, we have a special tool called Extinguish. It is a command. A command tells a device to do something.

The Extinguish command works on fire devices. It has two main jobs. First, it can put out a specific campfire. Second, it can put out all fires in a certain area.

We will use the Campfire Device for this tutorial. It is simple and easy to use. We will add a button to our island. When a player clicks the button, the fire will go out. This is like a safety switch. It gives the player control.

You do not need to know math for this. You just need to know how to connect the button to the fire. The code will tell the fire: "Stop burning now!"

Let's Build It

We will build a simple safety system. You will need two things in UEFN:

  1. A Campfire Device.
  2. A Button Device (or any trigger, like a zone).

We will write code that listens for the button press. When the button is pressed, the code will run Extinguish. This stops the fire.

Here is the code. Copy it into your Verse file.

using { /Fortnite.com/Devices }

# This is our main script file.
# It connects the button to the fire.

MyButton := button_device{}
MyCampfire := campfire_device{}

# We define what happens when the button is pressed.
# This is called an "Event". It waits for action.

OnButtonPressed := func():
    # This line runs when the button is clicked.
    # It tells the campfire to stop burning.
    MyCampfire.Extinguish()
    print("Fire is out! Stay safe!")

# We connect the event to the button.
# When the button fires, this event runs.
MyButton.Pressed.Bind(OnButtonPressed)

Let’s look at the important parts.

The first line brings in the devices. We need using { /Fortnite.com/Devices }. This lets us use campfires and buttons.

Next, we name our devices. MyButton is the button you place. MyCampfire is the fire you place. You must place these in your level first. Then, link them in the Verse editor.

The OnButtonPressed part is a function. A function is a block of code. It runs when called. Here, it holds the Extinguish command.

The line MyCampfire.Extinguish() is the magic. It calls the command on the campfire. It tells the device to put itself out.

Finally, we bind the event. MyButton.Pressed.Bind(OnButtonPressed) connects the click to the code. Now, when you click the button, the fire goes out.

Try It Yourself

Can you make the fire come back on? Try adding a new button. Call it LightButton. When this button is pressed, use the Light command on the campfire. This will turn the fire back on.

Hint: Look for the Light command in the Campfire Device documentation. It works just like Extinguish.

Recap

You learned how to use Extinguish to put out fires. You connected a button to a campfire. Now your island is safer. You can control the flames with code. Great job!

References

  • https://dev.epicgames.com/documentation/fortnite/verse-api/versedotorg/verse/exp
  • https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/versedotorg/verse/exp
  • https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/fire_volume_device/extinguish
  • https://dev.epicgames.com/documentation/en-us/fortnite/verse-api/fortnitedotcom/devices/fire_volume_device/extinguish
  • https://dev.epicgames.com/documentation/fortnite/verse-api/fortnitedotcom/devices/campfire_device/extinguish

Verse source files

Turn this into a guided course

Add Extrude 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.

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.

Comments

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