Need Help with Verse Code for Triggering Door Animation in Fortnite

Hello everyone,

I’m working on a project in Unreal Engine using Verse, and I’ve encountered a challenge that I hope to get some insights on. My goal is to create an interactive scenario where doors open automatically when a perception trigger detects a player.

Here’s the plan I had in mind:

When the perception trigger device spots a player, two doors (Door_Left and Door_Right) should rotate in opposite directions to create an opening effect. I have scripted this in Verse as follows:

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

# Verse-authored creative device
Go_Invinsible_device := class(creative_device):
    @editable
    Door_Left : creative_prop = creative_prop{}

    @editable
    Door_Right : creative_prop = creative_prop{}

    @editable
    PTrigger : perception_trigger_device = perception_trigger_device{}

    # Initialization
    OnBegin<override>()<suspends>:void=
        PTrigger.DeviceSeesAgentEvent.Subscribe(OpenDoors)
        
    # Door opening logic
    OpenDoors(Agent:agent)<suspends>:void=
        OpeningSpeed : float = 4.0
        # Door_Left Rotate
        CallTranformLeft : transform = Door_Left.GetTransform()
        PropRotationLeft : rotation = CallTranformLeft.Rotation
        NewPropRotationLeft : rotation = PropRotationLeft.ApplyYaw(90.0)
        Door_Left.MoveTo(CallTranformLeft.Translation, NewPropRotationLeft, OpeningSpeed)
        # Door_Right Rotation
        CallTranformRight : transform = Door_Right.GetTransform()
        PropRotationRight : rotation = CallTranformRight.Rotation
        NewPropRotationRight : rotation = PropRotationRight.ApplyYaw(-90.0)
        Door_Right.MoveTo(CallTranformRight.Translation, NewPropRotationRight, OpeningSpeed)

However, I’m facing an issue with the Subscribe method of the perception trigger device. The error message is as follows:

"This function parameter expects a value of type agent->void, but this argument is an incompatible value of type type{_(:agent)<suspends>:void}. (3509) [Ln 22, Col 49]"

I’m seeking advice on how to properly implement this mechanism so that the doors open when the perception trigger detects a player. Any suggestions or guidance on how to resolve this error or alternative approaches to achieve the same effect would be greatly appreciated.

Thank you in advance for your help!

try not using the <suspends>

But without “suspends” I can’t use ‘MoveTo’

Try this.

OnBegin<override>()suspends:void=
     PTrigger.DeviceSeesAgentEvent.Subscribe(HandlesOpenDoors)

HandlesOpenDoors(Agent:agent):void=
     spawn:
          OpenDoors()

OpenDoors()<suspends>:void=
1 Like