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.
-
Declare a function named
HurtPlayer(). It will have a return type ofvoid, 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 your BrainDead.TV / BrainDeadGuild Discord account for full access.