# Using creative\_device classes as an editable requires it to be optional.

**URL:** <https://forums.unrealengine.com/t/using-creative-device-classes-as-an-editable-requires-it-to-be-optional/1691132>\
**Category:** Programming & Scripting\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, fortnite\
**Created:** [February 15, 2024, 6:46pm UTC](https://forums.unrealengine.com/t/using-creative-device-classes-as-an-editable-requires-it-to-be-optional/1691132 "2024-02-15T18:46:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tyler.dawson](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tyler.dawson](https://forums.unrealengine.com/u/tyler.dawson)\
**Post date:** [February 15, 2024, 6:46pm UTC](https://forums.unrealengine.com/t/using-creative-device-classes-as-an-editable-requires-it-to-be-optional/1691132/1 "2024-02-15T18:46:35Z")

</div>

This took me a while to figure out…

I was trying to make a quest system where I had a quest which made of an array of tasks and the tasks held all the information about that part of the quest. I also have a npc\_device which I was using to tie a character\_device and popup\_dialog\_device together.

I’ve shaired the relivate code below, and will explain the behavior I was getting.

When I was trying to get a NPC from a task like NPC2 it was always returning a default npc\_device regardless on if it was set in the editor or not. So Debug2 was printing out “A name goes here”. Once I switch to making my npc\_devices optional like NPC1 I could now actually get the proper npc\_device, and Debug1 prints “found npc” " _NPC.name_".

```auto
npc_device := class(creative_device):
    @editable
    CharacterDevice : character_device = character_device {}
    @editable
    DialogDevice: popup_dialog_device = popup_dialog_device {}

    @editable
    Name: string = "A name goes here"

task := class<concrete>:
    
    @editable
    Dialog : string = "This is the default npc message"
    @editable
    Options : []string = array {} 
    @editable
    NPC1 : ?npc_device = false
    @editable
    NPC2 : npc_device = npc_device {}

    Debug1(): void = 
        if(NPC := NPC_Giver?):
            Print("found npc")
            Print(NPC.Name)
        else:
            Print("There was no NPC found")

    Debug2(): void = 
        Print(NPC_Return.Name)

```

The more I use verse and the more familiar I get with optional the more I understand what they’re good for. I think in this case using an optional is better anyways, but if feels like both should work.
