First Person ADS (aim down sights) with weapons that have scopes while also using weapons without scopes

this code here will allow you to use weapons in first person that have scopes and weapons that don’t have scopes. you will simply connect everything like so

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


test_device_five := class(creative_device):

    @editable
    InputTrigger:input_trigger_device = input_trigger_device{}

    @editable
    ScopedWeapons:[]conditional_button_device = array{}

    @editable
    AddOrbitCam:trigger_device = trigger_device{}

    @editable
    RemoveOrbitCam:trigger_device = trigger_device{}

    OnBegin<override>()<suspends>:void=
        Setup()

    Setup():void=
        spawn{AwaitInput()}

    AwaitInput()<suspends>:void=
        loop:
            PressedAgent := InputTrigger.PressedEvent.Await()
            for (ScopedWeapon : ScopedWeapons):
                if (ScopedWeapon.IsHoldingItem[PressedAgent]):
                    RemoveOrbitCam.Trigger(PressedAgent)
                    spawn{AwaitRelease(PressedAgent)}

    AwaitRelease(PressedAgent:agent)<suspends>:void=
        loop:
            ReleasedAgent := InputTrigger.ReleasedEvent.Await()
            if (PressedAgent = ReleasedAgent):
                RemoveOrbitCam.Trigger(ReleasedAgent(0))