Verse Library verse

01 Device

Tracks player fish catches to increment a global score and grants health rewards upon catching fish.

verse-library/using-fishing-consumables-in-fortnite-creative/01-device.verse

# This is the main script for our fishing game.
# It connects the fishing zone to the reward system.

using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

# This device class wires up to a fishing_zone_device
# placed on your island in UEFN.
fishing_tycoon_manager := class(creative_device):

    # Drag your Fishing Zone device here in the
    # UEFN Details Panel after you add this script.
    @editable
    FishingZone : fishing_zone_device = fishing_zone_device{}

    # This is our "Scoreboard" variable.
    # It starts at 0. <var> lets us change it later.
    var Score : int = 0

    # This function runs when the game starts.
    OnBegin<override>()<suspends> : void =
        # We print a message to the screen.
        Print("Fishing Tycoon Started! Catch fish!")

        # Tell the Fishing Zone to call OnFishCaught
        # every time a player catches a fish.
        FishingZone.CaughtEvent.Subscribe(OnFishCaught)

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