# This is our healing pizza script! using { /Fortnite.com/Devices } using { /Fortnite.com/Characters } using { /Fortnite.com/Game } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/Diagnostics } # We tell Verse which device we are using. # This is like giving the script a name tag. healing_pizza_manager := class(creative_device): # We connect to a Trigger device placed in the world. # The Trigger fires when a player walks into its zone. @editable HealTrigger : trigger_device = trigger_device{} # This is the main function. # It runs when the game starts. OnBegin() : void = # We subscribe to the TriggeredEvent so we know # when a player walks into the trigger zone. HealTrigger.TriggeredEvent.Subscribe(OnPlayerEntered) # This function runs every time a player enters the trigger. OnPlayerEntered(Agent : agent) : void = # We need to turn the agent into a fort_character # so we can change their health. # note: GetFortCharacter() returns an option type; we use 'if' to unwrap it safely. if (Character := Agent.GetFortCharacter[]): # Then we heal them! # We add 25 health to their green bar. # note: SetHealth sets the absolute value; we read current health first and add 25. CurrentHealth := Character.GetHealth() NewHealth := CurrentHealth + 25.0 Character.SetHealth(NewHealth)