I really need a Sleep(2.0) before the Player gets teleported and the explosvie device explodes after an elimination. Unfortunately however i try to achieve it it’s impossible. If i try adding the sleep function right on top abover the line “FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated)” nothing happens. If i try to add to the line of “OnPlayerEliminated” i get the error “This function parameter expects a value of type elimination_result->void, but this argument is an incompatible value of type type{_(:elimination_result):void}.” at the top line again.
I thought I could do it as I did with the “MoveWall” function and the “spawn:” but since the “OnPlayerEliminated” has a result and everything I couldn’t get that to work too.
Your help what mean the world. Thank you for looking into it!
FULL CODE:
using { /Fortnite.com/Devices }
using { /Fortnite.com/Characters }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Playspaces }
using { /Fortnite.com/Game}
# 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
gamer_manager := class(creative_device):
@editable var Wall : creative_prop = creative_prop{}
@editable var DropWallButton : button_device = button_device{}
@editable var StartPositions : vector3 = vector3{}
@editable var EndPositions : vector3 = vector3{}
@editable var ShieldButtonLower : button_device = button_device{}
@editable var ShieldButtonHigher : button_device = button_device{}
@editable var TeleportDrop : teleporter_device = teleporter_device{}
@editable var ExplosiveDevice : explosive_device = explosive_device{}
@editable var ClassDesigner175 : class_designer_device = class_designer_device{}
@editable var ClassDesigner200 : class_designer_device = class_designer_device{}
@editable var ClassSelector175 : class_and_team_selector_device = class_and_team_selector_device{}
@editable var ClassSelector200 : class_and_team_selector_device = class_and_team_selector_device{}
# Runs when the device is started in a running game
OnBegin<override>()<suspends>:void=
AllPlayers:= GetPlayspace().GetPlayers()
for (EliminationGamePlayer : AllPlayers):
if (FortCharacter := EliminationGamePlayer.GetFortCharacter[]):
FortCharacter.EliminatedEvent().Subscribe(OnPlayerEliminated)
DropWallButton.InteractedWithEvent.Subscribe(OnButtonClick)
ShieldButtonLower.InteractedWithEvent.Subscribe(OnButtonClickShieldLower)
ShieldButtonHigher.InteractedWithEvent.Subscribe(OnButtonClickShieldHigher)
OnButtonClick(InPlayer:agent):void =
spawn:
MoveWall()
MoveWall()<suspends>:void=
Sleep(2.0)
if (Wall.TeleportTo[EndPositions, Wall.GetTransform().Rotation]) {}
Sleep(2.0)
if (Wall.TeleportTo[StartPositions, Wall.GetTransform().Rotation]) {}
OnButtonClickShieldLower(Agent:agent):void=
AllPlayers := GetPlayspace().GetPlayers()
for (Player : AllPlayers, FortCharacter := Player.GetFortCharacter[]):
ClassSelector175.ChangeClass(Player)
OnButtonClickShieldHigher(Agent:agent):void=
AllPlayers := GetPlayspace().GetPlayers()
for (Player : AllPlayers, FortCharacter := Player.GetFortCharacter[]):
ClassSelector200.ChangeClass(Player)
OnPlayerEliminated(Result : elimination_result):void =
EliminatingCharacter := Result.EliminatingCharacter
if (FortCharacter := EliminatingCharacter?):
if (EliminatingAgent := FortCharacter.GetAgent[]):
TeleportDrop.Teleport(EliminatingAgent)
ExplosiveDevice.Explode(EliminatingAgent)
ExplosiveDevice.Reset()
# Get only the first fort_character object on an island
GetFirstFortniteCharacter()<transacts><decides>:fort_character=
# Get a reference to the playspace, the container for an entire experience.
Playspace : fort_playspace = GetPlayspace()
# Get all players within the playspace.
AllPlayers : []player = Playspace.GetPlayers()
# Get the first player in the array of all players.
# If there's only one player in the experience, this will be that player.
Player : player = AllPlayers[0]
# Get the fort_character object associated with the player and return it.
FortniteCharacter : fort_character = Player.GetFortCharacter[]
return FortniteCharacter
# Get an array of all the fort_character objects on an island
GetAllFortniteCharacters():[]fort_character=
AllPlayers:[]player = GetPlayspace().GetPlayers()
for (Player : AllPlayers, Character := Player.GetFortCharacter[]):
Character