# Need Help with Verse Code for Triggering Door Animation in Fortnite

**URL:** <https://forums.unrealengine.com/t/need-help-with-verse-code-for-triggering-door-animation-in-fortnite/1525745>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [December 14, 2023, 6:21pm UTC](https://forums.unrealengine.com/t/need-help-with-verse-code-for-triggering-door-animation-in-fortnite/1525745 "2023-12-14T18:21:57Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harkida1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Harkida1](https://forums.unrealengine.com/u/Harkida1)\
**Post date:** [December 14, 2023, 6:21pm UTC](https://forums.unrealengine.com/t/need-help-with-verse-code-for-triggering-door-animation-in-fortnite/1525745/1 "2023-12-14T18:21:57Z")

</div>

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:

```auto
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:

```auto
"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!

---

<div class="post-metadata">

**Author:** ![bananna\_manuk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bananna\_manuk](https://forums.unrealengine.com/u/bananna_manuk)\
**Post date:** [December 14, 2023, 7:41pm UTC](https://forums.unrealengine.com/t/need-help-with-verse-code-for-triggering-door-animation-in-fortnite/1525745/2 "2023-12-14T19:41:19Z")

</div>

> [@Harkida1](#):
>
> `OpenDoors(Agent:agent)<suspends>:void=`

try not using the `<suspends>`

---

<div class="post-metadata">

**Author:** ![Harkida1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Harkida1](https://forums.unrealengine.com/u/Harkida1)\
**Post date:** [December 15, 2023, 1:55am UTC](https://forums.unrealengine.com/t/need-help-with-verse-code-for-triggering-door-animation-in-fortnite/1525745/3 "2023-12-15T01:55:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Cleverlike\_Studios](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/cleverlike_studios/32/1216891_2.png) [@Cleverlike\_Studios](https://forums.unrealengine.com/u/Cleverlike_Studios)\
**Post date:** [December 15, 2023, 4:49am UTC](https://forums.unrealengine.com/t/need-help-with-verse-code-for-triggering-door-animation-in-fortnite/1525745/4 "2023-12-15T04:49:45Z")

</div>

Try this.

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

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

OpenDoors()<suspends>:void=

```
