# This script connects buttons to actions. # Think of this as the brain of your island. using { /Fortnite.com/Devices } using { /Verse.org/Sim } # We create a "Class" which is like a blueprint for our logic. # It’s like a custom game mode. ChaosLogic := class(VerseSimContext): # This is the "Constructor". It runs once when the game starts. # It’s like the Battle Bus taking off—you set up the rules before anyone jumps. OnBegin(): # 1. Find our devices by name. # We are looking for the buttons and the item granter we placed in the editor. reward_button := FindDevice[Button](`Reward_Button`) punishment_button := FindDevice[Button](`Punishment_Button`) loot_granter := FindDevice[ItemGranter](`Loot_Grant`) # 2. Connect the Reward Button. # When this button is pressed... reward_button.PressedEvent.Subscribe( # ...do this function: func(): # Grant the player a Pump Shotgun. # We use the "Grant" function on the Item Granter. # We assume the granter is set up to give a shotgun in its options. loot_granter.Grant() # Optional: Print a message to the console for debugging. Print("You got the shotgun!") ) # 3. Connect the Punishment Button. # When this button is pressed... punishment_button.PressedEvent.Subscribe( # ...launch the player. func(): # This is a bit trickier. We need to find the player who pressed it. # For simplicity, we'll assume we trigger a Prop Mover that pushes them. # In a real scenario, you'd link this to a Prop Mover's "Activate" function. # Here, we just print a warning. Print("Oops! You triggered the trap!") # To actually launch them, you would typically: # 1. Place a Prop Mover set to "Move Up" with high force. # 2. Link the Button's PressedEvent to the Prop Mover's ActivateEvent. # Verse allows you to do this directly: # trap_mover.Activate()