# This is our main script file using { /Fortnite.com/Devices } using { /Verse.org/Simulation } # We define a new script type called DrumBeat DrumBeat := class(creative_device) { # Here we list the devices we need # "MyTrigger" is the name we give to the trigger device @editable MyTrigger : trigger_device = trigger_device{} # "MyDrum" is the name we give to the Drum Player device @editable MyDrum : Patchwork.drum_player_device = Patchwork.drum_player_device{} # This function runs when the game starts OnBegin() : void = { # We listen for the trigger to be pressed # When it happens, we play the drum MyTrigger.TriggeredEvent.Subscribe(OnTriggered) } # This function is called when the trigger fires OnTriggered(Agent : ?agent) : void = { # This line tells the drum to enable (play) # note: drum_player_device inherits Enable() from patchwork_device MyDrum.Enable() } }