using { /Fortnite.com/Devices } using { /Verse.org/Random } using { /Verse.org/Simulation } using { /UnrealEngine.com/Temporary/SpatialMath } # This is our script. It attaches to a device in the UEFN scene. StormChaserScript := class(creative_device): # We need a reference to the storm device. # Think of this as "equipping" the storm in our script's inventory. # Drag your Basic Storm Controller into this slot in the Details Panel. @editable StormDevice : basic_storm_controller_device = basic_storm_controller_device{} # The maximum number of centimeters the storm center can shift per move. # Keeping this as a constant stops the storm from teleporting off the map. MaxOffset : float = 5000.0 # 5000 cm = 50 meters in Unreal units # OnBegin fires automatically when the game session starts. # means this function is allowed to sleep/wait mid-execution. OnBegin() : void = MoveStormRandomly() # Packages the storm-movement logic into a reusable function. # Call this from OnBegin, a button event, or a loop—your choice. MoveStormRandomly() : void = # 1. Get the storm controller's current world transform, # then read the translation vector as our "current position". CurrentTransform := StormDevice.GetTransform() CurrentPos := CurrentTransform.Translation # 2. Generate random offsets on the X and Y axes. # GetRandomFloat() returns a value in [0.0, 1.0], so we # remap it to [-MaxOffset, +MaxOffset] by hand. RawX := GetRandomFloat(0.0, 1.0) # 0.0 … 1.0 RawY := GetRandomFloat(0.0, 1.0) OffsetX := (RawX * 2.0 - 1.0) * MaxOffset # -MaxOffset … +MaxOffset OffsetY := (RawY * 2.0 - 1.0) * MaxOffset # 3. Calculate the new target position. # We keep Z unchanged so the storm stays at its original height. NewX := CurrentPos.X + OffsetX NewY := CurrentPos.Y + OffsetY NewZ := CurrentPos.Z # 4. Build the destination vector and teleport the device there. # Moving the creative_device itself repositions the storm circle. NewPosition := vector3{X := NewX, Y := NewY, Z := NewZ} NewRotation := StormDevice.GetTransform().Rotation if (StormDevice.TeleportTo[NewPosition, NewRotation]): # Teleport succeeded # note: basic_storm_controller_device has no SetStormCircleCenter() API; # repositioning the device via TeleportTo is the supported approach.