VerseIsland
FeedLearnLeaderboardGuidesReferenceExploreSearchDocsVerse Library
Sign in
Feed Learn 📖 Codex Leaderboard Guides Reference Explore Search Docs Verse Library
Browse UEFN›Verse Language·Up to UEFN · Verse Language·45 of 123 in Verse Language

Lesson 6: Practice Time!

Lesson 6: Practice Time!

Now that you know the structure of a function, its time to build your own two of your own, in fact!

Now that you know the structure of a function, it’s time to build your own — two of your own, in fact!

Now that you know the structure of a function, it’s time to build your own — two of your own, in fact!

In the last exercise, you learned the lines of code needed to damage a player character in Fortnite. It would be better if you didn’t have to type those same lines every time you needed that code.

  1. Declare a function named HurtPlayer(). It will have a return type of void, which means it won’t return a value. Put the function declaration at the very end of your Verse file. The body of the function is the same code from Lesson 5: Practice Time, so check there if you need a refresher.

    
    
    |  | 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) |

You're reading a preview

The full reference is free for BrainDeadGuild Discord members — sign in to read it all, or open the original at the source.

Sign in with Discord — free for members Read the original at Epic Games documentation

Sign in with your BrainDead.TV / BrainDeadGuild Discord account for full access.

Guided course

Add this to your free study plan — we’ll suggest related material and stitch it into one compile-checked lesson.

Keep exploring
More in Verse Language · 45 of 123
Prev
learn code basics 6 defining a function in verse
Next
learn code basics 7 practice time in verse
Browse all files in this folder (A–Z)

Source

Epic Games documentation

View original

Last updated 2024-12-05T00:00:00+00:00

VerseIsland· an archipelago of Verse & UEFN knowledge
🗺️ Island atlasLearnGuidesHistoryAbout & PressSources & LicensingPrivacy PolicyTermsStatus

Not affiliated with Epic Games. Fortnite, UEFN, Unreal Engine, and Verse are trademarks of Epic Games, Inc. Content is attributed to its source — see Sources & Licensing.

🦜

Scout · your island guide

The Isle of Verse