# This is our module. Think of it as the "Island" itself.
module Revenge_Trap
# We need to import the tools we need from Fortnite's API.
using /Fortnite.com/Devices
using /Fortnite.com/Components
# --- THE TURRET LOGIC ---
# This function checks the turret's health.
# Effect: reads
# Why? Because we are just looking at the health number.
# We aren't changing it. It's like checking your shield bar.
Get_Turret_Health := function(turret: CreativeDevice): int =>
# GetHealth is a standard device function.
# It returns an integer (whole number).
turret.GetHealth()
# This function makes the turret fire.
# Effect: writes
# Why? Because it changes the state of the game (spawns a projectile).
# It might also reduce ammo, which is a write operation.
Fire_Turret := function(turret: CreativeDevice): void =>
# This is a placeholder for the actual firing logic.
# In real Verse, you'd call something like:
# turret.Fire() or spawn_projectile(...)
# Since this changes the world, it has the 'writes' effect.
print("Turret fires at intruder!")
# This is our main event handler.
Verse Library
verse
01 Fragment
Demonstrates Verse read/write effect system using a turret trigger that checks health and fires on player entry.
verse-library/attributes-and-effects/01-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.