I’m trying to build a mechanism where pressing the button controls the water device, just like in the video I attached.

My Verse script is not working due to an error. Could you help me check it?
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /Fortnite.com/Devices/CreativeAnimation }
using { /UnrealEngine.com/Temporary/SpatialMath }

water2 := class(creative_device):

@editable
ActionButton : button_device = button_device{}

@editable
# water_device: creative_prop = creative_prop{}
Water02 : water_device = water_device{}

OnBegin<override>()<suspends>: void =
    # ボタンにイベント登録
    ActionButton.InteractedWithEvent.Subscribe(OnButtonInteracted)
    return

# sleep を使いたいので <suspends> をつける!
OnButtonInteracted<public>(Agent : agent): void =
    Transform :=Water02.GetTransform()
    PositionX :=Transform.Translation.X
    PositionY :=Transform.Translation.Y
    PositionZ :=Transform.Translation.Z
    BlockPosition :=vector3{X:=PositionX, Y:=PositionY,Z:= PositionZ}#現在の配置

#回転に関する情報
# BlockPosition :=vector3(X:=PositionX, Y:=PositionY, Z:=PositionZ)
# Print(“{BlockPosition}”)
NEWwaterPosition :=vector3{X:=PositionX, Y:=PositionY-5900.0,Z:= PositionZ}
loop:

        Water02.MoveTo( NEWBwaterPosition,Rotation,11.0)
            #ブロックを動かす機能

            Water02.MoveTo(waterPosition,Rotation,11.0)

Where/what is the error? Is the video not what you want to happen? Looks like it could be

 Water02.MoveTo( NEWBwaterPosition,Rotation,11.0) #Get rid of "B", make "NEWwaterPosition
1 Like

The Water Device has the BeginVerticalFilling and BeginVerticalEmptying functions Filling when called will start filling the volume of the water device with water while vertical emptying will drain it.
There is no need to use Verse’s TeleportTo or MoveTo Functions

1 Like

“Thank you for your message.

The video is available above.”

I see, thank you very much for letting me know.

Could you please tell me how I should write it so that it works? :person_bowing:t2:

Ok but please copy paste your script correctly The original one you posted is split into 3 different parts.
use ``` and make sure all of it is pasted in one piece

1 Like

Sorry for the late reply.
I’m getting an error like the one shown in the attached image.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Fortnite.com/Devices/CreativeAnimation }

water := class(creative_device):
@editable
Block : creative_prop = creative_prop{}

@editable
ActionButton : button_device = button_device{}

@editable
Water: water_device = water_device{}

OnBegin<override>()<suspends>: void =
    # ボタンにイベント登録
    ActionButton.InteractedWithEvent.Subscribe(OnButtonInteracted)
    return

OnButtonInteracted<public>(Agent : agent): void =
    Transform :=  Water.GetTransform()
    PositionX :=Transform.Translation.X
    PositionY :=Transform.Translation.Y
    PositionZ :=Transform.Translation.Z
    waterPosition :=vector3{X:=PositionX, Y:=PositionY,Z:= PositionZ}#現在の配置
   
    Rotation :=Transform.Rotation #回転に関する情報
   # BlockPosition :=vector3(X:=PositionX, Y:=PositionY, Z:=PositionZ)
  # Print("{BlockPosition}")
    NEWBwaterPosition :=vector3{X:=PositionX, Y:=PositionY,Z:= PositionZ+764.0}
   loop:
    
    Water.MoveTo( NEWBwaterPosition,Rotation,8.0)
        #ブロックを動かす機能

        Water.MoveTo(waterPosition,Rotation,8.0)

loop:
    
    Water.BeginVerticalFilling()
    Sleep(8.0)
    Water.BeginVerticalEmptying()
    Sleep(8.0)