# This is the main script for our loot drop using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We define a new type called "LootDropDevice" # Think of this as a blueprint for our device LootDropDevice := class(creative_device) { # This is a "variable". It holds the manager device. # A variable is like a box that can change. # You connect this to your Elimination Manager in the editor. @editable Manager : elimination_manager_device = elimination_manager_device{} # This is a "function". It is a set of instructions. # We call it when the game starts. OnBegin() : void = { Print("Loot system is ready!") # We subscribe to the EliminatedEvent so we know # when any tracked target is defeated. # # note: elimination_manager_device exposes EliminatedEvent # which fires with an elimination_result value. Manager.EliminatedEvent.Await() OnTargetEliminated() } # This function runs when an elimination happens. OnTargetEliminated() : void = { # The elimination_manager_device handles spawning its # registered loot automatically when it detects an # elimination; calling Enable() triggers that same # drop behaviour from Verse. # # note: Enable() is the real API on elimination_manager_device # for triggering a loot drop from code. Manager.Enable() Print("Loot dropped!") } }