Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using { /Fortnite.com/Devices }
- using { /Fortnite.com/Characters }
- using { /Fortnite.com/Game }
- using { /Verse.org/Simulation }
- using { /Verse.org/Simulation/Tags }
- using { /Verse.org/Random }
- using { /UnrealEngine.com/Temporary/Diagnostics }
- # See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.
- # A Verse-authored creative device that can be placed in a level
- gun_game_device := class(creative_device):
- @editable
- UpgradeLevel_01 : int = 5 # SIDEWAYS SCYTHE UNLOCK AT LEVEL 100 / 5 for testing purposes
- @editable
- UpgradeLevel_02 : int = 7 # KINETIC BLADE UNLOCK AT LEVEL 500 / 7 for testing purposes
- @editable
- UpgradeLevel_03 : int = 10 # INFINITY BLADE UNLOCK AT LEVEL 1000 / 10 for testing purposes
- var CurrentLevel : int = 1
- MinLevel : int = 1
- # Map container to track players progress. This is how to determine which weapon to award to the player
- var AgentMap : [agent]int = map{}
- # Runs when the device is started in a running game
- OnBegin<override>()<suspends>:void=
- # Get all the players in the experience
- AllPlayers := GetPlayspace().GetPlayers()
- for (GunGamePlayer : AllPlayers):
- if (FortCharacter := GunGamePlayer.GetFortCharacter[]):
- FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated) # subscribe to eliminated event
- # Add Players to a Map to track progress
- if (set AgentMap[GunGamePlayer] = 1) {}
- # Event that handles when a player is getting an elimination
- OnPlayerEliminated(Result:elimination_result):void=
- Print("Player got a kill")
- EliminatingCharacter := Result.EliminatingCharacter
- if (FortCharacter := EliminatingCharacter?):
- if (EliminatingAgent := FortCharacter.GetAgent[]):
- #CurrentLevel : int = 1
- #CurrentLevelTest : int = CurrentLevel + 1;
- set CurrentLevel = CurrentLevel + 1
- Print("Player Level updated to {CurrentLevel}")
- if (CurrentLevel >= UpgradeLevel_01):
- Print("GIVING PLAYER SIDEWAYS SCYTHE")
- else if (CurrentLevel >= UpgradeLevel_02):
- Print("GIVING PLAYER KINETIC BLADE")
- else if (CurrentLevel >= UpgradeLevel_03):
- Print("GIVING PLAYER INFINITY BLADE")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement