# VictoryScript.ver
# This script listens for a player to step on the VictoryPad
# and then ends the game with a victory.
# 1. Define the script structure
Script := script:
# 2. Create a variable to hold the End Game Device
# @editable means you can select the device in the editor UI
# : end_game_device defines the TYPE of this variable
VictoryDevice: end_game_device = end_game_device{}
# 3. Create a variable for the Trigger Volume (the pad)
# We'll assume you have a Trigger Volume placed in the level
# For this example, we'll use a simple trigger_device
VictoryPad: trigger_device = trigger_device{}
# 4. The Main Loop: Listen for events
Main := function():
# This line waits for the VictoryPad to be activated
# Think of it as "listening" for the signal
for event := VictoryPad.Activated:
# When the pad is stepped on, this code runs:
print("Player hit the Victory Pad! Ending game...")
# 5. Call the EndGame function on our device
# We pass the team ID of the player who triggered it
# This ensures the correct team gets the victory screen
VictoryDevice.EndGame(VictoryPad.GetTriggeringPlayerTeamId())
Verse Library
verse
01 Fragment
Listens for a trigger pad activation and calls the end game function for the winning team.
verse-library/end-game-device/01-fragment.verse