using { /Fortnite.com/Devices } using { /Unreal.com/Devices } # This is our main island script. # Think of it as the "Game Director" that controls the rules. double_trouble_island := class(verseworld): # --- DEVICES --- # These are the physical objects in your level. ScoreManager: ScoreManagerDevice = ScoreManagerDevice{} DoubleSwitch: SwitchDevice = SwitchDevice{} PointTrigger: TriggerVolumeDevice = TriggerVolumeDevice{} # --- VARIABLES --- # A variable is like a scoreboard that only the script can see. # It remembers if "Double Trouble" is currently active. is_double_active: bool = false # --- SETUP --- # This runs once when the game starts. on_begin():void= # Make sure the switch starts in the "Off" position. DoubleSwitch.SetState(false) # Connect the trigger to our "on_player_entered" function. # When someone steps into the trigger, run this code. PointTrigger.OnActorEntered += on_player_entered # --- THE LOGIC --- # This function runs every time a player steps into the trigger. on_player_entered := func(actor: actor): # 1. Check the Switch State # If the switch is ON, we want double points. if (DoubleSwitch.GetState() == true): is_double_active = true else: is_double_active = false # 2. Decide the Points # We use a simple math check. If active, 200. If not, 100. points_to_award := 100 if (is_double_active): points_to_award = 200 # 3. THE MAGIC SAUCE: SetScoreAward # This tells the ScoreManager: "For the NEXT point you give, # make it worth 'points_to_award' instead of the default." ScoreManager.SetScoreAward(points_to_award) # 4. Actually Give the Points # We activate the ScoreManager with the player who entered. # This awards the points we just set. ScoreManager.Activate(actor) # Optional: Print a message to the screen so the player knows what happened. if (is_double_active): PrintToPlayer(actor, "DOUBLE POINTS! +200") else: PrintToPlayer(actor, "Normal Points. +100")