using { /Fortnite.com/Devices } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # This script attaches to a creative_device you place on your island. # It connects a trigger_device to an item_granter_device. explosive_trap_device := class(creative_device): # Place a Trigger Volume on your island and link it here. @editable MyTrigger : trigger_device = trigger_device{} # Place an Item Granter device on your island. # Set its item to Dynamite in the device properties. # Then link it to this slot. # note: item_granter_device is the real API for giving # consumable items to players in UEFN Verse. @editable MyItemGranter : item_granter_device = item_granter_device{} # OnBegin runs automatically when the game starts. # We connect our function to the trigger here. OnBegin() : void = MyTrigger.TriggeredEvent.Subscribe(OnTriggerEntered) # This function runs when a player enters the trigger volume. # 'Agent' is the person who walked in. OnTriggerEntered(Agent : agent) : void = # Tell the Item Granter to give its item to this agent. # The item (Dynamite) is configured in the device properties. MyItemGranter.GrantItem(Agent) Print("Dynamite granted! Watch out!")