Verse Library verse

02 Complete Script

A creative device that monitors player movement distance and applies damage if exceeded.

extracted-snippets/documentation/en-us/uefn/learn-code-basics-9-practice-time-in-verse/02-complete-script.verse

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/learn-code-basics-9-practice-time-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/learn-code-basics-9-practice-time-in-verse.md
# Section:    Complete Script
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Playspaces }
using { /UnrealEngine.com/Temporary/SpatialMath }

hello_world_device := class(creative_device):

# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=

    Playspace:fort_playspace = GetPlayspace()
    AllPlayers:[]player = Playspace.GetPlayers()
    
    var FirstPosition:transform = transform{}
    var SecondPosition:transform = transform{}
    
    if:
        Player:player = AllPlayers[0]
        FortniteCharacter:fort_character = Player.GetFortCharacter[]
        set FirstPosition = FortniteCharacter.GetTransform()
    then:
        Print("Move or prepare to take damage!")
        Sleep(10.0)
    
    if:

Sign in free to read the full source 🌴

This Verse Library file is members-only. Create a free account to view the complete source and download the .verse file.

Sign in with Discord

Comments

    Sign in to vote, comment, or suggest an edit. Sign in