Skip to content

Instantly share code, notes, and snippets.

@LionGet
Last active September 4, 2023 06:28
Show Gist options
  • Save LionGet/29c9ea451182abf8091a373fb8f41efa to your computer and use it in GitHub Desktop.
Save LionGet/29c9ea451182abf8091a373fb8f41efa to your computer and use it in GitHub Desktop.
DBNO Teleporter system to teleport the player who gets a kill to a teleporter. File 2 has comments. File 1 is the same code without comments.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Fortnite.com/Playspaces }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /UnrealEngine.com/Temporary/Diagnostics }
game_manager_device:=class(creative_device):
@editable DBNO : down_but_not_out_device = down_but_not_out_device {}
@editable Teleporter1 : teleporter_device = teleporter_device {}
@editable Teleporter2 : teleporter_device = teleporter_device {}
@editable ScoreManager : score_manager_device = score_manager_device {}
OnBegin<override>()<suspends>:void=
DBNO.AgentDownedEvent.Subscribe(DownedEvent)
DownedEvent(Agent:agent):void=
Playspace : fort_playspace = GetPlayspace()
AllPlayers : []player = Playspace.GetPlayers()
for (Index -> Players : AllPlayers):
if (Player := player[Agent]):
if (Player = AllPlayers[0]):
if (InPlayer:=AllPlayers[1]):
ScoreManager.Activate(InPlayer)
Teleporter2.Activate(InPlayer)
else:
if (InPlayer:=AllPlayers[0]):
ScoreManager.Activate(InPlayer)
Teleporter1.Activate(InPlayer)
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /Fortnite.com/Playspaces }
using { /Fortnite.com/Characters }
using { /Fortnite.com/Game }
using { /UnrealEngine.com/Temporary/Diagnostics }
game_manager_device:=class(creative_device):
@editable DBNO : down_but_not_out_device = down_but_not_out_device {}
# Teleporter for Player 1
@editable Teleporter1 : teleporter_device = teleporter_device {}
# Teleporter for Player 2
@editable Teleporter2 : teleporter_device = teleporter_device {}
# Make sure you configure your score device to apply the appropriate score per activation
@editable ScoreManager : score_manager_device = score_manager_device {}
OnBegin<override>()<suspends>:void=
# This triggers whenever a player goes down
DBNO.AgentDownedEvent.Subscribe(DownedEvent)
DownedEvent(Agent:agent):void=
# Grabbing the players
Playspace : fort_playspace = GetPlayspace()
AllPlayers : []player = Playspace.GetPlayers()
for (Index -> Players : AllPlayers):
# if the player who goes down is Player 1
if (Player := player[Agent]):
if (Player = AllPlayers[0]):
# teleport Player 2 and activate the score device for them
if (InPlayer:=AllPlayers[1]):
ScoreManager.Activate(InPlayer)
Teleporter2.Activate(InPlayer)
else:
# otherwise teleport Player 1 and activate the score device for them
if (InPlayer:=AllPlayers[0]):
ScoreManager.Activate(InPlayer)
Teleporter1.Activate(InPlayer)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment