# 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. lets us change it later. var Score : int = 0 # This function runs when the game starts. OnBegin() : 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) # This function listens for a fish catch. # It is connected to the Fishing Zone device. OnFishCaught(FishingPlayer : agent) : void = # Every time a fish is caught, add 1 to the Score. set Score = Score + 1 # Tell the player how many points they have. Print("You caught a fish! Score is now: {Score}") # Give the player a small health boost as a reward. # Cast agent to fort_character to access health functions. # note: fort_character is the real Verse type for a player's body. if (Character := FishingPlayer.GetFortCharacter[]): Character.SetHealth(Character.GetHealth() + 10.0)