I wish to write a verse code that moves the floor but returns it to its original position if the player dies, yet this code does not work as intended.
I suspect it fails because attempting to execute TeleportTo whilst MoveTo is still in progress causes the issue.
I would like to know the solution.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
move_floor := class(creative_device):
@editable Floor_Cube : creative_prop= creative_prop{}
@editable Teleporter : teleporter_device = teleporter_device{}
@editable
var MovingTime : float = 10.0
@editable EliminationManager: elimination_manager_device = elimination_manager_device{}
Gamestert(Agent:agent):void=
spawn:
GamestertSuspends(Agent)
GamestertSuspends(Agent:agent)<suspends>:void=
Transform := Floor_Cube.GetTransform()
PositionX := Transform.Translation.X
PositionY := Transform.Translation.Y
PositionZ := Transform.Translation.Z
Rotation := Transform.Rotation
NowPosition := vector3{X := PositionX, Y:= PositionY, Z := PositionZ}
NewRotation := Rotation.ApplyYaw(0.0)
NewPosition := vector3{X := PositionX, Y:= PositionY+30298.0, Z := PositionZ}
Floor_Cube.MoveTo(NewPosition,NewRotation,MovingTime)
OnEliminated(Agent:?agent):void=
if(Floor_Cube.TeleportTo[vector3{X:=4603.000000,Y:=14256.000000,Z:=4833.000000},Floor_Cube.GetTransform().Rotation]):
Print("kill you")
OnBegin<override>()<suspends>:void=
Teleporter.TeleportedEvent.Subscribe(Gamestert)
EliminationManager.EliminationEvent.Subscribe(OnEliminated)