Verse Library verse

03 Complete Script

Defines a custom creative device that automatically deals damage to the first player upon game start.

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

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

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()
        if (FirstPlayer : player = AllPlayers[0]):
            if (FortniteCharacter : fort_character = FirstPlayer.GetFortCharacter[]):
                FortniteCharacter.Damage(50.0)
Copy full snippet

Comments

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