Verse Library verse

03 Complete Script

Damages the first player on start, pauses five seconds, then heals them using character methods.

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

# Source URL: https://dev.epicgames.com/documentation/en-us/uefn/learn-code-basics-6-practice-time-in-verse
# Local doc:  epic-docs/documentation/en-us/uefn/learn-code-basics-6-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=

        HurtPlayer()
        Print("Player Hurt")
        Sleep(5.0)
        HealPlayer()
        Print("Player Healed")  

    HurtPlayer() : void =
        Playspace: fort_playspace = GetPlayspace()
        AllPlayers: []player = Playspace.GetPlayers()
        if (FirstPlayer : player = AllPlayers[0]):
            if (FortniteCharacter : fort_character = FirstPlayer.GetFortCharacter[]):
                FortniteCharacter.Damage(50.0)

    HealPlayer() : void =
        Playspace: fort_playspace = GetPlayspace()
        AllPlayers: []player = Playspace.GetPlayers()

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